8. Vim Saving and Exiting

Now that you've done your editing it's time to actually save and quit out of vim:

  • :w - writes or saves the file

  • :q - quit out of vim

  • :wq - write and then quit

  • :q! - quit out of vim without saving the file

  • ZZ - equivalent of :wq, but one character faster
  • u - undo your last action

  • Ctrl-r - redo your last action

You may not think ZZ is necessary, but you'll eventually see that your fingers may tend to lean towards this rather than :wq.

Whew that was a lot of information to take about Vim. Now that you know some basic commands and navigation, you can start editing some text files. There are many more options you can use in vim to increase your ability to master this text editor, head on to Vim's online guide to take a look.


No exercises for this lesson.


How do you quit out of vim without saving?