VIM Tutorial

Vim is an editor to create or edit a text file. It has two basic modes, insert mode and normal mode. Insert mode when we want to add some text and normal mode for effective navigation.

i – Press i for insert mode.
esc – Press esc for normal mode of editor.

In contrast to regular text editor, we use h, j, k, l instead of normal arrow keys for cursor movements.

h Moves the cursor one character to the left

l Moves the cursor one character to the right

k Moves the cursor up one line

j Moves the cursor down one line

To navigate the text in terms of words, we use w, e and b.

w Moves to the start of the next word

e Moves to the end of the word

b Moves to the beginning of the word

Moving within text is not limited to individual keys; you can combine movement keys with a number. For example 3w is same as pressing w three times.

In Vim editor, you can insert text multiple times. If you want to insert dashes 30 times to make a line of dashes(-),, you don’t need to enter ‘-‘ for 30 times. You can simple type 30i- then press esc.

In the text that is structured with parentheses or brackets, ( or { or [, use % to jump to the matching parentheses or bracket.

0 To reach the beginning of the line
$ To reach the end of the line
* To find the next occurrence of the word
# To find the previous occurrence of the word
gg Takes you to the beginning of the file
G Takes you to the end of the file

To jump directly to a specific line, give its line number along with ‘G’.

In Vim, for searching you press / and then a word you want to search for. For next and previous word, press n and N respectively.

o To insert text into a new line
O To insert line above the current line of text.

x To delete the character under the cursor
X To delete the character left side of the cursor

When you need to replace only a one character under the cursor without going to the insert mode, simply press ‘r’ and then type the character you want to insert.

d is the delete command. You can combine it with movements e.g dw will delete the first word on the right side of the cursor. It also copies the content, which you can simply paste with p. To repeat the previous command press . and the same.

There is also a visual mode in vim editor. Press 'v' to enter into the visual mode. Select a word with e. Use movement keys to select more and finally press d to delete that word.

Now, you should be quite confident to enter into the real Vim. Most important commands to remember are-

:w To save a file
:q To quit
:q! Quit without saving
u For Undo
Ctrl+R For redo
:help For help

This was all about. To know more visit:


Published by


I am the one who discover myself daily through reading, writing, interacting with people and expressing my thoughts to inspire them if I would be able to bring a little change to the society through my work. I write blogs, participate in various social activities and want to be a Professional Speaker. Currently, I am pursuing my post graduation in Computer Applications from Guru Nanak Dev Engineering College, Ludhiana and I’m very much active in many technical & social communities.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s