this post was submitted on 09 Jun 2025
549 points (97.4% liked)

Programmer Humor

24173 readers
584 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 33 points 6 days ago* (last edited 6 days ago) (7 children)

Personally, I have seen so many memes about exiting vim that by the time I got to use it for the first time, exiting it was a no-brainer.

For any newbies out there, the command is

:wq
[–] [email protected] 31 points 6 days ago (1 children)

Just to add: possible need to tap esc first, as your random flailing probably put you in insert mode, or something more exotic.

And only add w if you want to save the file. :q! If you don't

[–] [email protected] 7 points 6 days ago (1 children)

! If you edited the buffer at all. 👍

[–] [email protected] 8 points 6 days ago

With random flailing, most likely

[–] [email protected] 15 points 5 days ago* (last edited 5 days ago) (1 children)

😳

:w = write; or overwrite if the file already exists.

Please don’t give blanket destructive advice.

[–] [email protected] 3 points 5 days ago (1 children)

This one's fine. They'll then learn the next vim button, u for undo. I believe it's saved between boots of vim? It may be my kickstarted neovim config tho

[–] [email protected] 3 points 5 days ago

I would say not in all installations, no. And honestly, it’s not worth trusting.

And for those who are unfamiliar, and want to set it up: https://blog.openreplay.com/persistent-undo-vim-save-restore-history/

[–] [email protected] 14 points 6 days ago (1 children)

also worth noting you open vim the first time, you get a huge ass splash screen telling you how to exit

[–] [email protected] 1 points 5 days ago

Only if you don’t immediately open a file.

[–] [email protected] 5 points 5 days ago

:x is also an alternative to save and quit.

Equally valid for the facial expression you'd make upon finding that out.

[–] [email protected] 6 points 6 days ago

And if you panicked before and fucked up the opened file while hammering on the keyboard:

:q!
[–] [email protected] 5 points 6 days ago (1 children)

There's also ZZ 👉😎👉 Same caveats apply, smash that fukken esc key (for bonus points rebind caps lock as esc) then ZZ Top your way out of that shit.

[–] [email protected] 2 points 5 days ago

This is the most correct answer.

Rebind Caps to Esc.

ZZ (or ZQ if you don't want to save the file).

[–] [email protected] 1 points 5 days ago

I'm going to stick with my current process of accidentally opening vim, typing semi-random things that feel like they should work for a minute and then eventually looking up how to quit on my phone.