this post was submitted on 22 Sep 2025
903 points (98.7% liked)

Programmer Humor

27488 readers
1355 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
[–] thagoat@lemmy.sdf.org 14 points 2 months ago (6 children)

5 key presses to save and exit. Frickin vim.

[–] TragicNotCute@lemmy.world 38 points 2 months ago (1 children)

I’m pretty sure that’s close without saving changes. :wq would be needed to save.

[–] Aatube@kbin.melroy.org 18 points 2 months ago (2 children)

To be precise, : means bring up commands, w means save, q means exit, and ! means force

[–] HeurtisticAlgorithm9@feddit.uk 13 points 2 months ago (1 children)

I think it's w = write and q = quit so the letters make more sense

[–] glitches_brew@lemmy.world 10 points 2 months ago (1 children)
[–] darklamer@lemmy.dbzer0.com 13 points 2 months ago (2 children)

No, it isn't, x writes only when changes have been made, while w writes unconditionally.

[–] josefo@leminal.space 0 points 2 months ago (1 children)

Why would you want to write again if no changes were made? It's some obtuse behavior

[–] darklamer@lemmy.dbzer0.com 5 points 2 months ago

One obvious use-case is to cause the file to get a new timestamp, which for example tools like make look at.

[–] ryper@lemmy.ca 5 points 2 months ago* (last edited 2 months ago)

To be more precise, q means quit the current window. If you've split the window, e.g. with :split or :vsplit, use :qa to quit all windows.

[–] villainy@lemmy.world 10 points 2 months ago (1 children)

Or 3. Hold shift, press ZZ to save and quit ZQ to quit without saving.

5. Writing and quitting

  					ZZ

ZZ Write current file, if modified, and close the current window (same as ":x"). If there are several windows for the current file, only the current window is closed.

  					ZQ

ZQ Quit without checking for changes (same as ":q!").

[–] ryper@lemmy.ca 2 points 2 months ago

Since people don't seem to realize that vim has a help system: You can get to this information with :help quit or :help exit

[–] lime@feddit.nu 8 points 2 months ago* (last edited 2 months ago) (1 children)

four. the ! is unnecessary. how many actions are there to save and quit in other editors? ctrl, s, ctrl, w is four. move to file, click, move to save, click, move to ×, click is six.

and that's before we replace the wq with x.

[–] psud@aussie.zone 3 points 2 months ago (1 children)

If we count the modifier keys:

Vim: esc, shift+:, w, q, Enter

Emacs: ctrl-s, crtl+x ctrl+c, or use the menu options

I use both, but find Emacs much quicker, though vim is easier to learn, though Emacs is easier while you're learning

[–] lime@feddit.nu 2 points 2 months ago (1 children)

i've never had the time to get into emacs, would love to though.

also, some layouts have the : on its own key, and if you include the esc in vim commands you're not using vim correctly :)

[–] psud@aussie.zone 2 points 2 months ago (1 children)

ESC

Surely you're editing right before exiting, why else would you be saving?

[–] lime@feddit.nu 1 points 2 months ago (1 children)

not necessarily. you could also have done a yank-paste, or a repeated action, or had a command output into the buffer.

it's a good habit to always leave the editor in normal mode between actions, because that makes for a cleaner edit history with smaller changesets in the undo tree.

...vim is sort of like driving stick in that way.

[–] psud@aussie.zone 1 points 2 months ago (1 children)

Yeah, having used both, my preference is for Emacs, which also comes with the bonus of menu driven ways of doing most things when you've been away long enough to have forgotten a keyboard shortcut. I have always needed a cheat sheet handy when away from vim for a few months

[–] lime@feddit.nu 1 points 2 months ago (1 children)

i've moved to helix, partly to stop myself tinkering and partly because the reversed command model is just easier. plus it has popup helpers.

[–] psud@aussie.zone 1 points 2 months ago

There's no arguing with taste and preference :)

[–] NeatNit@discuss.tchncs.de 7 points 2 months ago

Depends how you count. Both : and ! require shift as well.

[–] MadMadBunny@lemmy.ca 2 points 2 months ago

Fuck it I’m pulling the power cord

[–] Wiz@midwest.social 1 points 2 months ago

You can use ZZ as a shortcut!