How to Use the VIM Text Editor in Linux
Richard M. Stallman
Using a free version of vi is not a sin; it is a penance. So happy hacking.
Vim (vi iMproved) - one of the iconic text editors of UNIX systems of worldwide
request. The original version was written in 1976 by Bill Joy, the cofounder of Sun
Microsystems. Later, in 1988, the improved version, the so called vim, was released by
Bram Moolenaar. The subject this article is concerned with is interesting for both beginners
and experienced Linux users if they aspire to work intensively with the console to feel its
flexibility and power. Here we provide the examples that will illustrate some basic operations
with text as well as its extra features that make it unique and useful.
Vim can seem odd and unusual at first sight, however, its flexibility and omnitude make
it the most popular editor for Linux from year to year. It is also ported to other platforms
including Windows being able to work in a graphic mode (gVim program).
There're some facts which make knowledge of vim essential while working with Linux.
Firstly, graphic mode is not always available, say, during work with the remote server over
SSH or in case of system fatal failure. Though, as a rule, depending on operation system
configuration, vim or another text editor (nano) remain accessible. Secondly, more or less
constant work with Linux makes it clear that operations are easier and faster performed via
console, so there's a need in a powerful text editor to be used without exiting console itself.
Here comes vim and vim-based programs (for example, vimdiff - a utility for line-by-line
text comparison on the basis of vim and diff utility). If vim seems to have lacking function,
you'll for sure find it in one of the numerous vim plugins.
To start work, it is necessary to insert the command in terminal:
expert1@AE ~ $ vim
This will lead to the creation of new text document or create⁄open one already existing:
expert1@AE ~ $ vim myToDoList.txt
Vim has several modes, the most utilized of which are editing and command (it opens files
on default, see the picture above). The first one, as states its name, edits the text of the file,
while the second gives commands to the editor: save, exit, find the word, etc. To navigate,
it is possible to use the cursor pad: Home⁄End and Page Up⁄Page Down. Apart from this,
double click on g lowercase will move the cursor to the file's beginning (in other words, it is
the gg command), while double click on Shift+g (GG command) will move the cursor to the end.
Vim has proper in-line documentation. To get help, you need to enter
Where COMMAND is the command you need (For instance, gg) or the subject (for example,
encryption), and press Enter. To exit help, there's a command :q.