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