Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>
Use EDITOR config variable or default to vi
commands/write.go | 11 ++++++++++-
diff --git a/commands/write.go b/commands/write.go index 237c0a48ca58cd7f9d520d26a605f8001fb880c9..cff831b757e554be782752b9894861152cc1df0d 100644 --- a/commands/write.go +++ b/commands/write.go @@ -7,7 +7,16 @@ "os/exec" ) func Write(note models.Note) error { - cmd := exec.Command("vim", note.Path) + var ( + editor string + ) + + editor = os.Getenv("EDITOR") + if editor == "" { + editor = "vi" + } + + cmd := exec.Command(editor, note.Path) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr