Vim quick start

Vim is a open source text editor.  I fell in love with it a few years ago.  It runs on Linux, Windows, Macs, and others.  The interface is pretty much the same across the board. It really is full-featured.  It highlights almost any file syntax from PHP to python to httpd.conf.

One major barriers to its popularity is its learning curve.  Vim was designed to be used entirely by a keyboard.  To start, download it and install it.  If you’re running linux, it should be preinstalled.  Once it is installed, run it by running vi. When you run it, you can only scroll.

Press the i key or the insert key to go to insert mode and you can type all day long. Press the escape key to exit insert mode.

You can do a quick search by pressing forward slash and typing your search. To repeat the last search press the foward slash then enter.

All the other basic commands start with a colon.  Here are a few to get you started:

  • :w — write the file
  • :sav filename — save the file to filename
  • :q — quit
  • :n — go to the next file
  • :N — go the the previous file
  • :wq — write the file and quit
  • :q! — quit now!
  • :wn — write the file andd go to the next file

There is a key difference between “:q” and “:q!”.  The first will not quit if the file has been changed or there are more files to edit.  The second will quit immediately.

There are  a ton more features than what is listed here.  When you are ready to continue learning vim, type :help for a help screen.  Type :q to exit the help.

Happy editing.

One thought on “Vim quick start

  1. Nice quick start! Some commands that I use a lot:

    (in escape mode)
    x – deletes current character
    r – replace current character (type r, then the new character)
    dd – delete current line
    Shift + a – go to end of line and into insert mode
    Shift + g – go to end of file, leaves you is esc mode
    Shift + zz – write file and quit

Comments are closed.