This chapter is referenced in the LFS book for those wishing to use other editors on their LFS system. We also have the opportunity to show how some LFS installed programs benefit from being recompiled after GUI libraries have been installed.


Introduction to Vim

The Vim package, which is an abbreviation for VI IMproved, contains a vi clone with extra features as compared to the original vi.

The default LFS instructions install vim as a part of the base system. If you would prefer to link vim against X, you should recompile vim to enable GUI mode. There is no need for special instructions since X support is automatically detected.

Package information

Vim dependencies


X (XFree86-4.4.0 or X.org-6.7.0)

Installation of Vim



If you recompile vim to link against X, and your X libs are not on the root partition, you will no longer have an editor for use in emergencies. You may choose to install an additional editor, not link vim against X, or move the current vim executable to the /bin directory under a different name such as vi.

Install Vim by running the following commands:

echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h &&
echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h &&
./configure --prefix=/usr \
   --with-features=huge &&
make &&
make install

Command explanations

--with-features=huge: This switch enables all the additional features available in Vim.

--enable-gui=no: If you prefer not to link vim against X, use this switch.


The Vim package contains eview, evim, ex, gview, gvim, gvimdiff, rgview, rgvim, rview, rvim, view, vim, vimdiff, vimtutor and xxd. Except for vimtutor and xxd, all the other commands are symlinks to vim and start vim with different options. vimtutor is a tool to learn the various vim commands and xxd is a command used to create hex dumps.