[67300de] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/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="&cblfs-root;index.php/Category:Text_Editors"/>
|
---|
| 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.</para>
|
---|
| 39 |
|
---|
| 40 | <para os="p1">The following patches merges all updates from the &vim-version; Branch
|
---|
| 41 | from the Vim developers:</para>
|
---|
| 42 |
|
---|
| 43 | <screen os="p2"><userinput>patch -Np1 -i ../&vim-branch_update-patch;</userinput></screen>
|
---|
| 44 |
|
---|
| 45 | <para os="b">Change the default location of
|
---|
| 46 | the <filename>vimrc</filename> configuration file to <filename
|
---|
| 47 | class="directory">/etc</filename>:</para>
|
---|
| 48 |
|
---|
| 49 | <screen os="c"><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
---|
| 50 |
|
---|
| 51 | <para os="d">Prepare Vim for compilation:</para>
|
---|
| 52 |
|
---|
| 53 | <screen os="e"><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
| 54 |
|
---|
| 55 | <variablelist os="f">
|
---|
| 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 |
|
---|
| 72 | <para os="g">Compile the package:</para>
|
---|
| 73 |
|
---|
| 74 | <screen os="h"><userinput>make</userinput></screen>
|
---|
| 75 |
|
---|
| 76 | <para os="i">To test the results, issue: <userinput>make test</userinput>.
|
---|
| 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 |
|
---|
| 81 | <para os="j">Install the package:</para>
|
---|
| 82 |
|
---|
| 83 | <screen os="k"><userinput>make install</userinput></screen>
|
---|
| 84 |
|
---|
| 85 | <para os="l">Many users are accustomed to using <command>vi</command>
|
---|
| 86 | instead of <command>vim</command>. Some programs, such as
|
---|
| 87 | <command>vigr</command> and <command>vipw</command>, also use
|
---|
| 88 | <command>vi</command>. Create a symlink to permit execution of
|
---|
| 89 | <command>vim</command> when users habitually enter <command>vi</command>
|
---|
| 90 | and allow programs that use <command>vi</command> to work:</para>
|
---|
| 91 |
|
---|
| 92 | <screen os="m"><userinput>ln -sv vim /usr/bin/vi</userinput></screen>
|
---|
| 93 |
|
---|
| 94 | <para os="n">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 |
|
---|
| 100 | <screen os="o"><userinput>ln -sv ../vim/vim&vim-version2;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
|
---|
| 101 |
|
---|
| 102 | <para os="p">If an X Window System is going to be installed on the CLFS
|
---|
| 103 | system, you may want 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, refer to the
|
---|
| 106 | Vim documentation and the Vim installation page
|
---|
| 107 | in the CBLFS book at <ulink
|
---|
| 108 | url="&cblfs-root;index.php/Vim"/>.</para>
|
---|
| 109 |
|
---|
| 110 | </sect2>
|
---|
| 111 |
|
---|
| 112 | <sect2 id="conf-vim" role="configuration">
|
---|
| 113 | <title>Configuring Vim</title>
|
---|
| 114 |
|
---|
| 115 | <indexterm zone="conf-vim">
|
---|
| 116 | <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
|
---|
| 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 |
|
---|
| 159 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
|
---|
| 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 CLFS nor in CBLFS</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>
|
---|