See, that's why even though I'm a terminal user first and foremost, I really like the discoverability of GUIs, and that's where a good GUI is unbeatable by CLI. This would have just been an entry "Save if needed" in the File menu, right below "Save", and users would probably find it by accident while looking at the menu, even while not actively looking for new ways to save a file. (Not getting into the fact that a we…
programs like vim and tmux desperately need a menu which just shows all available commands (including plugins), even if it’s opt-in. AFAIK no such menu actually exists in vim or neovim because of the way some of the commands are hard-coded
Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
81–90 of 279 posts
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#82Keybinds (in normal mode): Shift + ZZ -> :x (save only if needed and quit) Shift + ZQ -> :q! (quit without saving)
I always use ZZ! It’s so much more convenient to type with one hand
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#83I learned to do `:wq` after I learned that `:X` encrypts your file. When typing without really paying attention to the screen, I've twice encrypted my file with password like `cd tmp`, then saved the config file, breaking my system. After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
I have computer-literate parents and grew up in the PC era, so as a child I typed my elementary school assignments in vi. Accidentally using :X, encrypting one of my school papers, and having to completely rewrite it, was one of the slightly-traumatizing moments in my childhood. FWIW, I switched to :wq for a while but I'm back to using :x instead of :wq. I'm just very careful now. :)
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#84See, that's why even though I'm a terminal user first and foremost, I really like the discoverability of GUIs, and that's where a good GUI is unbeatable by CLI. This would have just been an entry "Save if needed" in the File menu, right below "Save", and users would probably find it by accident while looking at the menu, even while not actively looking for new ways to save a file. (Not getting into the fact that a we…
> even though I'm a terminal user ... I really like the discoverability of GUIs, and that's where a good GUI is unbeatable by CLI. CLI has poor discoverability? Sure; but even on the terminal, discoverability can still be good: A couple of nice examples of discoverability in keyboard-focused programs: - emacs' which-key[0]; there's a vim port[1] too. This shows you (some) of the available keybindings for the next inp…
In practice (which is what matters, ultimately), most CLI tools don't have this desirable property of "discoverable by accident".
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#85Earlier quoted context omitted.
Or, as other have pointed out, just use `ZZ` which is even easier and equivilant to `:x`.
:q, if you didn’t make a change, is even shorter.
The advantage of `ZZ` is that it can be used as a general "close this window" command. It'll work on unmodifiable buffers as well without complaining.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#86See, that's why even though I'm a terminal user first and foremost, I really like the discoverability of GUIs, and that's where a good GUI is unbeatable by CLI. This would have just been an entry "Save if needed" in the File menu, right below "Save", and users would probably find it by accident while looking at the menu, even while not actively looking for new ways to save a file. (Not getting into the fact that a we…
programs like vim and tmux desperately need a menu which just shows all available commands (including plugins), even if it’s opt-in. AFAIK no such menu actually exists in vim or neovim because of the way some of the commands are hard-coded
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#87Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#88I learned to do `:wq` after I learned that `:X` encrypts your file. When typing without really paying attention to the screen, I've twice encrypted my file with password like `cd tmp`, then saved the config file, breaking my system. After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
nnoremap :
Has done wonders for my fingers.