%general-entities; ]> Vim-&vim-version; Vim <para>The Vim package contains a powerful text editor.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem><seg>0.4 SBU</seg><seg>34 MB</seg></seglistitem> </segmentedlist> <segmentedlist> <segtitle>Vim installation depends on</segtitle> <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, Sed</seg></seglistitem> </segmentedlist> <tip> <title>Alternatives to Vim If you prefer another editor -- like Emacs, Joe, or Nano -- to Vim, have a look at for suggested installation instructions. Installation of Vim First change the default locations of the vimrc and gvimrc configuration 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 --enable-multibyte The optional --enable-multibyte switch includes multibyte editing support into vim. It is only needed for those people who ignore our recommendation not to use LFS in locales with multibyte character sets, but it does not hurt others. Compile the package: make To test the results, you can issue: make test. However, this test suite outputs a lot of seemingly garbage characters to the screen, and this can wreak havoc with the settings of the current terminal. Therefore the running of the test suite here is strictly optional. Now install the package: make install Many users are used to using vi, instead of vim. To let them execute vim when they habitually enter vi, 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. Configuring Vim /etc/vim By default, vim runs in vi-incompatible mode. Some people might not 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). We've included the setting of "nocompatible" below to high-light the fact that the new behavior is being used. It also reminds those who would change to "compatible" mode that it should appear first because it changes other settings and overrides must come after this setting. Create a default vim configuration file by running the following: cat > /etc/vimrc << "EOF" " Begin /etc/vimrc set nocompatible set backspace=2 syntax on set background=dark " End /etc/vimrc EOF The set nocompatible makes vim behave in a more useful way (the default) than the vi-compatible manner. Remove the "no" if you want the old vi behavior. The set backspace=2 allows backspacing over line breaks, autoindents and the start of insert. The syntax on enables vim's syntax highliting, while set background=dark gives the highliting a better color scheme for use on the black background of a linux console. If you later use X and terminals with a light background, changing this will be useful. Documentation for other available options can be obtained by running the following command: vim -c ':options' Contents of Vim 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 Short descriptions efm_filter.pl efm_filter.pl is a filter for creating an error file that can be read by vim. efm_perl.pl efm_perl.pl reformats the error messages of the Perl interpreter for use with the quickfix mode of vim. ex ex starts vim in ex mode. less.sh less.sh is a script that starts vim with less.vim. mve.awk mve.awk processes vim errors. pltags.pl pltags.pl creates a tags file for perl code, for use by vim. ref ref checks the spelling of arguments. rview rview is a restricted version of view: no shell commands can be started and view can't be suspended. rvim rvim is a restricted version of vim: no shell commands can be started and vim can't be suspended. shtags.pl shtags.pl generates a tag file for perl scripts. tcltags tcltags generates a tag file for TCL code. view view starts vim in read-only mode. vim vim is the editor. vim132 vim132 starts vim with the terminal in 132-column mode. vim2html.pl vim2html.pl converts vim documentation to HTML. vimdiff vimdiff edits two or three versions of a file with vim and show differences. vimm vimm enables the DEC locator input model on a remote terminal. vimspell.sh vimspell.sh is a script which spells a file and generates the syntax statements necessary to highlight in vim. This script requires the old Unix spell command, which is provided neither in LFS nor in BLFS. vimtutor vimtutor teaches you the basic keys and commands of vim. xxd xxd makes a hex dump of the given file. It can also do the reverse, so it can be used for binary patching.