The absolute bare minimum you need to know about using Vim on the command line

I've somehow managed to survive a long time in this industry without learning Vim, but sometimes I'm in a position where I can't open a text file on a live server with a normal text editor. For example, today I needed to edit a php.ini file to add an extension in, and I can only get to it via the command line. Here is the list of commands I needed to get the job done:

  1. To open a file in Vim, navigate to where the file is and type (for example) vim nameofmyfile.txt
  2. To edit text, you have to press i (which puts you in 'insert' mode). To stop editing text, click ESC.
  3. To save the file without exiting Vim, type : (that's SHIFT + semicolon), a and ENTER
  4. To exit the file and save, type : (that's SHIFT + semicolon), x and ENTER.
  5. To search for word, type /yourwordhere (but not when you're in 'insert' mode). Type n to go to the next match.

The command line kind of bums me out sometimes when I really don't know how to get started on something. If you feel the same way at all, hopefully this will help you out.