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