Hacker News new | past | comments | ask | show | jobs | submit login

I've long quit using vim on a daily basis, but the "how to exit Vim?" jokes are still somehow funny. A recent encounter was an old tweet by @iamdeveloper: "I've been using Vim for about 2 years now, mostly because I can't figure out how to exit it."

:wq (sorry, I had to).






Quitting vim isn't about exiting the program, which can easily be done with :!kill -9 $PPID

Quitting vim became easy once I got to know helix. I've been clean for several weeks.

You should check out kakoune! It's very similar to helix, motion first, multi selection, and stupid easy to script.

Easy-peasy!

i quit vim like

ctrl-z


`ZZ` to save and quit, `ZQ` to quit without saving. Sorry, I can't help myself.

I've always used :x or :x! and no longer remember why. Probably it's a bad idea like without actually looking right now I think it might mean to ignore permissions (if you're root enough) and just write even if perms would have blocked it. Hm, maybe x means wq and just the ! means force.

It's actually a bit more nuanced: `:x` is like `:wq`, but only writes if changes have been made. `:x!` has the same semantics as `:wq!`.

The fact that everyone says the meme is dead, but in this small thread there are 5 different people posting how to exit, and none of them are the same says there is still pretty good substance behind that meme.

I think we're all kind of implicitly acknowledging the truth of the meme. I mean that was definitely a conscious part of my own comment.

I feel like the default behavior should be to not write unless changes have been made. I may be misunderstanding here, but what would be getting written if nothing's been changed?

It would overwrite changes made by external programs.

Metadata about the file like modification time.

I think sysadmins should install nano on servers for people to make quick edits. All the commands are along the bottom, so there is no learning curve.

or they should just make sure emacs can work with the machine thru ssh, then there is nothing to install ;)

if no ssh, then nano is not a bad option, though i would go with joe (https://joe-editor.sourceforge.io/) which can also show the shortcuts, but much much more powerful, yet it's just a single ~700kbyte exe (or 1.5MB with some optional syntax highlighting grammars and docs)


>or they should just make sure emacs can work with the machine thru ssh, then there is nothing to install ;)

While (neo)vim doesn't have TRAMP and dired, it has netrw, which does the same stuff (on a basic level). You can do the following to edit a remote file:

vim scp://user@hostname/path-to-file-here

You can also replace user@hostname with an ssh alias you've configured, which makes it easier to work with multihop ssh and different keys and users. One useful usage of the remote editing is to combine it with opening multiple files to compare two files on different machines:

vim -O ~/.config/mpv/mpv.conf scp://htpc/.config/mpv/mpv.conf

To browse a directory instead of a specific file, just put the dir instead of a non-dir file and it will open a filebrowser view where you can then pick a file to open. In the above examples, leave off mpv.conf and you'll then be able to pick either your mpv.conf or input.conf or files related to your mpv scripts.


TRAMP can run commands in that remote context too, so any kind of compiler, interactive REPL integration works without any special support usually.

For example the built-in version control works the same as in a local context.

That's why it's called transparent:

> TRAMP stands for “Transparent Remote (file) Access, Multiple Protocol” — https://www.gnu.org/software/tramp/

it makes a big difference, imho... not as good as plan 9, of course :)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: