554
you are viewing a single comment's thread
view the rest of the comments
[-] Endmaker@ani.social 34 points 4 days ago* (last edited 4 days ago)

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
[-] Malix@sopuli.xyz 30 points 4 days ago

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

[-] victorz@lemmy.world 7 points 4 days ago

! If you edited the buffer at all. ๐Ÿ‘

[-] Malix@sopuli.xyz 8 points 4 days ago

With random flailing, most likely

[-] dohpaz42@lemmy.world 16 points 4 days ago* (last edited 4 days ago)

๐Ÿ˜ณ

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

Please donโ€™t give blanket destructive advice.

[-] Gonzako@lemmy.world 3 points 4 days ago

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

[-] dohpaz42@lemmy.world 3 points 4 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/

[-] TheFogan@programming.dev 14 points 4 days ago

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

[-] dohpaz42@lemmy.world 1 points 4 days ago

Only if you donโ€™t immediately open a file.

[-] T156@lemmy.world 5 points 3 days ago

:x is also an alternative to save and quit.

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

[-] elvith@feddit.org 6 points 4 days ago

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

:q!
[-] Badabinski@kbin.earth 5 points 4 days ago

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.

[-] msage@programming.dev 2 points 4 days ago

This is the most correct answer.

Rebind Caps to Esc.

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

[-] BarbecueCowboy@lemmy.dbzer0.com 1 points 3 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.

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

Programmer Humor

24143 readers
2160 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