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