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  

or

$ man vim

Reference Dgplug summer training vim doc

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

Vim

Advertisements

2 thoughts on “A step by step guide to Vim text editor with video

  1. Hi good blog post, I have came to know about the https://asciinema.org/ through this one

    few corrections
    Capital A is for append not small a
    x is to cut a character not a line

    also little introduction about the ~/.vimrc file would have made this post better 🙂

    Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s