News for hackers. Stuff that matters.
Re:Popular Git config options by davidhaymond on Friday February 16, 2024 @05:44PM (#39404010)
That's a nifty option! In (neo)vim, I like to use the ZZ keybinding to quickly save if modified and then quit. If I want to abort the commit, I'll type ZQ to discard changes and quit.
Re:Popular Git config options by sodapopcan on Friday February 16, 2024 @05:54PM (#39404119)
Ya, it's somewhat surprising that ZZ isn't the binding that is burned into people's minds instead of :wq<cr>. I've even met regular vim users who don't know ZZ which, to be a bit hyperbolic, is mindboggling.

EDIT: And of course there is vim -y to make vim behave more like a "normal" editor than even nano :D (ie, you get ctrl-s and ctrl-q).

Re:Popular Git config options by FPGAhacker on Friday February 16, 2024 @06:47PM (#39404586)
I've been using vi variants for decades and didn't know ZZ or ZQ. This solves a major pain point for me (mis-typing :q, trying again, now I'm off in the weeds).
Re:Popular Git config options by sodapopcan on Friday February 16, 2024 @06:55PM (#39404641)
ZZ is particularly nice since it sorta "does the right thing" in that if you have an unwritten empty buffer, it will silently discard it and quit. I guess I haven't really run into this as I was taught ZZ from the beginning but I imagine hitting :wq<cr> on such a buffer is pretty annoying.
Re:Popular Git config options by FPGAhacker on Friday February 16, 2024 @09:03PM (#39405596)
The worst part is q: is a different command. so if you are trying to :q and miss the colon and try again, you run some other damn f*cking command.
Re:Popular Git config options by sodapopcan on Friday February 16, 2024 @10:05PM (#39405949)
Oh I still do that often enough, lol.
Re:Popular Git config options by jdougan on Friday February 16, 2024 @06:12PM (#39404287)
For me, it's because when I learned BSD 4.2 vi in the mid-80s the emphasis was on learning the decomposed commands then building up. If you learned w and q , wq is obvious and non-magical.
Re:Popular Git config options by sodapopcan on Friday February 16, 2024 @06:57PM (#39404653)
Certainly a fair point!
Re:Popular Git config options by pxeger1 on Friday February 16, 2024 @06:49PM (#39404606)
Huh, I didn’t think of ZQ (to leave an empty commit message) to cancel the commit. I always use :cq (which exits vim with an error status)
Re:Popular Git config options by remram on Saturday February 17, 2024 @11:35PM (#39416251)
If you are in `git commit --amend` or am/rebase/cherry-pick, the message did not start empty, and using ZQ will proceed with committing. :cq is a good idea.