6.22. Installing Vim-6.2

Estimated build time:           0.4 SBU
Estimated required disk space:  34 MB

6.22.1. Alternatives to Vim

If you prefer another editor -- like Emacs, Joe, or Nano -- to Vim, have a look at http://www.linuxfromscratch.org/blfs/view/stable/postlfs/editors.html for suggested installation instructions.

6.22.2. Contents of Vim

The Vim package contains a configurable text editor built to enable efficient text editing.

Installed programs: efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk, pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim), view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh, vimtutor and xxd

6.22.3.

6.22.4. Vim Installation Dependencies

Vim depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, Sed.

6.22.5.

6.22.6. Installation of Vim

Change the default locations of the vimrc and gvimrc files to /etc.

echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h

Now prepare Vim for compilation:

./configure --prefix=/usr

Compile the package:

make

And install the package:

make install

Vim can run in old-fashioned vi mode by creating a symlink, which may be created with the following command:

ln -s vim /usr/bin/vi

If you plan to install the X Window system on your LFS system, you might want to re-compile Vim after you have installed X. Vim comes with a nice GUI version of the editor which requires X and a few other libraries to be installed. For more information read the Vim documentation.

6.22.7.

6.22.8. Configuring Vim

By default, vim runs in vi compatible mode. Some people might like this, but we have a high preference to run vim in vim mode (else we wouldn't have included vim in this book, but the original vi). Create the /root/.vimrc by running the following:

cat > /root/.vimrc << "EOF"
" Begin /root/.vimrc

set nocompatible
set bs=2

" End /root/.vimrc
EOF