3 ms·
One thing I've found nano useful for: git commit messages. If the commit file is empty, that cancels the commit. Nano will tell me how many lines it actually w
by jejones3141 5y ago
One thing I've found nano useful for: git commit messages.
If the commit file is empty, that cancels the commit. Nano will tell me how many lines it actually wrote, so if I have second thoughts I can cancel with certainty. Nano may well not be unique in that regard, but I tripped over another editor that saved what I thought was an empty file as a single line with just the EOL character.
- jolmg 5y agoYou can have a bunch of comments and empty lines, even with spaces, and git will still abort if you don't have anything else in the commit message. An EOL/newline character shouldn't cause the commit to continue.
- hiq 5y agoI rarely write commit messages until they're ready, so I usually :q! when I realize I actually don't want to commit just yet.
- MayeulC 5y agoI like to quit vim with a non-zero return value in some exceptional cases. git and most other tools will interpret this as "something bad happened" and won't do anything further :cq