The Vim package contains a powerful text editor.
Approximate build time: 0.4 SBU Required disk space: 34 MB |
Official download location for Vim (6.2):
ftp://ftp.vim.org/pub/editors/vim/unix/
For its installation Vim depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, Sed.
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.
First 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 |
This package has a test suite available which performs a number of checks to ensure it will function correctly. However, the Vim test suite will output a whole lot of seemingly garbage characters to screen which can occasionally wreak havoc with the running terminal. Accordingly, the running of the test suite here is optional. Should you choose to run the Vim test suite, the following command will do so:
make test |
And install the package:
make install |
When called as vi, vim will run in old-fashioned vi-mode. To allow this, create a symlink:
ln -s vim /usr/bin/vi |
If you are going to install the X Window system on your LFS system, you may want to re-compile Vim after having installed X. Vim comes with a nice GUI version of the editor that requires X and a few other libraries to be installed. For more information read the Vim documentation.
By default, vim runs in vi-compatible mode. Some people might like this, but we prefer to run vim in its own mode (else we wouldn't have included it in this book, but the original vi). Create a default vim configuration file by running the following:
cat > /etc/vimrc << "EOF" " Begin /etc/vimrc set nocompatible set backspace=2 syntax on " End /etc/vimrc EOF |
The set nocompatible will make vim behave in a more useful way than the default vi-compatible manner. The set backspace=2 allows backspacing over line breaks, autoindent and the start of insert. And the syntax on switches on vim's semantic colouring.
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
efm_filter.pl is a filter for creating an error file that can be read by vim.
efm_perl.pl reformats the error messages of the Perl interpreter for use with the quickfix mode of vim.
ex starts vim in ex mode.
less.sh is a script that starts vim with less.vim.
mve.awk processes vim errors.
pltags.pl creates a tags file for perl code, for use by vim.
ref checks the spelling of arguments.
rview is a restricted version of view: no shell commands can be started and view can't be suspended.
rvim is a restricted version of vim: no shell commands can be started and vim can't be suspended.
shtags.pl generates a tag file for perl scripts.
tcltags generates a tag file for TCL code.
vi starts vim in vi-compatible mode.
view starts vim in read-only mode.
vim is the editor.
vim132 starts vim with the terminal in 132-column mode.
vim2html.pl converts vim documentation to HTML.
vimdiff edits two or three versions of a file with vim and show differences.
vimm enables the DEC locator input model on a remote terminal.
vimspell.sh is a script which spells a file and generates the syntax statements necessary to highlight in vim.
vimtutor teaches you the basic keys and commands of vim.
xxd makes a hexdump of the given file. It can also do the reverse, so it can be used for binary patching.