[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[a001133] | 6 | <sect1 id="ch-system-vim" xreflabel="Vim" role="wrap">
|
---|
[673b0d8] | 7 | <title>Vim-&vim-version;</title>
|
---|
| 8 | <?dbhtml filename="vim.html"?>
|
---|
| 9 |
|
---|
| 10 | <indexterm zone="ch-system-vim"><primary sortas="a-Vim">Vim</primary></indexterm>
|
---|
[6370fa6] | 11 |
|
---|
[a001133] | 12 | <sect2 role="package"><title/>
|
---|
[5888299] | 13 | <para>The Vim package contains a powerful text editor.</para>
|
---|
| 14 |
|
---|
[a001133] | 15 | <segmentedlist>
|
---|
| 16 | <segtitle>&buildtime;</segtitle>
|
---|
| 17 | <segtitle>&diskspace;</segtitle>
|
---|
| 18 | <seglistitem><seg>0.4 SBU</seg><seg>34 MB</seg></seglistitem>
|
---|
| 19 | </segmentedlist>
|
---|
| 20 |
|
---|
| 21 | <segmentedlist>
|
---|
| 22 | <segtitle>Vim installation depends on</segtitle>
|
---|
| 23 | <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils,
|
---|
| 24 | GCC, Glibc, Grep, Make, Ncurses, Sed</seg></seglistitem>
|
---|
| 25 | </segmentedlist>
|
---|
[5888299] | 26 |
|
---|
[df8334f] | 27 | <tip>
|
---|
[35c2fa60] | 28 | <title>Alternatives to Vim</title>
|
---|
| 29 | <para>If you prefer another editor -- like Emacs, Joe, or Nano -- to Vim,
|
---|
[f861982] | 30 | have a look at <ulink url="&blfs-root;view/stable/postlfs/editors.html"/> for
|
---|
[35c2fa60] | 31 | suggested installation instructions.</para>
|
---|
[df8334f] | 32 | </tip>
|
---|
[35c2fa60] | 33 | </sect2>
|
---|
| 34 |
|
---|
[a001133] | 35 | <sect2 role="installation">
|
---|
[73aedd1d] | 36 | <title>Installation of Vim</title>
|
---|
| 37 |
|
---|
[0ba2766b] | 38 | <para>First change the default locations of the <filename>vimrc</filename> and
|
---|
[673b0d8] | 39 | <filename>gvimrc</filename> configuration files to <filename class="directory">/etc</filename>.</para>
|
---|
[73aedd1d] | 40 |
|
---|
| 41 | <screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
|
---|
| 42 | echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h</userinput></screen>
|
---|
| 43 |
|
---|
| 44 | <para>Now prepare Vim for compilation:</para>
|
---|
| 45 |
|
---|
[c3d6ceb] | 46 | <screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
[73aedd1d] | 47 |
|
---|
[dc32fef] | 48 | <para>The optional <userinput>--enable-multibyte</userinput> switch
|
---|
| 49 | includes multibyte editing support into
|
---|
| 50 | vim. It is only needed for those people who ignore our recommendation not to
|
---|
| 51 | use LFS in locales with multibyte character sets, but it does not hurt
|
---|
| 52 | others.</para>
|
---|
| 53 |
|
---|
[73aedd1d] | 54 | <para>Compile the package:</para>
|
---|
| 55 |
|
---|
| 56 | <screen><userinput>make</userinput></screen>
|
---|
| 57 |
|
---|
[673b0d8] | 58 | <para>To test the results, you can issue:
|
---|
[9dfc02f] | 59 | <userinput>make test</userinput>. However, this test suite outputs a lot of
|
---|
[8a5f906] | 60 | seemingly garbage characters to the screen, and this can wreak havoc with the
|
---|
[db9d773c] | 61 | settings of the current terminal. Therefore the running of the test suite here
|
---|
| 62 | is strictly optional.</para>
|
---|
[1a73ed4] | 63 |
|
---|
[673b0d8] | 64 | <para>Now install the package:</para>
|
---|
[73aedd1d] | 65 |
|
---|
| 66 | <screen><userinput>make install</userinput></screen>
|
---|
| 67 |
|
---|
[673b0d8] | 68 | <para>Many users are used to using <command>vi</command>, instead of
|
---|
| 69 | <command>vim</command>. To let them execute <command>vim</command> when
|
---|
| 70 | they habitually enter <command>vi</command>, create a symlink:</para>
|
---|
[73aedd1d] | 71 |
|
---|
| 72 | <screen><userinput>ln -s vim /usr/bin/vi</userinput></screen>
|
---|
| 73 |
|
---|
[0ba2766b] | 74 | <para>If you are going to install the X Window system on your LFS system, you
|
---|
| 75 | may want to re-compile Vim after having installed X. Vim comes with a nice GUI
|
---|
| 76 | version of the editor that requires X and a few other libraries to be
|
---|
| 77 | installed. For more information read the Vim documentation.</para>
|
---|
[73aedd1d] | 78 |
|
---|
| 79 | </sect2>
|
---|
[0ba2766b] | 80 |
|
---|
[342b176] | 81 |
|
---|
[df8334f] | 82 | <sect2 id="conf-vim" role="configuration"><title>Configuring Vim</title>
|
---|
[673b0d8] | 83 | <indexterm zone="conf-vim"><primary sortas="e-/etc/vim">/etc/vim</primary></indexterm>
|
---|
[342b176] | 84 |
|
---|
[673b0d8] | 85 | <para>By default, <command>vim</command> runs in vi-incompatible mode. Some
|
---|
| 86 | people might not like this, but we prefer to run <command>vim</command> in its
|
---|
[342b176] | 87 | own mode (else we wouldn't have included it in this book, but the original
|
---|
[673b0d8] | 88 | <command>vi</command>). We've included the setting of "nocompatible"
|
---|
| 89 | below to high-light the fact that the new behavior is being used. It
|
---|
| 90 | also reminds those who would change to "compatible" mode that it should
|
---|
| 91 | appear first because it changes other settings and overrides must come
|
---|
| 92 | after this setting. Create a default vim configuration file by running
|
---|
[342b176] | 93 | the following:</para>
|
---|
| 94 |
|
---|
| 95 | <screen><userinput>cat > /etc/vimrc << "EOF"</userinput>
|
---|
| 96 | " Begin /etc/vimrc
|
---|
| 97 |
|
---|
| 98 | set nocompatible
|
---|
| 99 | set backspace=2
|
---|
| 100 | syntax on
|
---|
[24789da] | 101 | set background=dark
|
---|
[342b176] | 102 |
|
---|
| 103 | " End /etc/vimrc
|
---|
| 104 | <userinput>EOF</userinput></screen>
|
---|
| 105 |
|
---|
[673b0d8] | 106 | <para>The <emphasis>set nocompatible</emphasis> makes
|
---|
| 107 | <command>vim</command> behave in a more useful way (the default) than the
|
---|
| 108 | vi-compatible manner. Remove the "no" if you want the old <command>vi</command>
|
---|
| 109 | behavior. The <emphasis>set backspace=2</emphasis> allows
|
---|
| 110 | backspacing over line breaks, autoindents and the start of insert. The
|
---|
| 111 | <emphasis>syntax on</emphasis> enables <command>vim</command>'s
|
---|
[24789da] | 112 | syntax highliting, while <emphasis>set background=dark</emphasis> gives the
|
---|
| 113 | highliting a better color scheme for use on the black background of a linux
|
---|
| 114 | console. If you later use X and terminals with a light background, changing
|
---|
| 115 | this will be useful.</para>
|
---|
[342b176] | 116 |
|
---|
[dc32fef] | 117 | <para>Documentation for other available options can be obtained by running
|
---|
| 118 | the following command:</para>
|
---|
| 119 |
|
---|
| 120 | <screen><userinput>vim -c ':options'</userinput></screen>
|
---|
| 121 |
|
---|
[342b176] | 122 | </sect2>
|
---|
[0ba2766b] | 123 |
|
---|
[5888299] | 124 |
|
---|
[c6cb3aa] | 125 | <sect2 id="contents-vim" role="content"><title>Contents of Vim</title>
|
---|
[673b0d8] | 126 |
|
---|
[c6cb3aa] | 127 | <segmentedlist>
|
---|
| 128 | <segtitle>Installed programs</segtitle>
|
---|
| 129 | <seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
|
---|
| 130 | pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim),
|
---|
| 131 | view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh,
|
---|
| 132 | vimtutor and xxd</seg></seglistitem>
|
---|
| 133 | </segmentedlist>
|
---|
[673b0d8] | 134 |
|
---|
[c6cb3aa] | 135 | <variablelist><title>Short descriptions</title>
|
---|
[673b0d8] | 136 |
|
---|
[b8a819f] | 137 | <varlistentry id="efm_filter.pl">
|
---|
| 138 | <term><command>efm_filter.pl</command></term>
|
---|
[c6cb3aa] | 139 | <listitem>
|
---|
[673b0d8] | 140 | <indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
|
---|
[c6cb3aa] | 141 | <para>is a filter for creating an error file that can be read by vim.</para>
|
---|
| 142 | </listitem>
|
---|
| 143 | </varlistentry>
|
---|
[673b0d8] | 144 |
|
---|
[b8a819f] | 145 | <varlistentry id="efm_perl.pl">
|
---|
| 146 | <term><command>efm_perl.pl</command></term>
|
---|
[c6cb3aa] | 147 | <listitem>
|
---|
[673b0d8] | 148 | <indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
|
---|
[c6cb3aa] | 149 | <para>reformats the error messages of the
|
---|
[673b0d8] | 150 | Perl interpreter for use with the <quote>quickfix</quote> mode of vim.</para>
|
---|
[c6cb3aa] | 151 | </listitem>
|
---|
| 152 | </varlistentry>
|
---|
[673b0d8] | 153 |
|
---|
[b8a819f] | 154 | <varlistentry id="ex">
|
---|
| 155 | <term><command>ex</command></term>
|
---|
[c6cb3aa] | 156 | <listitem>
|
---|
[673b0d8] | 157 | <indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
|
---|
[c6cb3aa] | 158 | <para>starts vim in ex mode.</para>
|
---|
| 159 | </listitem>
|
---|
| 160 | </varlistentry>
|
---|
[673b0d8] | 161 |
|
---|
[b8a819f] | 162 | <varlistentry id="less.sh">
|
---|
| 163 | <term><command>less.sh</command></term>
|
---|
[c6cb3aa] | 164 | <listitem>
|
---|
[673b0d8] | 165 | <indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
|
---|
[c6cb3aa] | 166 | <para>is a script that starts vim with less.vim.</para>
|
---|
| 167 | </listitem>
|
---|
| 168 | </varlistentry>
|
---|
[673b0d8] | 169 |
|
---|
[b8a819f] | 170 | <varlistentry id="mve.awk">
|
---|
| 171 | <term><command>mve.awk</command></term>
|
---|
[c6cb3aa] | 172 | <listitem>
|
---|
[673b0d8] | 173 | <indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
|
---|
[c6cb3aa] | 174 | <para>processes vim errors.</para>
|
---|
| 175 | </listitem>
|
---|
| 176 | </varlistentry>
|
---|
[673b0d8] | 177 |
|
---|
[b8a819f] | 178 | <varlistentry id="pltags.pl">
|
---|
| 179 | <term><command>pltags.pl</command></term>
|
---|
[c6cb3aa] | 180 | <listitem>
|
---|
[673b0d8] | 181 | <indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
|
---|
[c6cb3aa] | 182 | <para>creates a tags file for perl code, for use by vim.</para>
|
---|
| 183 | </listitem>
|
---|
| 184 | </varlistentry>
|
---|
[673b0d8] | 185 |
|
---|
[b8a819f] | 186 | <varlistentry id="ref">
|
---|
| 187 | <term><command>ref</command></term>
|
---|
[c6cb3aa] | 188 | <listitem>
|
---|
[673b0d8] | 189 | <indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
|
---|
[c6cb3aa] | 190 | <para>checks the spelling of arguments.</para>
|
---|
| 191 | </listitem>
|
---|
| 192 | </varlistentry>
|
---|
[673b0d8] | 193 |
|
---|
[b8a819f] | 194 | <varlistentry id="rview">
|
---|
| 195 | <term><command>rview</command></term>
|
---|
[c6cb3aa] | 196 | <listitem>
|
---|
[673b0d8] | 197 | <indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
|
---|
[c6cb3aa] | 198 | <para>is a restricted version of view: no shell
|
---|
[673b0d8] | 199 | commands can be started and view can't be suspended.</para>
|
---|
[c6cb3aa] | 200 | </listitem>
|
---|
| 201 | </varlistentry>
|
---|
[673b0d8] | 202 |
|
---|
[b8a819f] | 203 | <varlistentry id="rvim">
|
---|
| 204 | <term><command>rvim</command></term>
|
---|
[c6cb3aa] | 205 | <listitem>
|
---|
[673b0d8] | 206 | <indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
|
---|
[c6cb3aa] | 207 | <para>is a restricted version of vim: no shell
|
---|
[673b0d8] | 208 | commands can be started and vim can't be suspended.</para>
|
---|
[c6cb3aa] | 209 | </listitem>
|
---|
| 210 | </varlistentry>
|
---|
[73aedd1d] | 211 |
|
---|
[b8a819f] | 212 | <varlistentry id="shtags.pl">
|
---|
| 213 | <term><command>shtags.pl</command></term>
|
---|
[c6cb3aa] | 214 | <listitem>
|
---|
[673b0d8] | 215 | <indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
|
---|
[c6cb3aa] | 216 | <para>generates a tag file for perl scripts.</para>
|
---|
| 217 | </listitem>
|
---|
| 218 | </varlistentry>
|
---|
[673b0d8] | 219 |
|
---|
[b8a819f] | 220 | <varlistentry id="tcltags">
|
---|
| 221 | <term><command>tcltags</command></term>
|
---|
[c6cb3aa] | 222 | <listitem>
|
---|
[673b0d8] | 223 | <indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
|
---|
[c6cb3aa] | 224 | <para>generates a tag file for TCL code.</para>
|
---|
| 225 | </listitem>
|
---|
| 226 | </varlistentry>
|
---|
[673b0d8] | 227 |
|
---|
[b8a819f] | 228 | <varlistentry id="view">
|
---|
| 229 | <term><command>view</command></term>
|
---|
[c6cb3aa] | 230 | <listitem>
|
---|
[673b0d8] | 231 | <indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
|
---|
[c6cb3aa] | 232 | <para>starts vim in read-only mode.</para>
|
---|
| 233 | </listitem>
|
---|
| 234 | </varlistentry>
|
---|
[673b0d8] | 235 |
|
---|
[b8a819f] | 236 | <varlistentry id="vim">
|
---|
| 237 | <term><command>vim</command></term>
|
---|
[c6cb3aa] | 238 | <listitem>
|
---|
[673b0d8] | 239 | <indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
|
---|
[c6cb3aa] | 240 | <para>is the editor.</para>
|
---|
| 241 | </listitem>
|
---|
| 242 | </varlistentry>
|
---|
[673b0d8] | 243 |
|
---|
[b8a819f] | 244 | <varlistentry id="vim132">
|
---|
| 245 | <term><command>vim132</command></term>
|
---|
[c6cb3aa] | 246 | <listitem>
|
---|
[673b0d8] | 247 | <indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
|
---|
[c6cb3aa] | 248 | <para>starts vim with the terminal in 132-column mode.</para>
|
---|
| 249 | </listitem>
|
---|
| 250 | </varlistentry>
|
---|
[673b0d8] | 251 |
|
---|
[b8a819f] | 252 | <varlistentry id="vim2html.pl">
|
---|
| 253 | <term><command>vim2html.pl</command></term>
|
---|
[c6cb3aa] | 254 | <listitem>
|
---|
[673b0d8] | 255 | <indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
|
---|
[c6cb3aa] | 256 | <para>converts vim documentation to HTML.</para>
|
---|
| 257 | </listitem>
|
---|
| 258 | </varlistentry>
|
---|
[673b0d8] | 259 |
|
---|
[b8a819f] | 260 | <varlistentry id="vimdiff">
|
---|
| 261 | <term><command>vimdiff</command></term>
|
---|
[c6cb3aa] | 262 | <listitem>
|
---|
[673b0d8] | 263 | <indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
|
---|
[c6cb3aa] | 264 | <para>edits two or three versions of a file with vim and show differences.</para>
|
---|
| 265 | </listitem>
|
---|
| 266 | </varlistentry>
|
---|
[673b0d8] | 267 |
|
---|
[b8a819f] | 268 | <varlistentry id="vimm">
|
---|
| 269 | <term><command>vimm</command></term>
|
---|
[c6cb3aa] | 270 | <listitem>
|
---|
[673b0d8] | 271 | <indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
|
---|
[c6cb3aa] | 272 | <para>enables the DEC locator input model on a remote terminal.</para>
|
---|
| 273 | </listitem>
|
---|
| 274 | </varlistentry>
|
---|
[673b0d8] | 275 |
|
---|
[b8a819f] | 276 | <varlistentry id="vimspell.sh">
|
---|
| 277 | <term><command>vimspell.sh</command></term>
|
---|
[c6cb3aa] | 278 | <listitem>
|
---|
[673b0d8] | 279 | <indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
|
---|
[c6cb3aa] | 280 | <para>is a script which spells a file and generates the syntax statements necessary
|
---|
| 281 | to highlight in vim. This script requires the old Unix <command>spell</command>
|
---|
| 282 | command, which is provided neither in LFS nor in BLFS.</para>
|
---|
| 283 | </listitem>
|
---|
| 284 | </varlistentry>
|
---|
| 285 |
|
---|
[b8a819f] | 286 | <varlistentry id="vimtutor">
|
---|
| 287 | <term><command>vimtutor</command></term>
|
---|
[c6cb3aa] | 288 | <listitem>
|
---|
[673b0d8] | 289 | <indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
|
---|
[c6cb3aa] | 290 | <para>teaches you the basic keys and commands of vim.</para>
|
---|
| 291 | </listitem>
|
---|
| 292 | </varlistentry>
|
---|
[673b0d8] | 293 |
|
---|
[b8a819f] | 294 | <varlistentry id="xxd">
|
---|
| 295 | <term><command>xxd</command></term>
|
---|
[c6cb3aa] | 296 | <listitem>
|
---|
[673b0d8] | 297 | <indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
|
---|
[c6cb3aa] | 298 | <para>makes a hex dump of the given file. It can
|
---|
[673b0d8] | 299 | also do the reverse, so it can be used for binary patching.</para>
|
---|
[c6cb3aa] | 300 | </listitem>
|
---|
| 301 | </varlistentry>
|
---|
| 302 | </variablelist>
|
---|
[673b0d8] | 303 |
|
---|
| 304 | </sect2>
|
---|
| 305 |
|
---|
| 306 | </sect1>
|
---|