Vim tutorial for beginners

Vim stands for Vi Improved which is a clone of Bill Joy’s vi editor for Linux. It is designed for use both from a command line interface and as a standalone application in a graphical user interface. Vim is basically a open source application that is released under a license which includes some charityware clauses.Even though vim is available both in command line as well as an application with GUI, vim is widely used in command line and the full functionality is expressed through its command line mode.

Without further ado lets get started..There are 2 modes in vim say INSERT mode and NORMAL mode.Mode in which you are currently in is displayed in editor.Pressing i will take you to insert mode and press escape key to return to normal mode. As the names suggest, all commands are typed in COMMAND mode, and text is inserted in INSERT mode

Navigating through the text file.

 In contrast to the normal text editors, it uses keys h,j,k,l to move the cursor. To navigate the text in terms of words, keys w,b and e are used.B moves cursor to the beginning  of the word,E to the end and W to the start of next word. Moving between the words is not just restricted to keys w,b,e.We can combine movement keys with a number for e.g. 5w is same as pressing w five times.To reach the beginning of a line press 0 and $ key takes you to the end of the line.G takes you to the end of the file and gg to the beginning of the file.To navigate to a particular line, line number can be given along with G. e.g. 8G takes the cursor to the eighth line.

Inserting text

To insert in to a new line press o or O. ‘o’ creates a new line under the current line while ‘O’ creates a line above the current line .
Another important feature of vim is its power to insert text repeatedly. For e.g. “5 i end esc “ will insert text end five times.
This is extremely useful when underlining a header using ‘-‘ or when there is a need to produce random meaningless text in bulk.

Searching in vim

Searching for a character is quite simple in vim. F or f is the key used for this. For e.g. Fo finds the next occurrence of o from the current cursor position.Search in Vim can be combined with numbers as in the previous cases. 3fo will find the third occurrence of o from the current position. Searching for text is vital part of any text editor. When you press ‘/‘ and give the text you are looking for.Repeat the search to find the next occurrence of the same text by pressing n and previous occurrence by pressing N.

Matching Parenthesis/brackets

‘%’ key is used to find the matching parenthesis. %key  matches {,[,( to its corresponding closing.This feature of vim comes really handy while using it for software development.
[caption id="attachment_123" align="aligncenter" width="906"]Vim editor on mac terminal VIM on apple mac book[/caption]
Occurrences of a word
To find the next occurrence of a word in which the cursor is currently in press ‘*’ and the previous occurrence can be found by using #.


‘x’ deletes the character the cursor is currently pointing to and ‘X’ deletes the character left of the cursor.
‘d’ is the delete command. It can be combined with movement. For e.g. dw deletes the first word on the right side of the cursor, it also copies the content by default so that it can be pasted somewhere else using ‘p’.

Vim plugins

Plugins allow you to enhance, change, or add to Vim’s existing behaviours. They’re a powerful tool, and a key part of what has helped Vim remain relevant for 23 years, even as the computing world has changed dramatically around it. They allow Vim to support languages that didn’t exist the last time its core was updated and also allow for powerful new features that benefit all users.Plugin management in vim has no official solution, as we have with other editors like sublime.  Pathogen was first plugin manager for vim but later on Vundle became more popular and took over its position.
  • Vundle
  • NERDTree
  • Syntastic
  • EasyMotion
  • and many more plugins are available which helps in using vim as an all purpose text editor


Stands for vim runtime configuration. The plugins that we need to use are included in this file. The vimrc file contains optional runtime configuration settings to initialize it when it starts.

Repeating commands

The previously executed command can be repeated just by pressing ‘.’ for any number of times we want.
     Hope this article helped you in learning Vim from scratch.Please feel free to post your queries and suggestions in the comments section below.