@@ 94,7 94,31 @@ func commit() {
win.Ctl("clean")
}
-func main() {
+func giteditor() {
+ cwin, err := acme.New()
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ cwin.Ctl("name " + os.Args[1])
+ cwin.Ctl("get")
+
+ for e := range cwin.EventChan() {
+ switch e.C2 {
+ case 'x', 'X': // execute
+ text := string(e.Text)
+ switch text {
+ case "Del":
+ cwin.Ctl("delete")
+ break
+ }
+ }
+ cwin.WriteEvent(e)
+ }
+ os.Exit(0)
+}
+
+func acmegit() {
var err error
win, err = acme.New()
@@ 126,6 150,15 @@ func main() {
}
}
+func main() {
+ _, isGitEditor := os.LookupEnv("GIT_EXEC_PATH")
+ if isGitEditor {
+ giteditor()
+ } else {
+ acmegit()
+ }
+}
+
func events() {
for e := range win.EventChan() {
switch e.C2 {