Wednesday, January 8, 2014

Vim – Vi IMproved, a programmers text editor

It is observed that many people are uncomfortable with the “vi” editor. Vim is a editor which runs on terminal but adapts many features of “vi” editor. So it is very much easy for the people who want to switch from “vi” editor to “vim” editor. “vi ” is a default editor that is installed for the terminal. We can even install the graphical version of the “vim” editor. 
To install “vim” just type the command as shown below:
            $sudo apt-get install vim

To open a file in vim editor use the command, if the file doesnot exists then it is created in the folder that your terminal is switched to.
           $vim first.c

After this command the terminal will change into an editor screen as the “vi” appears in its default manner as shown in figure below:

Figure 1: View of Vim Editor
Now if you want to insert any text into the editor the just press the “INSERT” button on your keyboard and you may see “--INSERT--” written on bottom of the screen, which means you can now insert the text into the file.

Once you insert the required the content you can save the file by the traditional way that a “vi” editor does that is press <ESC> and then :w to write the changes.
If you want to save and quit the file the press <ESC> and then :wq to save and quit.

Now a days it is very much easy for new users as to use the “Vim” editor as its GUI version is also available.
If you are unfamiliar with the commands of the “vim” the use the “vimtutor” command which gives the overall information about how to use the “vim” editor.