7
When using vim for “replying” to some program – typically git – it can be useful to deliberate exit with error, to abort the entire action that opened the window. Like
$ git commit -a
# vim opens, showing me the staged files and asking for a commit message
# oops, I see some stuff staged that wasn't supposed to be committed
:cq # exit vim with nonzero exit code
This will prevent git
from actually doing the commit.
Now unfortunately, some machines have nano
configured as the default editor, so I occasionally find myself in that editor and correspondingly helpless.
What I've done for now was: log in with another ssh
session and killall editor
.
Is there a way to do the same thing from within nano itself, corresponding to vim's :cq
?