[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[a001133] | 6 | <sect1 id="ch-system-vim" xreflabel="Vim" role="wrap">
|
---|
[673b0d8] | 7 | <title>Vim-&vim-version;</title>
|
---|
| 8 | <?dbhtml filename="vim.html"?>
|
---|
| 9 |
|
---|
| 10 | <indexterm zone="ch-system-vim"><primary sortas="a-Vim">Vim</primary></indexterm>
|
---|
[6370fa6] | 11 |
|
---|
[a001133] | 12 | <sect2 role="package"><title/>
|
---|
[5888299] | 13 | <para>The Vim package contains a powerful text editor.</para>
|
---|
| 14 |
|
---|
[a001133] | 15 | <segmentedlist>
|
---|
| 16 | <segtitle>&buildtime;</segtitle>
|
---|
| 17 | <segtitle>&diskspace;</segtitle>
|
---|
| 18 | <seglistitem><seg>0.4 SBU</seg><seg>34 MB</seg></seglistitem>
|
---|
| 19 | </segmentedlist>
|
---|
| 20 |
|
---|
| 21 | <segmentedlist>
|
---|
| 22 | <segtitle>Vim installation depends on</segtitle>
|
---|
| 23 | <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils,
|
---|
| 24 | GCC, Glibc, Grep, Make, Ncurses, Sed</seg></seglistitem>
|
---|
| 25 | </segmentedlist>
|
---|
[5888299] | 26 |
|
---|
[df8334f] | 27 | <tip>
|
---|
[35c2fa60] | 28 | <title>Alternatives to Vim</title>
|
---|
[ef13657] | 29 | <para>If you prefer another editor -- like Emacs, Joe, or Nano --
|
---|
| 30 | please refer to <ulink url="&blfs-root;view/stable/postlfs/editors.html"/> for
|
---|
[35c2fa60] | 31 | suggested installation instructions.</para>
|
---|
[df8334f] | 32 | </tip>
|
---|
[35c2fa60] | 33 | </sect2>
|
---|
| 34 |
|
---|
[a001133] | 35 | <sect2 role="installation">
|
---|
[73aedd1d] | 36 | <title>Installation of Vim</title>
|
---|
| 37 |
|
---|
[b5b61fd] | 38 | <para>First, unpack both
|
---|
| 39 | <filename>vim-&vim-version;.tar.bz2</filename> and (optionally)
|
---|
[ef13657] | 40 | <filename>vim-&vim-version;-lang.tar.gz</filename> archives into the
|
---|
| 41 | same directory. Then change the default locations of the
|
---|
| 42 | <filename>vimrc</filename> and <filename>gvimrc</filename>
|
---|
| 43 | configuration files to <filename
|
---|
| 44 | class="directory">/etc</filename>:</para>
|
---|
[73aedd1d] | 45 |
|
---|
| 46 | <screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
|
---|
| 47 | echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h</userinput></screen>
|
---|
| 48 |
|
---|
[ef13657] | 49 | <para>Prepare Vim for compilation:</para>
|
---|
[73aedd1d] | 50 |
|
---|
[c3d6ceb] | 51 | <screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
[73aedd1d] | 52 |
|
---|
[b5b61fd] | 53 | <para>The optional but highly recommended
|
---|
[ef13657] | 54 | <parameter>--enable-multibyte</parameter> switch includes support for
|
---|
| 55 | editing files in multibyte character encodings into
|
---|
| 56 | <command>vim</command>. This is needed if the recommendation was not
|
---|
| 57 | heeded to not to use LFS in locales with multibyte character sets.
|
---|
| 58 | This switch is also helpful to be able to edit text files initially
|
---|
| 59 | created in Linux distributions like Fedora Core that use UTF-8 as a
|
---|
| 60 | default character set.</para>
|
---|
[dc32fef] | 61 |
|
---|
[73aedd1d] | 62 | <para>Compile the package:</para>
|
---|
| 63 |
|
---|
| 64 | <screen><userinput>make</userinput></screen>
|
---|
| 65 |
|
---|
[673b0d8] | 66 | <para>To test the results, you can issue:
|
---|
[ef13657] | 67 | <userinput>make test</userinput>. However, this test suite outputs a
|
---|
| 68 | lot of chaotic characters to the screen, which can cause issues with
|
---|
| 69 | the settings of the current terminal. Therefore, running the test
|
---|
| 70 | suite here is strictly optional.</para>
|
---|
[1a73ed4] | 71 |
|
---|
[ef13657] | 72 | <para>Install the package:</para>
|
---|
[73aedd1d] | 73 |
|
---|
| 74 | <screen><userinput>make install</userinput></screen>
|
---|
| 75 |
|
---|
[673b0d8] | 76 | <para>Many users are used to using <command>vi</command>, instead of
|
---|
[ef13657] | 77 | <command>vim</command>. To allow execution of <command>vim</command>
|
---|
| 78 | when they habitually enter <command>vi</command>, create a
|
---|
| 79 | symlink:</para>
|
---|
[73aedd1d] | 80 |
|
---|
| 81 | <screen><userinput>ln -s vim /usr/bin/vi</userinput></screen>
|
---|
| 82 |
|
---|
[ef13657] | 83 | <para>If the X Window system is going to be installed on the LFS
|
---|
| 84 | system, it may be necessary to re-compile Vim after installing X. Vim
|
---|
| 85 | comes with a GUI version of the editor that requires X and some
|
---|
| 86 | additional libraries to be installed. For more information on this
|
---|
| 87 | process, refer to the Vim documentation.</para>
|
---|
[73aedd1d] | 88 |
|
---|
| 89 | </sect2>
|
---|
[0ba2766b] | 90 |
|
---|
[df8334f] | 91 | <sect2 id="conf-vim" role="configuration"><title>Configuring Vim</title>
|
---|
[673b0d8] | 92 | <indexterm zone="conf-vim"><primary sortas="e-/etc/vim">/etc/vim</primary></indexterm>
|
---|
[342b176] | 93 |
|
---|
[ef13657] | 94 | <para>By default, <command>vim</command> runs in vi-incompatible mode.
|
---|
| 95 | This may be new to users who have used other editors in the past. The
|
---|
| 96 | <quote>nocompatible</quote> setting is included below to highlight the
|
---|
| 97 | fact that a new behavior is being used. It also reminds those who
|
---|
| 98 | would change to <quote>compatible</quote> mode that it should appear
|
---|
| 99 | first. This is necessary because it changes other settings, and
|
---|
| 100 | overrides must come after this setting. Create a default vim
|
---|
| 101 | configuration file by running the following:</para>
|
---|
[342b176] | 102 |
|
---|
[8ad7980] | 103 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
[342b176] | 104 | " Begin /etc/vimrc
|
---|
| 105 |
|
---|
| 106 | set nocompatible
|
---|
| 107 | set backspace=2
|
---|
| 108 | syntax on
|
---|
[3e05705] | 109 | if (&term == "iterm") || (&term == "putty")
|
---|
| 110 | set background=dark
|
---|
| 111 | endif
|
---|
[342b176] | 112 |
|
---|
| 113 | " End /etc/vimrc
|
---|
[8ad7980] | 114 | EOF</userinput></screen>
|
---|
[342b176] | 115 |
|
---|
[8ad7980] | 116 | <para>The <parameter>set nocompatible</parameter> makes
|
---|
[ef13657] | 117 | <command>vim</command> behave in a more useful way (the default) than
|
---|
| 118 | the vi-compatible manner. Remove the <quote>no</quote> if you want the
|
---|
| 119 | old <command>vi</command> behavior. The <parameter>set
|
---|
| 120 | backspace=2</parameter> allows backspacing over line breaks,
|
---|
| 121 | autoindents, and the start of insert. The <parameter>syntax
|
---|
| 122 | on</parameter> enables vim's syntax highlighting. Finally, the
|
---|
| 123 | <parameter>if</parameter> statement with the <parameter>set
|
---|
| 124 | background=dark</parameter> corrects <command>vim</command>'s guess
|
---|
| 125 | about the background color of some terminal emulators. This gives the
|
---|
| 126 | highlighting a better color scheme for use on the black background of
|
---|
| 127 | these programs.</para>
|
---|
| 128 |
|
---|
| 129 | <para>Documentation for other available options can be obtained by
|
---|
| 130 | running the following command:</para>
|
---|
[dc32fef] | 131 |
|
---|
| 132 | <screen><userinput>vim -c ':options'</userinput></screen>
|
---|
| 133 |
|
---|
[342b176] | 134 | </sect2>
|
---|
[0ba2766b] | 135 |
|
---|
[c6cb3aa] | 136 | <sect2 id="contents-vim" role="content"><title>Contents of Vim</title>
|
---|
[673b0d8] | 137 |
|
---|
[c6cb3aa] | 138 | <segmentedlist>
|
---|
| 139 | <segtitle>Installed programs</segtitle>
|
---|
| 140 | <seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
|
---|
| 141 | pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim),
|
---|
| 142 | view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh,
|
---|
| 143 | vimtutor and xxd</seg></seglistitem>
|
---|
| 144 | </segmentedlist>
|
---|
[673b0d8] | 145 |
|
---|
[3ed279f] | 146 | <variablelist><bridgehead renderas="sect3">Short descriptions</bridgehead>
|
---|
| 147 | <?dbfo list-presentation="list"?>
|
---|
[673b0d8] | 148 |
|
---|
[b8a819f] | 149 | <varlistentry id="efm_filter.pl">
|
---|
| 150 | <term><command>efm_filter.pl</command></term>
|
---|
[c6cb3aa] | 151 | <listitem>
|
---|
[ef13657] | 152 | <para>a filter for creating an error file that can be read by <command>vim</command>.</para>
|
---|
[3ed279f] | 153 | <indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
|
---|
[c6cb3aa] | 154 | </listitem>
|
---|
| 155 | </varlistentry>
|
---|
[673b0d8] | 156 |
|
---|
[b8a819f] | 157 | <varlistentry id="efm_perl.pl">
|
---|
| 158 | <term><command>efm_perl.pl</command></term>
|
---|
[c6cb3aa] | 159 | <listitem>
|
---|
| 160 | <para>reformats the error messages of the
|
---|
[8ad7980] | 161 | Perl interpreter for use with the <quote>quickfix</quote> mode of <command>vim</command>.</para>
|
---|
[3ed279f] | 162 | <indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
|
---|
[c6cb3aa] | 163 | </listitem>
|
---|
| 164 | </varlistentry>
|
---|
[673b0d8] | 165 |
|
---|
[b8a819f] | 166 | <varlistentry id="ex">
|
---|
| 167 | <term><command>ex</command></term>
|
---|
[c6cb3aa] | 168 | <listitem>
|
---|
[8ad7980] | 169 | <para>starts <command>vim</command> in ex mode.</para>
|
---|
[3ed279f] | 170 | <indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
|
---|
[c6cb3aa] | 171 | </listitem>
|
---|
| 172 | </varlistentry>
|
---|
[673b0d8] | 173 |
|
---|
[b8a819f] | 174 | <varlistentry id="less.sh">
|
---|
| 175 | <term><command>less.sh</command></term>
|
---|
[c6cb3aa] | 176 | <listitem>
|
---|
[ef13657] | 177 | <para>a script that starts <command>vim</command> with less.vim.</para>
|
---|
[3ed279f] | 178 | <indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
|
---|
[c6cb3aa] | 179 | </listitem>
|
---|
| 180 | </varlistentry>
|
---|
[673b0d8] | 181 |
|
---|
[b8a819f] | 182 | <varlistentry id="mve.awk">
|
---|
| 183 | <term><command>mve.awk</command></term>
|
---|
[c6cb3aa] | 184 | <listitem>
|
---|
[8ad7980] | 185 | <para>processes <command>vim</command> errors.</para>
|
---|
[3ed279f] | 186 | <indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
|
---|
[c6cb3aa] | 187 | </listitem>
|
---|
| 188 | </varlistentry>
|
---|
[673b0d8] | 189 |
|
---|
[b8a819f] | 190 | <varlistentry id="pltags.pl">
|
---|
| 191 | <term><command>pltags.pl</command></term>
|
---|
[c6cb3aa] | 192 | <listitem>
|
---|
[8ad7980] | 193 | <para>creates a tags file for Perl code, for use by <command>vim</command>.</para>
|
---|
[3ed279f] | 194 | <indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
|
---|
[c6cb3aa] | 195 | </listitem>
|
---|
| 196 | </varlistentry>
|
---|
[673b0d8] | 197 |
|
---|
[b8a819f] | 198 | <varlistentry id="ref">
|
---|
| 199 | <term><command>ref</command></term>
|
---|
[c6cb3aa] | 200 | <listitem>
|
---|
| 201 | <para>checks the spelling of arguments.</para>
|
---|
[3ed279f] | 202 | <indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
|
---|
[c6cb3aa] | 203 | </listitem>
|
---|
| 204 | </varlistentry>
|
---|
[673b0d8] | 205 |
|
---|
[b8a819f] | 206 | <varlistentry id="rview">
|
---|
| 207 | <term><command>rview</command></term>
|
---|
[c6cb3aa] | 208 | <listitem>
|
---|
[8ad7980] | 209 | <para>is a restricted version of <command>view</command>: no shell
|
---|
[ef13657] | 210 | commands can be started and <command>view</command> cannot be suspended.</para>
|
---|
[3ed279f] | 211 | <indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
|
---|
[c6cb3aa] | 212 | </listitem>
|
---|
| 213 | </varlistentry>
|
---|
[673b0d8] | 214 |
|
---|
[b8a819f] | 215 | <varlistentry id="rvim">
|
---|
| 216 | <term><command>rvim</command></term>
|
---|
[c6cb3aa] | 217 | <listitem>
|
---|
[8ad7980] | 218 | <para>is a restricted version of <command>vim</command>: no shell
|
---|
[ef13657] | 219 | commands can be started and <command>vim</command> cannot be suspended.</para>
|
---|
[3ed279f] | 220 | <indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
|
---|
[c6cb3aa] | 221 | </listitem>
|
---|
| 222 | </varlistentry>
|
---|
[73aedd1d] | 223 |
|
---|
[b8a819f] | 224 | <varlistentry id="shtags.pl">
|
---|
| 225 | <term><command>shtags.pl</command></term>
|
---|
[c6cb3aa] | 226 | <listitem>
|
---|
[8ad7980] | 227 | <para>generates a tag file for Perl scripts.</para>
|
---|
[3ed279f] | 228 | <indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
|
---|
[c6cb3aa] | 229 | </listitem>
|
---|
| 230 | </varlistentry>
|
---|
[673b0d8] | 231 |
|
---|
[b8a819f] | 232 | <varlistentry id="tcltags">
|
---|
| 233 | <term><command>tcltags</command></term>
|
---|
[c6cb3aa] | 234 | <listitem>
|
---|
| 235 | <para>generates a tag file for TCL code.</para>
|
---|
[3ed279f] | 236 | <indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
|
---|
[c6cb3aa] | 237 | </listitem>
|
---|
| 238 | </varlistentry>
|
---|
[673b0d8] | 239 |
|
---|
[b8a819f] | 240 | <varlistentry id="view">
|
---|
| 241 | <term><command>view</command></term>
|
---|
[c6cb3aa] | 242 | <listitem>
|
---|
[8ad7980] | 243 | <para>starts <command>vim</command> in read-only mode.</para>
|
---|
[3ed279f] | 244 | <indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
|
---|
[c6cb3aa] | 245 | </listitem>
|
---|
| 246 | </varlistentry>
|
---|
[673b0d8] | 247 |
|
---|
[b8a819f] | 248 | <varlistentry id="vim">
|
---|
| 249 | <term><command>vim</command></term>
|
---|
[c6cb3aa] | 250 | <listitem>
|
---|
| 251 | <para>is the editor.</para>
|
---|
[3ed279f] | 252 | <indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
|
---|
[c6cb3aa] | 253 | </listitem>
|
---|
| 254 | </varlistentry>
|
---|
[673b0d8] | 255 |
|
---|
[b8a819f] | 256 | <varlistentry id="vim132">
|
---|
| 257 | <term><command>vim132</command></term>
|
---|
[c6cb3aa] | 258 | <listitem>
|
---|
[8ad7980] | 259 | <para>starts <command>vim</command> with the terminal in 132-column mode.</para>
|
---|
[3ed279f] | 260 | <indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
|
---|
[c6cb3aa] | 261 | </listitem>
|
---|
| 262 | </varlistentry>
|
---|
[673b0d8] | 263 |
|
---|
[b8a819f] | 264 | <varlistentry id="vim2html.pl">
|
---|
| 265 | <term><command>vim2html.pl</command></term>
|
---|
[c6cb3aa] | 266 | <listitem>
|
---|
[8ad7980] | 267 | <para>converts Vim documentation to HTML.</para>
|
---|
[3ed279f] | 268 | <indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
|
---|
[c6cb3aa] | 269 | </listitem>
|
---|
| 270 | </varlistentry>
|
---|
[673b0d8] | 271 |
|
---|
[b8a819f] | 272 | <varlistentry id="vimdiff">
|
---|
| 273 | <term><command>vimdiff</command></term>
|
---|
[c6cb3aa] | 274 | <listitem>
|
---|
[8ad7980] | 275 | <para>edits two or three versions of a file with <command>vim</command> and show differences.</para>
|
---|
[3ed279f] | 276 | <indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
|
---|
[c6cb3aa] | 277 | </listitem>
|
---|
| 278 | </varlistentry>
|
---|
[673b0d8] | 279 |
|
---|
[b8a819f] | 280 | <varlistentry id="vimm">
|
---|
| 281 | <term><command>vimm</command></term>
|
---|
[c6cb3aa] | 282 | <listitem>
|
---|
| 283 | <para>enables the DEC locator input model on a remote terminal.</para>
|
---|
[3ed279f] | 284 | <indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
|
---|
[c6cb3aa] | 285 | </listitem>
|
---|
| 286 | </varlistentry>
|
---|
[673b0d8] | 287 |
|
---|
[b8a819f] | 288 | <varlistentry id="vimspell.sh">
|
---|
| 289 | <term><command>vimspell.sh</command></term>
|
---|
[c6cb3aa] | 290 | <listitem>
|
---|
[ef13657] | 291 | <para>a script which spells a file and generates the syntax statements necessary
|
---|
[8ad7980] | 292 | to highlight in <command>vim</command>. This script requires the old Unix <command>spell</command>
|
---|
[c6cb3aa] | 293 | command, which is provided neither in LFS nor in BLFS.</para>
|
---|
[3ed279f] | 294 | <indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
|
---|
[c6cb3aa] | 295 | </listitem>
|
---|
| 296 | </varlistentry>
|
---|
| 297 |
|
---|
[b8a819f] | 298 | <varlistentry id="vimtutor">
|
---|
| 299 | <term><command>vimtutor</command></term>
|
---|
[c6cb3aa] | 300 | <listitem>
|
---|
[8ad7980] | 301 | <para>teaches you the basic keys and commands of <command>vim</command>.</para>
|
---|
[3ed279f] | 302 | <indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
|
---|
[c6cb3aa] | 303 | </listitem>
|
---|
| 304 | </varlistentry>
|
---|
[673b0d8] | 305 |
|
---|
[b8a819f] | 306 | <varlistentry id="xxd">
|
---|
| 307 | <term><command>xxd</command></term>
|
---|
[c6cb3aa] | 308 | <listitem>
|
---|
[ef13657] | 309 | <para>creates a hex dump of the given file. It can
|
---|
[673b0d8] | 310 | also do the reverse, so it can be used for binary patching.</para>
|
---|
[3ed279f] | 311 | <indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
|
---|
[c6cb3aa] | 312 | </listitem>
|
---|
| 313 | </varlistentry>
|
---|
| 314 | </variablelist>
|
---|
[673b0d8] | 315 |
|
---|
| 316 | </sect2>
|
---|
| 317 |
|
---|
| 318 | </sect1>
|
---|
[ef13657] | 319 |
|
---|