[02095ae] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
[c439b8a] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ |
---|
[02095ae] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent"> |
---|
| 5 | %general-entities; |
---|
| 6 | ]> |
---|
| 7 | |
---|
| 8 | <sect1 id="ch-system-vim" role="wrap"> |
---|
| 9 | <?dbhtml filename="vim.html"?> |
---|
| 10 | |
---|
| 11 | <title>Vim-&vim-version;</title> |
---|
| 12 | |
---|
| 13 | <indexterm zone="ch-system-vim"> |
---|
| 14 | <primary sortas="a-Vim">Vim</primary> |
---|
| 15 | </indexterm> |
---|
| 16 | |
---|
| 17 | <sect2 role="package"> |
---|
| 18 | <title/> |
---|
| 19 | |
---|
| 20 | <para>The Vim package contains a powerful text editor.</para> |
---|
| 21 | |
---|
[c407f99] | 22 | </sect2> |
---|
| 23 | |
---|
[12e6567] | 24 | &env-target; |
---|
| 25 | |
---|
[c407f99] | 26 | <sect2 role="installation"> |
---|
| 27 | <title>Installation of Vim</title> |
---|
| 28 | |
---|
| 29 | <tip os="t1"> |
---|
[02095ae] | 30 | <title>Alternatives to Vim</title> |
---|
| 31 | |
---|
| 32 | <para>If you prefer another editor—such as Emacs, Joe, or |
---|
| 33 | Nano—please refer to <ulink |
---|
[f3a1e98] | 34 | url="&cblfs-root;index.php/Category:Text_Editors"/> |
---|
[02095ae] | 35 | for suggested installation instructions.</para> |
---|
| 36 | </tip> |
---|
| 37 | |
---|
| 38 | <para os="a">First, unpack both <filename>vim-&vim-version;.tar.bz2</filename> |
---|
| 39 | and (optionally) <filename>vim-&vim-version;-lang.tar.gz</filename> |
---|
| 40 | archives into the same directory.</para> |
---|
| 41 | |
---|
[8fedadb] | 42 | <para os="p1">The following patch merges all updates from the &vim-version; Branch |
---|
| 43 | from the Vim developers:</para> |
---|
| 44 | |
---|
| 45 | <screen os="p2"><userinput>patch -Np1 -i ../&vim-branch_update-patch;</userinput></screen> |
---|
| 46 | |
---|
[f3125bf] | 47 | <para os="cc1">The <command>configure</command> script is full of logic |
---|
[fef8487] | 48 | that aborts at the first sign of cross compiling. Work around this by |
---|
| 49 | setting the cached values of several tests with the following |
---|
| 50 | command:</para> |
---|
[7dda2f2] | 51 | |
---|
[c407f99] | 52 | <screen os="cc2"><userinput>cat > src/auto/config.cache << EOF |
---|
| 53 | vim_cv_getcwd_broken=no |
---|
| 54 | vim_cv_memmove_handles_overlap=yes |
---|
| 55 | vim_cv_stat_ignores_slash=no |
---|
| 56 | vim_cv_terminfo=yes |
---|
| 57 | vim_cv_tgent=zero |
---|
| 58 | vim_cv_toupper_broken=no |
---|
| 59 | vim_cv_tty_group=world |
---|
| 60 | ac_cv_sizeof_int=4 |
---|
| 61 | EOF</userinput></screen> |
---|
[817bb11] | 62 | |
---|
[02095ae] | 63 | <para os="b">Change the default location of |
---|
| 64 | the <filename>vimrc</filename> configuration file to <filename |
---|
| 65 | class="directory">/etc</filename>:</para> |
---|
| 66 | |
---|
[cc8d737] | 67 | <screen os="c"><userinput>cat >> src/feature.h << "EOF" |
---|
| 68 | #define SYS_VIMRC_FILE "/etc/vimrc" |
---|
| 69 | EOF</userinput></screen> |
---|
[02095ae] | 70 | |
---|
| 71 | <para os="d">Prepare Vim for compilation:</para> |
---|
| 72 | |
---|
[040da03] | 73 | <screen os="e"><userinput>CPPFLAGS="-DUNUSED=" ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} \ |
---|
[cee2ca2] | 74 | --prefix=/usr --enable-multibyte --enable-gui=no \ |
---|
| 75 | --disable-gtktest --disable-xim --with-features=normal \ |
---|
| 76 | --disable-gpm --without-x --disable-netbeans \ |
---|
[817bb11] | 77 | --with-tlib=ncurses</userinput></screen> |
---|
[02095ae] | 78 | |
---|
| 79 | <variablelist os="f"> |
---|
| 80 | <title>The meaning of the configure options:</title> |
---|
| 81 | |
---|
| 82 | <varlistentry> |
---|
| 83 | <term><parameter>--enable-multibyte</parameter></term> |
---|
| 84 | <listitem> |
---|
| 85 | <para>This optional but highly recommended switch enables support |
---|
| 86 | for editing files in multibyte character encodings. This is needed |
---|
| 87 | if using a locale with a multibyte character set. This switch is |
---|
| 88 | also helpful to be able to edit text files initially created in |
---|
[291b89c] | 89 | Linux distributions like Fedora that use UTF-8 as a default |
---|
[02095ae] | 90 | character set.</para> |
---|
| 91 | </listitem> |
---|
| 92 | </varlistentry> |
---|
| 93 | |
---|
| 94 | </variablelist> |
---|
| 95 | |
---|
| 96 | <para os="g">Compile the package:</para> |
---|
| 97 | |
---|
| 98 | <screen os="h"><userinput>make</userinput></screen> |
---|
| 99 | |
---|
[817bb11] | 100 | <para os="i">Install the package:</para> |
---|
[02095ae] | 101 | |
---|
[586feb7] | 102 | <screen os="j"><userinput>make DESTDIR=${CLFS} install</userinput></screen> |
---|
[02095ae] | 103 | |
---|
[5590e0d] | 104 | <para os="k">Many users are accustomed to using <command>vi</command> |
---|
| 105 | instead of <command>vim</command>. Some programs, such as |
---|
| 106 | <command>vigr</command> and <command>vipw</command>, also use |
---|
| 107 | <command>vi</command>. Create a symlink to permit execution of |
---|
| 108 | <command>vim</command> when users habitually enter <command>vi</command> |
---|
| 109 | and allow programs that use <command>vi</command> to work:</para> |
---|
[02095ae] | 110 | |
---|
[394cdeb] | 111 | <screen os="l"><userinput>ln -sfv vim ${CLFS}/usr/bin/vi</userinput></screen> |
---|
[02095ae] | 112 | |
---|
[817bb11] | 113 | <para os="m">By default, Vim's documentation is installed in |
---|
[02095ae] | 114 | <filename class="directory">/usr/share/vim</filename>. The following symlink |
---|
| 115 | allows the documentation to be accessed via |
---|
| 116 | <filename class="directory">/usr/share/doc/vim-&vim-version;</filename>, making |
---|
| 117 | it consistent with the location of documentation for other packages:</para> |
---|
| 118 | |
---|
[394cdeb] | 119 | <screen os="n"><userinput>ln -sfnv ../vim/vim&vim-version2;/doc ${CLFS}/usr/share/doc/vim-&vim-version;</userinput></screen> |
---|
[02095ae] | 120 | |
---|
[1a09536] | 121 | <para os="o">If an X Window System is going to be installed on the CLFS |
---|
[5590e0d] | 122 | system, you may want to recompile Vim after installing X. Vim |
---|
[02095ae] | 123 | comes with a GUI version of the editor that requires X and some |
---|
[5590e0d] | 124 | additional libraries to be installed. For more information, refer to the |
---|
[f3a1e98] | 125 | Vim documentation and the Vim installation page in CBLFS at <ulink |
---|
| 126 | url="&cblfs-root;index.php/Vim"/>.</para> |
---|
[02095ae] | 127 | |
---|
| 128 | </sect2> |
---|
| 129 | |
---|
| 130 | <sect2 id="conf-vim" role="configuration"> |
---|
| 131 | <title>Configuring Vim</title> |
---|
| 132 | |
---|
| 133 | <indexterm zone="conf-vim"> |
---|
| 134 | <primary sortas="e-/etc/vimrc">/etc/vimrc</primary> |
---|
| 135 | </indexterm> |
---|
| 136 | |
---|
| 137 | <para>By default, <command>vim</command> runs in vi-incompatible mode. |
---|
| 138 | This may be new to users who have used other editors in the past. The |
---|
| 139 | <quote>nocompatible</quote> setting is included below to highlight the |
---|
| 140 | fact that a new behavior is being used. It also reminds those who would |
---|
| 141 | change to <quote>compatible</quote> mode that it should be the first |
---|
| 142 | setting in the configuration file. This is necessary because it changes |
---|
| 143 | other settings, and overrides must come after this setting. Create a |
---|
| 144 | default <command>vim</command> configuration file by running the |
---|
| 145 | following:</para> |
---|
| 146 | |
---|
[586feb7] | 147 | <screen><userinput>cat > ${CLFS}/etc/vimrc << "EOF" |
---|
[02095ae] | 148 | <literal>" Begin /etc/vimrc |
---|
| 149 | |
---|
| 150 | set nocompatible |
---|
| 151 | set backspace=2 |
---|
| 152 | syntax on |
---|
| 153 | if (&term == "iterm") || (&term == "putty") |
---|
| 154 | set background=dark |
---|
| 155 | endif |
---|
| 156 | |
---|
| 157 | " End /etc/vimrc</literal> |
---|
| 158 | EOF</userinput></screen> |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | <para>The <parameter>set nocompatible</parameter> makes |
---|
| 162 | <command>vim</command> behave in a more useful way (the default) than |
---|
| 163 | the vi-compatible manner. Remove the <quote>no</quote> to keep the |
---|
| 164 | old <command>vi</command> behavior. The <parameter>set |
---|
| 165 | backspace=2</parameter> allows backspacing over line breaks, |
---|
| 166 | autoindents, and the start of insert. The <parameter>syntax |
---|
| 167 | on</parameter> enables vim's syntax highlighting. Finally, the |
---|
| 168 | <emphasis>if</emphasis> statement with the <parameter>set |
---|
| 169 | background=dark</parameter> corrects <command>vim</command>'s guess |
---|
| 170 | about the background color of some terminal emulators. This gives the |
---|
| 171 | highlighting a better color scheme for use on the black background of |
---|
| 172 | these programs.</para> |
---|
| 173 | |
---|
| 174 | <para>Documentation for other available options can be obtained by |
---|
| 175 | running the following command:</para> |
---|
| 176 | |
---|
| 177 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen> |
---|
| 178 | |
---|
| 179 | </sect2> |
---|
| 180 | |
---|
| 181 | <sect2 id="contents-vim" role="content"> |
---|
| 182 | <title>Contents of Vim</title> |
---|
| 183 | |
---|
| 184 | <segmentedlist> |
---|
| 185 | <segtitle>Installed programs</segtitle> |
---|
| 186 | |
---|
| 187 | <seglistitem> |
---|
| 188 | <seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk, |
---|
| 189 | pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, |
---|
| 190 | tcltags, vi (link to vim), view (link to vim), vim, vim132, vim2html.pl, |
---|
| 191 | vimdiff (link to vim), vimm, vimspell.sh, vimtutor, and xxd</seg> |
---|
| 192 | </seglistitem> |
---|
| 193 | </segmentedlist> |
---|
| 194 | |
---|
| 195 | <variablelist> |
---|
| 196 | <bridgehead renderas="sect3">Short Descriptions</bridgehead> |
---|
| 197 | <?dbfo list-presentation="list"?> |
---|
| 198 | <?dbhtml list-presentation="table"?> |
---|
| 199 | |
---|
| 200 | <varlistentry id="efm_filter.pl"> |
---|
| 201 | <term><command>efm_filter.pl</command></term> |
---|
| 202 | <listitem> |
---|
| 203 | <para>A filter for creating an error file that can be read |
---|
| 204 | by <command>vim</command></para> |
---|
| 205 | <indexterm zone="ch-system-vim efm_filter.pl"> |
---|
| 206 | <primary sortas="b-efm_filter.pl">efm_filter.pl</primary> |
---|
| 207 | </indexterm> |
---|
| 208 | </listitem> |
---|
| 209 | </varlistentry> |
---|
| 210 | |
---|
| 211 | <varlistentry id="efm_perl.pl"> |
---|
| 212 | <term><command>efm_perl.pl</command></term> |
---|
| 213 | <listitem> |
---|
| 214 | <para>Reformats the error messages of the Perl interpreter for use |
---|
| 215 | with the <quote>quickfix</quote> mode of <command>vim</command></para> |
---|
| 216 | <indexterm zone="ch-system-vim efm_perl.pl"> |
---|
| 217 | <primary sortas="b-efm_perl.pl">efm_perl.pl</primary> |
---|
| 218 | </indexterm> |
---|
| 219 | </listitem> |
---|
| 220 | </varlistentry> |
---|
| 221 | |
---|
| 222 | <varlistentry id="ex"> |
---|
| 223 | <term><command>ex</command></term> |
---|
| 224 | <listitem> |
---|
| 225 | <para>Starts <command>vim</command> in ex mode</para> |
---|
| 226 | <indexterm zone="ch-system-vim ex"> |
---|
| 227 | <primary sortas="b-ex">ex</primary> |
---|
| 228 | </indexterm> |
---|
| 229 | </listitem> |
---|
| 230 | </varlistentry> |
---|
| 231 | |
---|
| 232 | <varlistentry id="less.sh"> |
---|
| 233 | <term><command>less.sh</command></term> |
---|
| 234 | <listitem> |
---|
| 235 | <para>A script that starts <command>vim</command> with less.vim</para> |
---|
| 236 | <indexterm zone="ch-system-vim less.sh"> |
---|
| 237 | <primary sortas="b-less.sh">less.sh</primary> |
---|
| 238 | </indexterm> |
---|
| 239 | </listitem> |
---|
| 240 | </varlistentry> |
---|
| 241 | |
---|
| 242 | <varlistentry id="mve.awk"> |
---|
| 243 | <term><command>mve.awk</command></term> |
---|
| 244 | <listitem> |
---|
| 245 | <para>Processes <command>vim</command> errors</para> |
---|
| 246 | <indexterm zone="ch-system-vim mve.awk"> |
---|
| 247 | <primary sortas="b-mve.awk">mve.awk</primary> |
---|
| 248 | </indexterm> |
---|
| 249 | </listitem> |
---|
| 250 | </varlistentry> |
---|
| 251 | |
---|
| 252 | <varlistentry id="pltags.pl"> |
---|
| 253 | <term><command>pltags.pl</command></term> |
---|
| 254 | <listitem> |
---|
| 255 | <para>Creates a tags file for Perl code for use by |
---|
| 256 | <command>vim</command></para> |
---|
| 257 | <indexterm zone="ch-system-vim pltags.pl"> |
---|
| 258 | <primary sortas="b-pltags.pl">pltags.pl</primary> |
---|
| 259 | </indexterm> |
---|
| 260 | </listitem> |
---|
| 261 | </varlistentry> |
---|
| 262 | |
---|
| 263 | <varlistentry id="ref"> |
---|
| 264 | <term><command>ref</command></term> |
---|
| 265 | <listitem> |
---|
| 266 | <para>Checks the spelling of arguments</para> |
---|
| 267 | <indexterm zone="ch-system-vim ref"> |
---|
| 268 | <primary sortas="b-ref">ref</primary> |
---|
| 269 | </indexterm> |
---|
| 270 | </listitem> |
---|
| 271 | </varlistentry> |
---|
| 272 | |
---|
| 273 | <varlistentry id="rview"> |
---|
| 274 | <term><command>rview</command></term> |
---|
| 275 | <listitem> |
---|
| 276 | <para>Is a restricted version of <command>view</command>; no shell |
---|
| 277 | commands can be started and <command>view</command> cannot be |
---|
| 278 | suspended</para> |
---|
| 279 | <indexterm zone="ch-system-vim rview"> |
---|
| 280 | <primary sortas="b-rview">rview</primary> |
---|
| 281 | </indexterm> |
---|
| 282 | </listitem> |
---|
| 283 | </varlistentry> |
---|
| 284 | |
---|
| 285 | <varlistentry id="rvim"> |
---|
| 286 | <term><command>rvim</command></term> |
---|
| 287 | <listitem> |
---|
| 288 | <para>Is a restricted version of <command>vim</command>; no shell |
---|
| 289 | commands can be started and <command>vim</command> cannot be |
---|
| 290 | suspended</para> |
---|
| 291 | <indexterm zone="ch-system-vim rvim"> |
---|
| 292 | <primary sortas="b-rvim">rvim</primary> |
---|
| 293 | </indexterm> |
---|
| 294 | </listitem> |
---|
| 295 | </varlistentry> |
---|
| 296 | |
---|
| 297 | <varlistentry id="shtags.pl"> |
---|
| 298 | <term><command>shtags.pl</command></term> |
---|
| 299 | <listitem> |
---|
| 300 | <para>Generates a tags file for Perl scripts</para> |
---|
| 301 | <indexterm zone="ch-system-vim shtags.pl"> |
---|
| 302 | <primary sortas="b-shtags.pl">shtags.pl</primary> |
---|
| 303 | </indexterm> |
---|
| 304 | </listitem> |
---|
| 305 | </varlistentry> |
---|
| 306 | |
---|
| 307 | <varlistentry id="tcltags"> |
---|
| 308 | <term><command>tcltags</command></term> |
---|
| 309 | <listitem> |
---|
| 310 | <para>Generates a tags file for TCL code</para> |
---|
| 311 | <indexterm zone="ch-system-vim tcltags"> |
---|
| 312 | <primary sortas="b-tcltags">tcltags</primary> |
---|
| 313 | </indexterm> |
---|
| 314 | </listitem> |
---|
| 315 | </varlistentry> |
---|
| 316 | |
---|
| 317 | <varlistentry id="view"> |
---|
| 318 | <term><command>view</command></term> |
---|
| 319 | <listitem> |
---|
| 320 | <para>Starts <command>vim</command> in read-only mode</para> |
---|
| 321 | <indexterm zone="ch-system-vim view"> |
---|
| 322 | <primary sortas="b-view">view</primary> |
---|
| 323 | </indexterm> |
---|
| 324 | </listitem> |
---|
| 325 | </varlistentry> |
---|
| 326 | |
---|
| 327 | <varlistentry id="vi"> |
---|
| 328 | <term><command>vi</command></term> |
---|
| 329 | <listitem> |
---|
| 330 | <para>Link to <command>vim</command></para> |
---|
| 331 | <indexterm zone="ch-system-vim vi"> |
---|
| 332 | <primary sortas="b-vi">vi</primary> |
---|
| 333 | </indexterm> |
---|
| 334 | </listitem> |
---|
| 335 | </varlistentry> |
---|
| 336 | |
---|
| 337 | <varlistentry id="vim"> |
---|
| 338 | <term><command>vim</command></term> |
---|
| 339 | <listitem> |
---|
| 340 | <para>Is the editor</para> |
---|
| 341 | <indexterm zone="ch-system-vim vim"> |
---|
| 342 | <primary sortas="b-vim">vim</primary> |
---|
| 343 | </indexterm> |
---|
| 344 | </listitem> |
---|
| 345 | </varlistentry> |
---|
| 346 | |
---|
| 347 | <varlistentry id="vim132"> |
---|
| 348 | <term><command>vim132</command></term> |
---|
| 349 | <listitem> |
---|
| 350 | <para>Starts <command>vim</command> with the terminal in 132-column |
---|
| 351 | mode</para> |
---|
| 352 | <indexterm zone="ch-system-vim vim132"> |
---|
| 353 | <primary sortas="b-vim132">vim132</primary> |
---|
| 354 | </indexterm> |
---|
| 355 | </listitem> |
---|
| 356 | </varlistentry> |
---|
| 357 | |
---|
| 358 | <varlistentry id="vim2html.pl"> |
---|
| 359 | <term><command>vim2html.pl</command></term> |
---|
| 360 | <listitem> |
---|
| 361 | <para>Converts Vim documentation to HypterText Markup Language |
---|
| 362 | (HTML)</para> |
---|
| 363 | <indexterm zone="ch-system-vim vim2html.pl"> |
---|
| 364 | <primary sortas="b-vim2html.pl">vim2html.pl</primary> |
---|
| 365 | </indexterm> |
---|
| 366 | </listitem> |
---|
| 367 | </varlistentry> |
---|
| 368 | |
---|
| 369 | <varlistentry id="vimdiff"> |
---|
| 370 | <term><command>vimdiff</command></term> |
---|
| 371 | <listitem> |
---|
| 372 | <para>Edits two or three versions of a file with <command>vim</command> |
---|
| 373 | and show differences</para> |
---|
| 374 | <indexterm zone="ch-system-vim vimdiff"> |
---|
| 375 | <primary sortas="b-vimdiff">vimdiff</primary> |
---|
| 376 | </indexterm> |
---|
| 377 | </listitem> |
---|
| 378 | </varlistentry> |
---|
| 379 | |
---|
| 380 | <varlistentry id="vimm"> |
---|
| 381 | <term><command>vimm</command></term> |
---|
| 382 | <listitem> |
---|
| 383 | <para>Enables the DEC locator input model on a remote terminal</para> |
---|
| 384 | <indexterm zone="ch-system-vim vimm"> |
---|
| 385 | <primary sortas="b-vimm">vimm</primary> |
---|
| 386 | </indexterm> |
---|
| 387 | </listitem> |
---|
| 388 | </varlistentry> |
---|
| 389 | |
---|
| 390 | <varlistentry id="vimspell.sh"> |
---|
| 391 | <term><command>vimspell.sh</command></term> |
---|
| 392 | <listitem> |
---|
| 393 | <para>Spell checks a file and generates the syntax statements |
---|
| 394 | necessary to highlight in <command>vim</command>. This script |
---|
| 395 | requires the old Unix <command>spell</command> command, which |
---|
[755f44a] | 396 | is provided neither in CLFS nor in BLFS</para> |
---|
[02095ae] | 397 | <indexterm zone="ch-system-vim vimspell.sh"> |
---|
| 398 | <primary sortas="b-vimspell.sh">vimspell.sh</primary> |
---|
| 399 | </indexterm> |
---|
| 400 | </listitem> |
---|
| 401 | </varlistentry> |
---|
| 402 | |
---|
| 403 | <varlistentry id="vimtutor"> |
---|
| 404 | <term><command>vimtutor</command></term> |
---|
| 405 | <listitem> |
---|
| 406 | <para>Teaches the basic keys and commands of |
---|
| 407 | <command>vim</command></para> |
---|
| 408 | <indexterm zone="ch-system-vim vimtutor"> |
---|
| 409 | <primary sortas="b-vimtutor">vimtutor</primary> |
---|
| 410 | </indexterm> |
---|
| 411 | </listitem> |
---|
| 412 | </varlistentry> |
---|
| 413 | |
---|
| 414 | <varlistentry id="xxd"> |
---|
| 415 | <term><command>xxd</command></term> |
---|
| 416 | <listitem> |
---|
| 417 | <para>Creates a hex dump of the given file; it can |
---|
| 418 | also do the reverse, so it can be used for binary patching</para> |
---|
| 419 | <indexterm zone="ch-system-vim xxd"> |
---|
| 420 | <primary sortas="b-xxd">xxd</primary> |
---|
| 421 | </indexterm> |
---|
| 422 | </listitem> |
---|
| 423 | </varlistentry> |
---|
| 424 | |
---|
| 425 | </variablelist> |
---|
| 426 | |
---|
| 427 | </sect2> |
---|
| 428 | |
---|
| 429 | </sect1> |
---|