DEV Notes

vi

How do I exit vi? It was a very popular question on Stackoverflow like a decade ago.

So, if you are in vi type i to enter the insert mode if you want to edit something.
To leave the insert mode and return to the command mode press ESC.
In the command mode:

  • to exit type :q
  • to save changes and exit type :wq

There are many other commands and plugins and many other things to grok in vi but those are the most important ones especially in case if you don’t use vi on a regular basis and just want to make a quick fix in some config file on some remote server somewhere.