Terminal Takeaway πŸ₯‘

Exitting VIM

A 2017 study including over 1,000,000 developers found jQuery devs were the most likely to get stuck in VIM:

Know your way out!

  • Pressing Escape won’t allow you to β€œescape” VIM but it will get you back to Normal mode.
  • From Normal mode you can enter Command mode by pressing :
  • Now you can enter a command to exit VIM, then press enter (to exit).

Examples:

  • :q #Quit
  • :q! #Rage quit (quit and discard changes)
  • :wq #Save and quit
  • :x #Also Save and quit
  • :qa #Quit all open files
  • :qa! #Rage quit all open files

Exit directly from Normal mode:

  • Esc + Shift ZZ #Save and quit
  • Esc + Shift ZQ #Rage quit

Remote recovery: (if all else fails)

  • SSH into the machine and run: pkill vim
2 Likes