The vim (vi) editor

vim is an an improved vi (standard UNIX) editor with color enhancement.

This section describes:


Tips for configuring the vim editor

Converting files between DOS and UNIX format

To convert a DOS/windows file to Linux/UNIX format:
:set ff=unix
:w
        (write the file out in the new format)
The ff stands for file format.

To convert a file to DOS (windows) format:

:set ff=dos :w (write the file out in the new format)

Converting tabs to spaces

It is usually desirable to have an editor expand the tab character into spaces, when entering new text.
The following sets the tab stops to every 4 characters and expands tabs to spaces:
:set shiftwidth=4
:set expandtab

Using lighter colors

On some LCD's, it is difficult to see text using the default colors vim chooses.
If you want vim to use lighter colors:
:set background=dark

The vim configuration file

The vim configuration file that is read every time vim is started is: .vimrc in your home directory.
Here is a sample .vimrc:
set shiftwidth=4
set expandtab
set tabstop=4
set background=dark

Where to Get More Information

Linux Quick Reference Home
Linux Migration Home