Installing Vim-6.0

Estimated build time:           2 minutes
Estimated required disk space:  15 MB

Installation of Vim

If you don't like vim to be installed as an editor on the LFS system, you may want to download an alternative and install an editor you prefer. There are a few hints how to install different editors available at http://hints.linuxfromscratch.org/hints/. The hints which are currently available are for Emacs, Joe and nano.

Install Vim by running the following commands:

cp runtime/syntax/sh.vim runtime/syntax/sh.vim.backup &&
sed '/shUntil\|link shRepeat/{
���/shUntil/N
���/^/i\
���if exists("b:is_kornshell") || exists("b:is_bash")
���p
���/$/i\
���endif
���d
���}' runtime/syntax/sh.vim.backup > runtime/syntax/sh.vim &&
./configure --prefix=/usr &&
make CPPFLAGS=-DSYS_VIMRC_FILE=\\\"/etc/vimrc\\\" &&
make install &&
cd /usr/bin &&
ln -sf vim vi

If you plan on installing 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.

FHS compliance notes

The FHS says that editors like vim should use /var/lib/<editor> for their temporary state files, like temporary save files for example. If you wish vim to conform to the FHS, you should use this command set instead of the one presented above:

cp runtime/syntax/sh.vim runtime/syntax/sh.vim.backup &&
sed '/shUntil\|link shRepeat/{
���/shUntil/N
���/^/i\
���if exists("b:is_kornshell") || exists("b:is_bash")
���p
���/$/i\
���endif
���d
���}' runtime/syntax/sh.vim.backup > runtime/syntax/sh.vim &&
./configure --prefix=/usr --localstatedir=/var/lib/vim &&
make CPPFLAGS=-DSYS_VIMRC_FILE=\\\"/etc/vimrc\\\" &&
make install &&
cd /usr/bin &&
ln -sf vim vi

Command explanations

sed '/shUntil\|link shRepeat/{...: This sed command fixes a bug in the syntax/sh.vim file that will cause an error message when you edit a shell script using syntax highlighting.

make CPPFLAGS=-DSYS_VIMRC_FILE=\\\"/etc/vimrc\\\": Setting this will cause vim to look for the /etc/vimrc file that contains the global vim settings. Normally this file is looked for in /usr/share/vim, but /etc is a more logical place for this kind of file.

Contents

Program Files

ex (link to vim), rview (link to vim), rvim (link to vim), vi (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor (link to vim) and xxd

Descriptions

ex

ex starts vim in Ex mode.

rview

rview is a restricted version of view. No shell commands can be started and Vim can't be suspended.

rvim

rvim is the restricted version of vim. No shell commands can be started and Vim can't be suspended.

vi

vi starst vim in vi-compatible mode.

view

view starts vim in read-only mode.

vim

vim starts vim in the normal, default way.

vimdiff

vimdiff edits two or three versions of a file with Vim and show differences.

vimtutor

vimtutor starts the Vim tutor.

xxd

xxd makes a hexdump or does the reverse.

Dependencies

Vim-5.8 needs the following to be installed:


bash: sh
binutils: ld, as
diffutils: cmp, diff
fileutils: chmod, cp, ln, mkdir, mv, rm, touch
find: find
gcc: cc
grep: grep
make: make
net-tools: hostname
sed: sed
sh-utils: echo, expr, uname, whoami
textutils: cat, tr, wc