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