4 ms·
Actually, why do so many people still use :wq? Vim has :x which does the same thing and saves a keystroke and saving keystrokes is what Vim is about, right?
by erikb 9y ago
Actually, why do so many people still use :wq? Vim has :x which does the same thing and saves a keystroke and saving keystrokes is what Vim is about, right?
- Snoddas 9y agoMuscle memory
- AndrewOMartin 9y agoI didn't know about it until now. It might be because after a change I know I want to :w, but haven't yet decided if I also want to :q.
- erikb 9y agoIn such a situation I also do the :w and :q separately without even considering :x.
- ComputerGuru 9y agoZZ is way faster than either, especially on Dvorak.
- erikb 9y agoWhat is the difference in Dvorak here? Is shift not used for upper case letters?
- ComputerGuru 9y agoNo, but w and q are on opposite sides of the keyboard.
- e12e 9y agoWhich should make wq faster?
- ComputerGuru 9y agoYou're forgetting the colon. You're already pressing shift.
- e12e 9y agoActually I meant that when touch typing, using both hands is quicker than one hand/typing the same character twice. But you're right ofcourse ; it's ":wq" vs "ZZ" - which means the latter is quicker. Not that I actually think it matters much, but that's neither here nor there - it's important to decide what colour the bikeshed should be ;)
- jack_pp 9y agodid NOT know this, thanks a lot lol. (vim user for 5 years)
- deleted 9y ago[deleted]
- Sean1708 9y agoActually, why do so many people still use :x? Vim has ZZ which does the same thing and saves a keystroke and saving keystrokes is what Vim is about, right?
- erikb 9y agoI know it was more of a joke, but there are actual reasons not to use ZZ. (1) The difference is small, but one could argue that shift-z shift-z are more like 3.5 clicks, while shift-dot x are certainly 3 clicks. (2) People are used to do a colon before an actual interaction with the editor instead of the text. (3) taste. Even if one argues that both has the same effort then taste is the final decision and there people can be different.
- slazaro 9y agoRegarding (1), ZZ is [hold shift][type zz][release shift], while :x is [hold shift][type :][release shift][type x], so I'd say :x is 1 more action than ZZ, and the timing of the release makes it slower IMO.
- slazaro 9y agoIs there a parallel to :w as ZZ is to :wq or :x? With my layout at least, typing double colons is a bit more annoying than regular letters.
- stryan 9y agoIIRC :wq always writes to and exits the file, thus updating the timestamp on it. :x (and ZZ) will only write to the file if there are new changes. So there is a difference between the two. Personally, I just use :wq because muscle memory and that I sometimes find knowing the last time I even opened the file in an editor is a useful thing to know.
- otterpro 9y agoI use :x all the time, and I haven't used :wq, at least in a while. Also, I remapped ctrl-s to :w, which is easier especially when control key is my capslock key. But I do get a kick of seeing the ":wq" joke/sticker, which is funny but only Vim users can understand.
- urmish 9y agonmap <C-m> <ESC>:w!<CR> nmap <C-n> <ESC>:q<CR> nmap <C-l> <ESC>:q!<CR> This is much better. Ctrl-M followed by N does a fast :wq