Home   Partimus   Resources   Radio   IRC   Command_Line   VIM   Screen   FIT   AI   About  
 


Learning the VIM Editor


I would like to help you learn how to use a VIM Editor. You may have seen or heard about the unix text editor. I hope the following links will help fill in the gaps between what you know and what you want to learn. I recommend you take the time to climb the learning curve of this cross platform, widely installed, customizable, very capable text editor tool. I have found knowing this editor is essential as I move from machine to machine.

The main URL for this page is https://www.grantbow.com/vim.html. It was started in June 2019. Thank you to all the contributors who have helped me keep this page updated. Email is encouraged to Grant Bowman <grantbow@grantbow.com>

I found knowing these editor commands is useful in other contexts besides the editor. It can feel intimidating getting started because of the lack of context but only a few commands are really needed to start, edit and quit VIM. Here is a quick sample session.

  1. $ vim filename
    The editor starts in Normal mode, not Insert mode. Normal mode can almost always be entered by pressing <Esc> twice.
  2. Press the <arrow keys> or vim movement keys "h" (left) "j" (down) "k" (up) "l" (right) to move around. When the fingers are in the standard typing positions you can press three of these without moving your fingers. For one page at a time press <CTRL-f> for forward and <CTRL-b> for backward. The other most common mode is Insert Mode.
  3. Press / to begin a regex search. Type the text you wish to find. Press <Enter> to jump to the first match.
    • Press n for next and N for previous match in Normal mode. You can match or substitute text with regular expressions.
  4. Press x to delete the character under the cursor and remain in Normal mode.
  5. Press i to begin insert mode. Type characters you wish to add to the file. Press <Esc> to get back to Normal mode.
  6. Type :w to tell the editor you are entering a command in Command mode, specifically write the file to the disk.
  7. Type :q to quit.

In Normal mode you can also:

  • Type dd to delete the current line.
  • Type p paste the most recent deletion.
  • Type u to undo the most recent change.
  • Type <CTRL-r> to redo an undone change.
  • Press * to search for the word under the cursor.

This will allow you to edit a file. That's all that's needed at first. The creator of vim had this to say (video) (pdf) about learning more, sharpening the saw.

First Commands

Link Comments Updated
vimtutor This is a 30-minute interactive course about using vim inside of vim with examples. 20230915
Learn Vim Progressively Starts from the beginning. 20190608
vim waz ere also starts from the beginning. 20190608
:help Extensive help exists inside vim. Includes Basic manual, User manual, detailed Reference manual and plugin help. 20230916
vim-adventures.com This is an online, browser-based game that starts from the beginning and it's fun. 20190608

Next steps

Link Comments Updated
vim.org This is the main vim site. Other officially recognized community resources include wiki faq, email lists, IRC channels on libera.chat network via web.libera.chat or irc. Libera is a fork of freenode. The #vim channel has a supporting vi-improved.org web page) and IRCnet and a vim tips wiki hosted by fandom, a wikibook Learning the vi Editor and a webring registry. 20230915
Sergio's Notes Useful vim links of interest to advanced users. 20230915
vi.stackexchange.com questions 20190608
vimlog This is a great site that notifies about vim's most useful and notable new changes. I found the link at the end of vimtutor. 20230913
lpm This is a 2002 issue of Linux Productivity Magazine devoted to vi and vim that is still relevant. Steve Litt is also a founder and contributor to vimoutliner. Steve hosts an alt vimoutliner page that is was recommended by a Linux.com article. 20230915

Please email inquiries & suggestions to Grant Bowman <grantbow@grantbow.com>

Last update: 20230915