This chapter is referenced in the LFS book for those wishing to use other editors on their LFS system. You're also shown 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

Additional Downloads

Vim Dependencies



GTK+-2.8.20 OR LessTif-0.94.4 OR GTK+-1.2.10, Python-2.4.4, Tcl-8.4.13, Ruby-1.8.5, and GPM-1.20.1

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/vim

Installation of Vim



If you recompile Vim to link against X, and your X libraries 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.

If desired, unpack the translated messages archive:

tar -xf ../vim-7.0-lang.tar.gz --strip-components=1

Install Vim by running the following commands:

patch -Np1 -i ../vim-7.0-fixes-14.patch &&
patch -Np1 -i ../vim-7.0-mandir-1.patch &&
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 &&

To test the results, issue: make test. The vim test suite outputs a lot of binary data to the screen, which can cause issues with the settings of the current terminal. This can be resolved by redirecting the output to a log file. Even if one of the tests fails to produce the file test.out in src/testdir, the remaining tests will still be executed. If all goes well,the final message in the log file will be ALL DONE. Note: Some color tests expect to be executed under the xterm terminal emulator.

Now, as the root user:

make install

By default, Vim's documentation is installed in /usr/share/vim. The following symlink allows the documentation to be accessed via /usr/share/doc/vim-7.0, making it consistent with the location of documentation for other packages:

ln -snfv ../vim/vim70/doc /usr/share/doc/vim-7.0

Command Explanations

patch …: These patches are the same as LFS and update the package with upstream patches and ensure the man pages are placed in the proper locations.

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

--enable-gui=no: This will prevent compilation of the GUI. Vim will still link against X so that some nice eye-candy such as updating the title bar of an Xterm window are available.

--without-x: If you prefer not to link Vim against X, use this switch.

--enable-perlinterp, --enable-pythoninterp, --enable-tclinterp, --enable-rubyinterp: These options include the Perl, Python, Tcl, or Ruby interpreters that allow using other application code in vim scripts.

Configuring Vim

Config Files

/etc/vimrc and ~/.vimrc

Configuration Information

Vim-7.0 introduced an integrated spell checker that doesn't requires additional libraries to be installed. To enable the spell checker you can set the following in one of the configuration files:

set spell

By default, Vim only installs spell files for the English language. If a spell file is not available for your language, then Vim will call $VIMRUNTIME/plugin/spellfile.vim and will try to obtain the *.spl and optionally *.sug from the vim ftp server, using the $VIMRUNTIME/plugin/netrw plugin.

Alternatively you can manually download the *.spl and *.sug files from: ftp://ftp.vim.org/pub/vim/runtime/spell/ and save them to ~/.vim/spell or in /usr/share/vim/vim70/spell/.

For more information about the spell checker and some other features in Vim-7.0 (such us vimgrep, tab-pages, and omni-completion), issue the following command inside Vim:

:help version7

For additional information on setting up Vim configuration files, see The vimrc Files and http://www.vi-improved.org/vimrc.php.


A list of the reinstalled files, along with their short descriptions can be found in the LFS Vim Installation Instrutions

Installed Programs: gview, gvim, gvimdiff, rgview, and rgvim
Installed Libraries: None
Installed Directory: /usr/share/vim

Short Descriptions


starts gvim in read-only mode.


is the editor that runs under X and includes a GUI.


edits two or three versions of a file with gvim and shows the differences.


is a restricted version of gview.


is a restricted version of gvim.

Last updated on 2007-02-11 21:03:11 -0600