[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>
|
---|
| 29 | <para>If you prefer another editor -- like Emacs, Joe, or Nano -- to Vim,
|
---|
[f861982] | 30 | have a look at <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)
|
---|
| 40 | <filename>vim-&vim-version;-lang.tar.gz</filename> archives into the same
|
---|
| 41 | directory. Then change the default locations of the <filename>vimrc</filename> and
|
---|
[673b0d8] | 42 | <filename>gvimrc</filename> configuration files to <filename class="directory">/etc</filename>.</para>
|
---|
[73aedd1d] | 43 |
|
---|
| 44 | <screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
|
---|
| 45 | echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h</userinput></screen>
|
---|
| 46 |
|
---|
| 47 | <para>Now prepare Vim for compilation:</para>
|
---|
| 48 |
|
---|
[c3d6ceb] | 49 | <screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
[73aedd1d] | 50 |
|
---|
[b5b61fd] | 51 | <para>The optional but highly recommended
|
---|
[8ad7980] | 52 | <parameter>--enable-multibyte</parameter> switch
|
---|
[b5b61fd] | 53 | includes support for editing files in multibyte character encodings into
|
---|
[3546862] | 54 | <command>vim</command>.
|
---|
| 55 | It is needed for those people who ignore our recommendation not to
|
---|
[b5b61fd] | 56 | use LFS in locales with multibyte character sets. It is also needed for
|
---|
| 57 | people who want to be able to edit text files initially created
|
---|
| 58 | in Linux distributions like Fedora Core
|
---|
| 59 | that use UTF-8 as a default character set.</para>
|
---|
[dc32fef] | 60 |
|
---|
[73aedd1d] | 61 | <para>Compile the package:</para>
|
---|
| 62 |
|
---|
| 63 | <screen><userinput>make</userinput></screen>
|
---|
| 64 |
|
---|
[673b0d8] | 65 | <para>To test the results, you can issue:
|
---|
[9dfc02f] | 66 | <userinput>make test</userinput>. However, this test suite outputs a lot of
|
---|
[8a5f906] | 67 | seemingly garbage characters to the screen, and this can wreak havoc with the
|
---|
[db9d773c] | 68 | settings of the current terminal. Therefore the running of the test suite here
|
---|
| 69 | is strictly optional.</para>
|
---|
[1a73ed4] | 70 |
|
---|
[673b0d8] | 71 | <para>Now install the package:</para>
|
---|
[73aedd1d] | 72 |
|
---|
| 73 | <screen><userinput>make install</userinput></screen>
|
---|
| 74 |
|
---|
[673b0d8] | 75 | <para>Many users are used to using <command>vi</command>, instead of
|
---|
| 76 | <command>vim</command>. To let them execute <command>vim</command> when
|
---|
| 77 | they habitually enter <command>vi</command>, create a symlink:</para>
|
---|
[73aedd1d] | 78 |
|
---|
| 79 | <screen><userinput>ln -s vim /usr/bin/vi</userinput></screen>
|
---|
| 80 |
|
---|
[0ba2766b] | 81 | <para>If you are going to install the X Window system on your LFS system, you
|
---|
| 82 | may want to re-compile Vim after having installed X. Vim comes with a nice GUI
|
---|
| 83 | version of the editor that requires X and a few other libraries to be
|
---|
| 84 | installed. For more information read the Vim documentation.</para>
|
---|
[73aedd1d] | 85 |
|
---|
| 86 | </sect2>
|
---|
[0ba2766b] | 87 |
|
---|
[342b176] | 88 |
|
---|
[df8334f] | 89 | <sect2 id="conf-vim" role="configuration"><title>Configuring Vim</title>
|
---|
[673b0d8] | 90 | <indexterm zone="conf-vim"><primary sortas="e-/etc/vim">/etc/vim</primary></indexterm>
|
---|
[342b176] | 91 |
|
---|
[673b0d8] | 92 | <para>By default, <command>vim</command> runs in vi-incompatible mode. Some
|
---|
| 93 | people might not like this, but we prefer to run <command>vim</command> in its
|
---|
[342b176] | 94 | own mode (else we wouldn't have included it in this book, but the original
|
---|
[8ad7980] | 95 | <command>vi</command>). We've included the setting of <quote>nocompatible</quote>
|
---|
[673b0d8] | 96 | below to high-light the fact that the new behavior is being used. It
|
---|
[8ad7980] | 97 | also reminds those who would change to <quote>compatible</quote> mode that it should
|
---|
[673b0d8] | 98 | appear first because it changes other settings and overrides must come
|
---|
| 99 | after this setting. Create a default vim configuration file by running
|
---|
[342b176] | 100 | the following:</para>
|
---|
| 101 |
|
---|
[8ad7980] | 102 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
[342b176] | 103 | " Begin /etc/vimrc
|
---|
| 104 |
|
---|
| 105 | set nocompatible
|
---|
| 106 | set backspace=2
|
---|
| 107 | syntax on
|
---|
[8ad7980] | 108 | <!-- set fileencodings=ucs-bom,utf-8,<replaceable>[your-8-bit-charset]</replaceable> -->
|
---|
[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
|
---|
[673b0d8] | 117 | <command>vim</command> behave in a more useful way (the default) than the
|
---|
[8ad7980] | 118 | vi-compatible manner. Remove the <quote>no</quote> if you want the old <command>vi</command>
|
---|
| 119 | behavior. The <parameter>set backspace=2</parameter> allows
|
---|
[673b0d8] | 120 | backspacing over line breaks, autoindents and the start of insert. The
|
---|
[8ad7980] | 121 | <parameter>syntax on</parameter> enables <command>vim</command>'s
|
---|
[56f967e] | 122 | syntax highliting.
|
---|
| 123 | <!-- XXX: the ascii-only files are considered to be in utf-8 - that's not what
|
---|
| 124 | one expects . That's why fileencodings stuff is commented out for now
|
---|
| 125 |
|
---|
[8ad7980] | 126 | The <parameter>set fileencodings=...</parameter> makes
|
---|
[3546862] | 127 | <command>vim</command> capable of automatically detecting the character
|
---|
| 128 | set of the file being edited (replace
|
---|
[8ad7980] | 129 | "<replaceable>[your-8-bit-charset]</replaceable>"
|
---|
[3546862] | 130 | with the value appropriate for your country, e.g. iso-8859-15 in Italy).
|
---|
| 131 | This line is useful because bleeding-edge distributions
|
---|
[b5b61fd] | 132 | like Fedora Core use UTF-8, and conservative ones like Debian
|
---|
| 133 | use traditional 8-bit encodings for text files. If you have not
|
---|
[8ad7980] | 134 | passed the <parameter>- -enable-multibyte</parameter> switch to the
|
---|
[56f967e] | 135 | <command>./configure</command> command above, this line will not work. -->
|
---|
[3e05705] | 136 | Finally, the <emphasis>if</emphasis> statement with the
|
---|
[8ad7980] | 137 | <parameter>set background=dark</parameter> corrects <command>vim</command>'s
|
---|
[3e05705] | 138 | guess about the background color of some terminal emulators. This gives the
|
---|
| 139 | highliting a better color scheme for use on the black background of
|
---|
| 140 | these programs.
|
---|
[b5b61fd] | 141 | </para>
|
---|
[342b176] | 142 |
|
---|
[dc32fef] | 143 | <para>Documentation for other available options can be obtained by running
|
---|
| 144 | the following command:</para>
|
---|
| 145 |
|
---|
| 146 | <screen><userinput>vim -c ':options'</userinput></screen>
|
---|
| 147 |
|
---|
[342b176] | 148 | </sect2>
|
---|
[0ba2766b] | 149 |
|
---|
[5888299] | 150 |
|
---|
[c6cb3aa] | 151 | <sect2 id="contents-vim" role="content"><title>Contents of Vim</title>
|
---|
[673b0d8] | 152 |
|
---|
[c6cb3aa] | 153 | <segmentedlist>
|
---|
| 154 | <segtitle>Installed programs</segtitle>
|
---|
| 155 | <seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
|
---|
| 156 | pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim),
|
---|
| 157 | view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh,
|
---|
| 158 | vimtutor and xxd</seg></seglistitem>
|
---|
| 159 | </segmentedlist>
|
---|
[673b0d8] | 160 |
|
---|
[c6cb3aa] | 161 | <variablelist><title>Short descriptions</title>
|
---|
[673b0d8] | 162 |
|
---|
[b8a819f] | 163 | <varlistentry id="efm_filter.pl">
|
---|
| 164 | <term><command>efm_filter.pl</command></term>
|
---|
[c6cb3aa] | 165 | <listitem>
|
---|
[673b0d8] | 166 | <indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
|
---|
[8ad7980] | 167 | <para>is a filter for creating an error file that can be read by <command>vim</command>.</para>
|
---|
[c6cb3aa] | 168 | </listitem>
|
---|
| 169 | </varlistentry>
|
---|
[673b0d8] | 170 |
|
---|
[b8a819f] | 171 | <varlistentry id="efm_perl.pl">
|
---|
| 172 | <term><command>efm_perl.pl</command></term>
|
---|
[c6cb3aa] | 173 | <listitem>
|
---|
[673b0d8] | 174 | <indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
|
---|
[c6cb3aa] | 175 | <para>reformats the error messages of the
|
---|
[8ad7980] | 176 | Perl interpreter for use with the <quote>quickfix</quote> mode of <command>vim</command>.</para>
|
---|
[c6cb3aa] | 177 | </listitem>
|
---|
| 178 | </varlistentry>
|
---|
[673b0d8] | 179 |
|
---|
[b8a819f] | 180 | <varlistentry id="ex">
|
---|
| 181 | <term><command>ex</command></term>
|
---|
[c6cb3aa] | 182 | <listitem>
|
---|
[673b0d8] | 183 | <indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
|
---|
[8ad7980] | 184 | <para>starts <command>vim</command> in ex mode.</para>
|
---|
[c6cb3aa] | 185 | </listitem>
|
---|
| 186 | </varlistentry>
|
---|
[673b0d8] | 187 |
|
---|
[b8a819f] | 188 | <varlistentry id="less.sh">
|
---|
| 189 | <term><command>less.sh</command></term>
|
---|
[c6cb3aa] | 190 | <listitem>
|
---|
[673b0d8] | 191 | <indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
|
---|
[8ad7980] | 192 | <para>is a script that starts <command>vim</command> with less.vim.</para>
|
---|
[c6cb3aa] | 193 | </listitem>
|
---|
| 194 | </varlistentry>
|
---|
[673b0d8] | 195 |
|
---|
[b8a819f] | 196 | <varlistentry id="mve.awk">
|
---|
| 197 | <term><command>mve.awk</command></term>
|
---|
[c6cb3aa] | 198 | <listitem>
|
---|
[673b0d8] | 199 | <indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
|
---|
[8ad7980] | 200 | <para>processes <command>vim</command> errors.</para>
|
---|
[c6cb3aa] | 201 | </listitem>
|
---|
| 202 | </varlistentry>
|
---|
[673b0d8] | 203 |
|
---|
[b8a819f] | 204 | <varlistentry id="pltags.pl">
|
---|
| 205 | <term><command>pltags.pl</command></term>
|
---|
[c6cb3aa] | 206 | <listitem>
|
---|
[673b0d8] | 207 | <indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
|
---|
[8ad7980] | 208 | <para>creates a tags file for Perl code, for use by <command>vim</command>.</para>
|
---|
[c6cb3aa] | 209 | </listitem>
|
---|
| 210 | </varlistentry>
|
---|
[673b0d8] | 211 |
|
---|
[b8a819f] | 212 | <varlistentry id="ref">
|
---|
| 213 | <term><command>ref</command></term>
|
---|
[c6cb3aa] | 214 | <listitem>
|
---|
[673b0d8] | 215 | <indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
|
---|
[c6cb3aa] | 216 | <para>checks the spelling of arguments.</para>
|
---|
| 217 | </listitem>
|
---|
| 218 | </varlistentry>
|
---|
[673b0d8] | 219 |
|
---|
[b8a819f] | 220 | <varlistentry id="rview">
|
---|
| 221 | <term><command>rview</command></term>
|
---|
[c6cb3aa] | 222 | <listitem>
|
---|
[673b0d8] | 223 | <indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
|
---|
[8ad7980] | 224 | <para>is a restricted version of <command>view</command>: no shell
|
---|
| 225 | commands can be started and <command>view</command> can't be suspended.</para>
|
---|
[c6cb3aa] | 226 | </listitem>
|
---|
| 227 | </varlistentry>
|
---|
[673b0d8] | 228 |
|
---|
[b8a819f] | 229 | <varlistentry id="rvim">
|
---|
| 230 | <term><command>rvim</command></term>
|
---|
[c6cb3aa] | 231 | <listitem>
|
---|
[673b0d8] | 232 | <indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
|
---|
[8ad7980] | 233 | <para>is a restricted version of <command>vim</command>: no shell
|
---|
| 234 | commands can be started and <command>vim</command> can't be suspended.</para>
|
---|
[c6cb3aa] | 235 | </listitem>
|
---|
| 236 | </varlistentry>
|
---|
[73aedd1d] | 237 |
|
---|
[b8a819f] | 238 | <varlistentry id="shtags.pl">
|
---|
| 239 | <term><command>shtags.pl</command></term>
|
---|
[c6cb3aa] | 240 | <listitem>
|
---|
[673b0d8] | 241 | <indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
|
---|
[8ad7980] | 242 | <para>generates a tag file for Perl scripts.</para>
|
---|
[c6cb3aa] | 243 | </listitem>
|
---|
| 244 | </varlistentry>
|
---|
[673b0d8] | 245 |
|
---|
[b8a819f] | 246 | <varlistentry id="tcltags">
|
---|
| 247 | <term><command>tcltags</command></term>
|
---|
[c6cb3aa] | 248 | <listitem>
|
---|
[673b0d8] | 249 | <indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
|
---|
[c6cb3aa] | 250 | <para>generates a tag file for TCL code.</para>
|
---|
| 251 | </listitem>
|
---|
| 252 | </varlistentry>
|
---|
[673b0d8] | 253 |
|
---|
[b8a819f] | 254 | <varlistentry id="view">
|
---|
| 255 | <term><command>view</command></term>
|
---|
[c6cb3aa] | 256 | <listitem>
|
---|
[673b0d8] | 257 | <indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
|
---|
[8ad7980] | 258 | <para>starts <command>vim</command> in read-only mode.</para>
|
---|
[c6cb3aa] | 259 | </listitem>
|
---|
| 260 | </varlistentry>
|
---|
[673b0d8] | 261 |
|
---|
[b8a819f] | 262 | <varlistentry id="vim">
|
---|
| 263 | <term><command>vim</command></term>
|
---|
[c6cb3aa] | 264 | <listitem>
|
---|
[673b0d8] | 265 | <indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
|
---|
[c6cb3aa] | 266 | <para>is the editor.</para>
|
---|
| 267 | </listitem>
|
---|
| 268 | </varlistentry>
|
---|
[673b0d8] | 269 |
|
---|
[b8a819f] | 270 | <varlistentry id="vim132">
|
---|
| 271 | <term><command>vim132</command></term>
|
---|
[c6cb3aa] | 272 | <listitem>
|
---|
[673b0d8] | 273 | <indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
|
---|
[8ad7980] | 274 | <para>starts <command>vim</command> with the terminal in 132-column mode.</para>
|
---|
[c6cb3aa] | 275 | </listitem>
|
---|
| 276 | </varlistentry>
|
---|
[673b0d8] | 277 |
|
---|
[b8a819f] | 278 | <varlistentry id="vim2html.pl">
|
---|
| 279 | <term><command>vim2html.pl</command></term>
|
---|
[c6cb3aa] | 280 | <listitem>
|
---|
[673b0d8] | 281 | <indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
|
---|
[8ad7980] | 282 | <para>converts Vim documentation to HTML.</para>
|
---|
[c6cb3aa] | 283 | </listitem>
|
---|
| 284 | </varlistentry>
|
---|
[673b0d8] | 285 |
|
---|
[b8a819f] | 286 | <varlistentry id="vimdiff">
|
---|
| 287 | <term><command>vimdiff</command></term>
|
---|
[c6cb3aa] | 288 | <listitem>
|
---|
[673b0d8] | 289 | <indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
|
---|
[8ad7980] | 290 | <para>edits two or three versions of a file with <command>vim</command> and show differences.</para>
|
---|
[c6cb3aa] | 291 | </listitem>
|
---|
| 292 | </varlistentry>
|
---|
[673b0d8] | 293 |
|
---|
[b8a819f] | 294 | <varlistentry id="vimm">
|
---|
| 295 | <term><command>vimm</command></term>
|
---|
[c6cb3aa] | 296 | <listitem>
|
---|
[673b0d8] | 297 | <indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
|
---|
[c6cb3aa] | 298 | <para>enables the DEC locator input model on a remote terminal.</para>
|
---|
| 299 | </listitem>
|
---|
| 300 | </varlistentry>
|
---|
[673b0d8] | 301 |
|
---|
[b8a819f] | 302 | <varlistentry id="vimspell.sh">
|
---|
| 303 | <term><command>vimspell.sh</command></term>
|
---|
[c6cb3aa] | 304 | <listitem>
|
---|
[673b0d8] | 305 | <indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
|
---|
[c6cb3aa] | 306 | <para>is a script which spells a file and generates the syntax statements necessary
|
---|
[8ad7980] | 307 | to highlight in <command>vim</command>. This script requires the old Unix <command>spell</command>
|
---|
[c6cb3aa] | 308 | command, which is provided neither in LFS nor in BLFS.</para>
|
---|
| 309 | </listitem>
|
---|
| 310 | </varlistentry>
|
---|
| 311 |
|
---|
[b8a819f] | 312 | <varlistentry id="vimtutor">
|
---|
| 313 | <term><command>vimtutor</command></term>
|
---|
[c6cb3aa] | 314 | <listitem>
|
---|
[673b0d8] | 315 | <indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
|
---|
[8ad7980] | 316 | <para>teaches you the basic keys and commands of <command>vim</command>.</para>
|
---|
[c6cb3aa] | 317 | </listitem>
|
---|
| 318 | </varlistentry>
|
---|
[673b0d8] | 319 |
|
---|
[b8a819f] | 320 | <varlistentry id="xxd">
|
---|
| 321 | <term><command>xxd</command></term>
|
---|
[c6cb3aa] | 322 | <listitem>
|
---|
[673b0d8] | 323 | <indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
|
---|
[c6cb3aa] | 324 | <para>makes a hex dump of the given file. It can
|
---|
[673b0d8] | 325 | also do the reverse, so it can be used for binary patching.</para>
|
---|
[c6cb3aa] | 326 | </listitem>
|
---|
| 327 | </varlistentry>
|
---|
| 328 | </variablelist>
|
---|
[673b0d8] | 329 |
|
---|
| 330 | </sect2>
|
---|
| 331 |
|
---|
| 332 | </sect1>
|
---|