Live data from Hacker News

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

news.ycombinator.com

141–150 of 279 posts

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

#141

I also have a funny related thing to Tell HN: `git --amend` -> `:wq` is shorter and faster to type than `git --amend --no-edit`

I often have the variant with --amend --no-edit in my bash history, so that I press up about two or three times instead of writing anyting at all.

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

#142
post #112

Earlier quoted context omitted.

I just tried it. :X asks you to enter an encryption key, then asks you to enter it again, and only continues if the keys match. And then you're still in vim and need to save your file to overwrite anything. Seems hard to do by mistake. (though I prefer ZZ)

If only! I was a TA for an introductory CS class that taught C++ and, in passing, vi. A hour before one assignment was due, a student showed up in a panic. “I just had it working but then the computer corrupted my file. Look! Can I have an extension?” The other TA and I smirked: What a lame excuse! We offered some generic advice about starting earlier and visiting office hours. He left in a huff. A few minutes later,…

[flagged]

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

#143
post #65

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.

In neovim, :X (and cryptography in general) is removed https://github.com/neovim/neovim/commit/85338fe

This is different from :x though

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

#144

Earlier quoted context omitted.

If only! I was a TA for an introductory CS class that taught C++ and, in passing, vi. A hour before one assignment was due, a student showed up in a panic. “I just had it working but then the computer corrupted my file. Look! Can I have an extension?” The other TA and I smirked: What a lame excuse! We offered some generic advice about starting earlier and visiting office hours. He left in a huff. A few minutes later,…

[flagged]

Probably apologized for dismissing the first student who went to them rather than taking him seriously.

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

#145
post #51

Earlier quoted context omitted.

Make sure to see this comment about :X encrypting your file instead of exiting https://news.ycombinator.com/item?id=34288446

I can't help but see that argument as post rationalization from people who have bee using :wq their whole life \s Been using :x from the start about 4 years ago and I never accidentally encrypted a file.

[deleted]

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

#146

Earlier quoted context omitted.

ctrl+c is the same and even easier to type. I never use escape.

That’s not the exact same as Escape.

OK but as I personally see no need for escape in my use of vim, I judge it to be equivalent for my purpose (returning to normal mode).

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

#147
post #141

I also have a funny related thing to Tell HN: `git --amend` -> `:wq` is shorter and faster to type than `git --amend --no-edit`

I often have the variant with --amend --no-edit in my bash history, so that I press up about two or three times instead of writing anyting at all.

I'm thinking if you are joking or not! You press arrow 3 times + hope it hits whereas `:wq` 3 chars with 100% certainty.

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

#148

I also have a funny related thing to Tell HN: `git --amend` -> `:wq` is shorter and faster to type than `git --amend --no-edit`

`ce` if you have fugitive

Not going to beat `wq` on keyboard position without yet another thing (alias) in existence to maintain.

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

#149
post #138
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…

I agree that Vim's a mess, but I don't think a good GUI is unconditionally better because you'd need to cut down Vim's gigantic command set in order to make the GUI comprehensible. Just in this thread we've seen options for: close unless there are changes, discard changes and close, save and close, save if changed and close, and save with encryption and close. These would not be menu items. In a GUI, you would have c…

Personally, I think Sublime Text and VSCode's feature to search for a command (Cmd-Shift-P, Ctrl-Shift-P) strikes the right balance for discoverability within a large set of commands in a GUI app. I wish the feature was standard in all GUI apps. I wish macOS provided the feature for GUI apps as part of its menu bar implementation.

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

#150
post #65

Earlier quoted context omitted.

In neovim, :X (and cryptography in general) is removed https://github.com/neovim/neovim/commit/85338fe

This is different from :x though

I think their point is sometimes their left pinky is a bit lazy and won't get off the fucking shift key
Post reply on HN