Vim is an advanced text editor for Linux and Unix operating systems.

Recently rated the #1 worldwide Linux editor, Vim is open-source and free.

This article will show you how to create a great .vimrc profile.

Terminal window showing the manual page for the Mutt email client on Linux

What IsVim?

First, if you are new to Vim: welcome!

You have just started the great journey of learning one of the world’s best and most convenient editors.

Article image

Bram Moolenaar created Vim, the much-loved Linux terminal-based editor, in 1991.

Vim stands forvi improved, and

was the classic old-school text editor for Unix, developed in 1976.

Vim is generally also preinstalled as the default editor in many Linux distributions.

Users are likely used to being in edit mode in most other popular text editors (OpenOffice writer etc.

), but not in command mode.

And command mode is the default mode that Vim will start in.

When you’re done, you pressESC(the escape key) to return to command mode.

When done with editing (which allows full editing capabilities like pressing

,

etc.)

it’s possible for you to again press theESCkey to return to command mode.

This will write (

) the file and quit (

).

If you have never used Vim before, then well done!

Another oddity is strange behavior from mouse clicks, or when using tabs.

The .vimrc file/profile contains all options that Vim will read and use each time it starts.

The

file will and should be stored in your home directory.

Let’s create the file using

itself.

Note that it’s possible for you to generally use

to start

.

, symbol) by executing:

At the command line.

This should bring up theVimeditor.

Now press theikey to enter edit/insert mode.

Now pressESCto leave edit mode, and next punch in the key sequence seen earlier::wq!.

This will write out the file~/.vimrcand exit theVimeditor.

The next time you enterVim, all these options will automatically be loaded by Vim from your~/.vimrcfile.

Besides setting a nice color scheme using the commandcolo torte, we also turn on syntax highlighting withsyntax on.

If this is applicable to your system, you will receive a message to the same effect.

Simply press enter and edit~/.vimrcto remove this line.

Theset expandtaboption specifically ensures that whenever we presstabit will be automatically translated to spaces instead.

However, the most important option is the one on the first line.

Wrapping up

This article placed Vim and Vi in historical context and described their popularity.