A step by step guide to Vim text editor with video

We use editor to create and edit files. Vim is one of the most preferable text editors for Linux/Unix system. Vi/ Vim editor is a powerful tool which is customizable, extensible and well documented. We can design the configuration file of Vim as the way we want.

Installation of Vim

$ sudo yum install vim

$ sudo apt-get install vim

$ sudo zypper install vim

Open Vim editor

$ vi

Open/ edit/ create file with Vim editor

$ vim helloworld.txt

Configuration file of vim (This is optional)

Open terminal. Make sure you are in home directory.

$ touch ~/.vimrc      //This creates an empty file

$vim ~/.vimrc         //This is hidden file

Now copy content of vimrc by kushaldas to the ~/.vimrc and save it.

Functions of Vim editor

When you open a file with vim editor

Press i for INSERT mode and edit/ create the content of the file

Press ESC before you use the following options followed by ENTER:

  • :w to save the file.
  • :q to quit the file.
  • :wq or x to save and quit.
  • :q! for force quit.
  • :e! if you don’t want to save and go back to last saved revision.
  • r to replace with new character.
  • A to append.
  • x to cut a character.
  • xw to cut a word.
  • xx to cut a whole line.
  • y to copy.
  • yy to copy a whole line.
  • p to paste.
  • :set nu to set line number.
  • :set nu! to turn off line number.

To read more about vim editor

Open terminal and type

$ vimtutor  


$ man vim

Reference Dgplug summer training vim doc

Click on the image below that will redirect you to the video of vim tutorial.