%general-entities; ]> Vim-&vim-version; Vim <para>The Vim package contains a powerful text editor.</para> </sect2> &env-target; <sect2 role="installation"> <title>Installation of Vim Alternatives to Vim If you prefer another editor—such as Emacs, Joe, or Nano—please refer to for suggested installation instructions. First, unpack both vim-&vim-version;.tar.bz2 and (optionally) vim-&vim-version;-lang.tar.gz archives into the same directory. The following patch merges all updates from the &vim-version; Branch from the Vim developers: patch -Np1 -i ../&vim-branch_update-patch; The configure script is full of logic that aborts at the first sign of cross compiling. Set the cached values of those tests with the following command: cat > src/auto/config.cache << EOF vim_cv_getcwd_broken=no vim_cv_memmove_handles_overlap=yes vim_cv_stat_ignores_slash=no vim_cv_terminfo=yes vim_cv_tgent=zero vim_cv_toupper_broken=no vim_cv_tty_group=world ac_cv_sizeof_int=4 EOF Change the default location of the vimrc configuration file to /etc: cat >> src/feature.h << "EOF" #define SYS_VIMRC_FILE "/etc/vimrc" EOF Prepare Vim for compilation: ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --prefix=/usr --enable-multibyte --enable-gui=no \ --disable-gtktest --disable-xim --with-features=normal \ --disable-gpm --without-x --disable-netbeans \ --with-tlib=ncurses The meaning of the configure options: --enable-multibyte This optional but highly recommended switch enables support for editing files in multibyte character encodings. This is needed if using a locale with a multibyte character set. This switch is also helpful to be able to edit text files initially created in Linux distributions like Fedora Core that use UTF-8 as a default character set. Compile the package: make Install the package: make DESTDIR=${CLFS} install Many users are accustomed to using vi instead of vim. Some programs, such as vigr and vipw, also use vi. Create a symlink to permit execution of vim when users habitually enter vi and allow programs that use vi to work: ln -sfv vim ${CLFS}/usr/bin/vi 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-&vim-version;, making it consistent with the location of documentation for other packages: ln -sfnv ../vim/vim&vim-version2;/doc ${CLFS}/usr/share/doc/vim-&vim-version; If an X Window System is going to be installed on the CLFS system, you may want to recompile Vim after installing X. Vim comes with a GUI version of the editor that requires X and some additional libraries to be installed. For more information, refer to the Vim documentation and the Vim installation page in CBLFS at . Configuring Vim /etc/vimrc By default, vim runs in vi-incompatible mode. This may be new to users who have used other editors in the past. The nocompatible setting is included below to highlight the fact that a new behavior is being used. It also reminds those who would change to compatible mode that it should be the first setting in the configuration file. This is necessary because it changes other settings, and overrides must come after this setting. Create a default vim configuration file by running the following: cat > ${CLFS}/etc/vimrc << "EOF" " Begin /etc/vimrc set nocompatible set backspace=2 syntax on if (&term == "iterm") || (&term == "putty") set background=dark endif " 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 to keep 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 highlighting. Finally, the if statement with the set background=dark corrects vim's guess about the background color of some terminal emulators. This gives the highlighting a better color scheme for use on the black background of these programs. 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 A filter for creating an error file that can be read by vim efm_filter.pl efm_perl.pl Reformats the error messages of the Perl interpreter for use with the quickfix mode of vim efm_perl.pl ex Starts vim in ex mode ex less.sh A script that starts vim with less.vim less.sh mve.awk Processes vim errors mve.awk pltags.pl Creates a tags file for Perl code for use by vim pltags.pl ref Checks the spelling of arguments ref rview Is a restricted version of view; no shell commands can be started and view cannot be suspended rview rvim Is a restricted version of vim; no shell commands can be started and vim cannot be suspended rvim shtags.pl Generates a tags file for Perl scripts shtags.pl tcltags Generates a tags file for TCL code tcltags view Starts vim in read-only mode view vi Link to vim vi vim Is the editor vim vim132 Starts vim with the terminal in 132-column mode vim132 vim2html.pl Converts Vim documentation to HypterText Markup Language (HTML) vim2html.pl vimdiff Edits two or three versions of a file with vim and show differences vimdiff vimm Enables the DEC locator input model on a remote terminal vimm vimspell.sh Spell checks 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 CLFS nor in BLFS vimspell.sh vimtutor Teaches the basic keys and commands of vim vimtutor xxd Creates a hex dump of the given file; it can also do the reverse, so it can be used for binary patching xxd