Live data from Hacker News

Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

news.ycombinator.com

51–60 of 279 posts

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#52
post #48

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…

A menu? WTF is that? Some sort of out-dated ui element no doubt.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#53
post #48

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…

A menu? WTF is that? Some sort of out-dated ui element no doubt.

It should be some phrase you tell a smart speaker, or perhaps a chatbot

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#54
post #50

I 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.

Yeah, thanks for this. `:wq` is pretty fast to write. I think I will stick to it.

Or, as other have pointed out, just use `ZZ` which is even easier and equivilant to `:x`.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#55

I 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.

Thanks for bringing this up.

I'm toying with either disabling it,

    cmap X 
or, mapping it down to a lower x.

    cmap X x
1. Does anyone see anything this could interfere with?

2. Does anyone know a better way to turn off the `:X` encryption option?

Sadly, having to remap definitely dulls the shine of `:x`.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#56
I am surprised it is not already mentioned in the comments, but I personally cannot use an editor that doesn't automatically write changes when I am done typing. I just forget to save and wonder why the app I am working on did not change. So my (neo)vim setup uses a plugin like `Pocco81/auto-save.nvim`.

This solves the problem mentioned by OP because I can just `:q` anytime.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#59
post #48

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
Post reply on HN