The /etc/vimrc and ~/.vimrc Files

#### Beyond Linux® From Scratch (System V Edition) - Version r13.0-1090

### Chapter 3. After LFS Configuration Issues

- Prev

  The Bash Shell Startup Files

- Next

  Customizing your Logon with /etc/issue

- Up
- Home

# The /etc/vimrc and ~/.vimrc Files

The LFS book installs Vim as its text editor. At this point it should be noted that there are a lot of different editing applications out there including Emacs, nano, Joe and many more. Anyone who has been around the Internet (especially usenet) for a short time will certainly have observed at least one flame war, usually involving Vim and Emacs users!

The LFS book creates a basic `vimrc` file. In this section you'll find an attempt to enhance this file. At startup, vim reads the global configuration file (`/etc/vimrc`) as well as a user-specific file (`~/.vimrc`). Either or both can be tailored to suit the needs of your particular system.

Here is a slightly expanded `.vimrc` that you can put in `~/.vimrc` to provide user specific effects. Of course, if you put it into `/etc/skel/.vimrc` instead, it will be made available to users you add to the system later. You can also copy the file from `/etc/skel/.vimrc` to the home directory of users already on the system, such as `root`. Be sure to set permissions, owner, and group if you do copy anything directly from `/etc/skel`.

    " Begin .vimrc

    set columns=80
    set wrapmargin=8
    set ruler

    " End .vimrc

Note that the comment tags are " instead of the more usual # or //. This is correct, the syntax for `vimrc` is slightly unusual.

Below you'll find a quick explanation of what each of the options in this example file means here:

- `set columns=80`: This simply sets the number of columns used on the screen.

- `set wrapmargin=8`: This is the number of characters from the right window border where wrapping starts.

- `set ruler`: This makes vim show the current row and column at the bottom right of the screen.

More information on the many vim options can be found by reading the help inside vim itself. Do this by typing :`help` in vim to get the general help, or by typing :`help usr_toc.txt` to view the User Manual Table of Contents.

- Prev

  The Bash Shell Startup Files

- Next

  Customizing your Logon with /etc/issue

- Up
- Home