how to quit the vim

The classic question on stackoverflow: how to quit the vim? 

1 Like

:q

1 Like

If :q doesn’t work, try

\<Esc\>\<Esc\>\<Esc\>\<Esc\>:q!

edit: github’s forums don’t support markdown? And there’s no way by default to format code :confused:

4 Likes

http://vimsheet.com/

Exiting

  • :w - write (save) the file, but don’t exit
  • :wq - write (save) and quit
  • :q - quit (fails if anything has changed)
  • :q! - quit and throw away changes

An alternative is opening another terminal and rebooting, although this is a bit drastic

2 Likes

Don’t forget about ZZ to save and exit.

ZZ is equals to :wq and to :x

1 Like

:roll_eyes:

:! pkill -f vim

1 Like

Hey, thanks for asking the question. I often forget how to quit the vim too because I only use it occasionally :grinning: Unfortunately, this isn’t on-topic for any of our boards right now. Since it was all in good fun, I’m just going to lock the post.

Thanks for participating and welcome to the Forum!

1 Like