I always :q when I didn’t change anything. If I changed something intentionally, :wq and :x are equivalent. If I changed something accidentally, :x won’t catch that, and :q complaining will require me to decide if :q! or :wq is correct. So :x does not fit my workflow of avoiding accidental writes. Just like ZZ does not.
Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
151–160 of 279 posts
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#152Earlier 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.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#153I became quite an advanced vim user in 1999, during my military service in Italy (I was stationed at the Ministry of Aerial Defense, and working on IT stuff). It's quite incredible and a bit weird that today, in 2023, I can say "Yes, I knew this", despite non having used vim much since ~2012. I would have never guessed I'd be able to recall things like this.
I don't know Vim, my fingers do. More seriously sometimes I'll get a question about how I did/do something, and have to sit at the keyboard and actually perform the action to be able to provide the answer.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#154I always :q when I didn’t change anything. If I changed something intentionally, :wq and :x are equivalent. If I changed something accidentally, :x won’t catch that, and :q complaining will require me to decide if :q! or :wq is correct. So :x does not fit my workflow of avoiding accidental writes. Just like ZZ does not.
Honestly it sounds complex, but I don't even think about it and it only struck me reading your comment.
The warning note on q is desirable.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#155Is there a way to have vim just go to the open window? Or is there a better way to manage my windows?
(I'm using MacVim if it makes a difference.)
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#156Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#157I 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, this is absolutely horrible. Filing this as yet another item under “Why vim is the worst example of 1970s bullshit UX still recommended by cargo cultists everywhere.”
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#158Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#159Is there a good way to manage saved-but-not-exited vim windows so I don't open the same file twice? I keep running into a problem where I'm editing a dozen files, and then I try to re-open a file I already have opened. Vim gives me a warning about this but my choices are a) tab through all my open windows until I find the right one, or b) open a new editing window and hope that I didn't have unsaved changes in the fi…
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#160This is the first time my life has changed from just reading a Hacker News headline.