[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[1770019] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[673b0d8] | 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[81fd230] | 6 | <sect1 id="ch-system-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/>
|
---|
[81fd230] | 13 | <para>The Vim package contains a powerful text editor.</para>
|
---|
[5888299] | 14 |
|
---|
[a001133] | 15 | <segmentedlist>
|
---|
| 16 | <segtitle>&buildtime;</segtitle>
|
---|
| 17 | <segtitle>&diskspace;</segtitle>
|
---|
[eb6d9eb] | 18 | <seglistitem><seg>0.4 SBU</seg><seg>38.0 MB</seg></seglistitem>
|
---|
[a001133] | 19 | </segmentedlist>
|
---|
| 20 |
|
---|
[81fd230] | 21 | <segmentedlist>
|
---|
[45992ae] | 22 | <segtitle>&dependencies;</segtitle>
|
---|
[81fd230] | 23 | <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils,
|
---|
| 24 | GCC, Glibc, Grep, Make, Ncurses, and Sed</seg></seglistitem>
|
---|
| 25 | </segmentedlist>
|
---|
| 26 |
|
---|
| 27 | <tip>
|
---|
| 28 | <title>Alternatives to Vim</title>
|
---|
| 29 | <para>If you prefer another editor—such as Emacs, Joe, or
|
---|
| 30 | Nano—please refer to <ulink url="&blfs-root;view/svn/postlfs/editors.html"/>
|
---|
| 31 | for suggested installation instructions.</para>
|
---|
| 32 | </tip>
|
---|
[35c2fa60] | 33 | </sect2>
|
---|
| 34 |
|
---|
[a001133] | 35 | <sect2 role="installation">
|
---|
[73aedd1d] | 36 | <title>Installation of Vim</title>
|
---|
| 37 |
|
---|
[81fd230] | 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
|
---|
[62c3dff] | 41 | same directory. Then, change the default location of the
|
---|
[f7ea35e] | 42 | <filename>vimrc</filename> configuration file to <filename
|
---|
[81fd230] | 43 | class="directory">/etc</filename>:</para>
|
---|
[73aedd1d] | 44 |
|
---|
[15966d9] | 45 | <screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
---|
[008a51d] | 46 |
|
---|
[73aedd1d] | 47 | <para>Now prepare Vim for compilation:</para>
|
---|
| 48 |
|
---|
[c3d6ceb] | 49 | <screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
[73aedd1d] | 50 |
|
---|
[06948c1] | 51 | <para>The meaning of the configure options:</para>
|
---|
| 52 |
|
---|
| 53 | <variablelist>
|
---|
| 54 | <varlistentry>
|
---|
| 55 | <term><parameter>--enable-multibyte</parameter></term>
|
---|
[46a2e9c] | 56 | <listitem><para>This switch enables support for
|
---|
[06948c1] | 57 | editing files in multibyte character encodings. This is needed if using a
|
---|
| 58 | locale with a multibyte character set. This switch is also helpful to be able to
|
---|
| 59 | edit text files initially created in Linux distributions like Fedora Core that
|
---|
| 60 | use UTF-8 as a default character set.</para>
|
---|
| 61 | </listitem>
|
---|
| 62 | </varlistentry>
|
---|
| 63 | </variablelist>
|
---|
[81fd230] | 64 |
|
---|
[73aedd1d] | 65 | <para>Compile the package:</para>
|
---|
| 66 |
|
---|
| 67 | <screen><userinput>make</userinput></screen>
|
---|
| 68 |
|
---|
[e5846ef] | 69 | <para>To test the results, issue: <userinput>make test</userinput>. However,
|
---|
| 70 | this test suite outputs a lot of binary data to the screen, which can cause
|
---|
| 71 | issues with the settings of the current terminal. This can be resolved by
|
---|
| 72 | redirecting the output to a log file.</para>
|
---|
[1a73ed4] | 73 |
|
---|
[81fd230] | 74 | <para>Install the package:</para>
|
---|
[73aedd1d] | 75 |
|
---|
[46a2e9c] | 76 | <screen><userinput>make install</userinput></screen>
|
---|
[a5ebf89] | 77 |
|
---|
[46a2e9c] | 78 | <para>In UTF-8 locales, the <command>vimtutor</command> program
|
---|
| 79 | tries to convert the tutorials from ISO-8859-1 to UTF-8. Since
|
---|
| 80 | some tutorials are not in ISO-8859-1, the text in them is thus made unreadable.
|
---|
| 81 | If you unpacked the <filename>vim-&vim-version;-lang.tar.gz</filename>
|
---|
| 82 | archive and are going to use a UTF-8 based locale, remove non-ISO-8859-1
|
---|
| 83 | tutorials. An English tutorial will be used instead.</para>
|
---|
| 84 | <!-- Removal is used instead of conversion in order for the user to be able to
|
---|
| 85 | painlessly revert his UTF-8 locale choice. -->
|
---|
[a5ebf89] | 86 |
|
---|
[e1ca33a] | 87 | <screen><userinput>rm -f /usr/share/vim/vim64/tutor/tutor.{gr,pl,ru,sk}
|
---|
| 88 | rm -f /usr/share/vim/vim64/tutor/tutor.??.*</userinput></screen>
|
---|
[73aedd1d] | 89 |
|
---|
[81fd230] | 90 | <para>Many users are used to using <command>vi</command> instead of
|
---|
| 91 | <command>vim</command>. To allow execution of <command>vim</command>
|
---|
| 92 | when users habitually enter <command>vi</command>, create a
|
---|
| 93 | symlink:</para>
|
---|
[73aedd1d] | 94 |
|
---|
[5998892] | 95 | <screen><userinput>ln -sv vim /usr/bin/vi</userinput></screen>
|
---|
[73aedd1d] | 96 |
|
---|
[46a2e9c] | 97 | <para>By default, Vim's documentation is installed in
|
---|
| 98 | <filename class="directory">/usr/share/vim</filename>. The following symlink
|
---|
| 99 | allows the documentation to be accessed via
|
---|
| 100 | <filename class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
|
---|
| 101 | it consistent with the location of documentation for other packages:</para>
|
---|
| 102 |
|
---|
| 103 | <screen><userinput>ln -sv ../vim/vim64/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
|
---|
| 104 |
|
---|
[bc2136e] | 105 | <para>If an X Window System is going to be installed on the LFS
|
---|
[81fd230] | 106 | system, it may be necessary to recompile Vim after installing X. Vim
|
---|
| 107 | comes with a GUI version of the editor that requires X and some
|
---|
| 108 | additional libraries to be installed. For more information on this
|
---|
| 109 | process, refer to the Vim documentation and the Vim installation page
|
---|
| 110 | in the BLFS book at <ulink
|
---|
| 111 | url="&blfs-root;view/svn/postlfs/editors.html#postlfs-editors-vim"/>.</para>
|
---|
[0ba2766b] | 112 |
|
---|
[81fd230] | 113 | </sect2>
|
---|
[342b176] | 114 |
|
---|
[df8334f] | 115 | <sect2 id="conf-vim" role="configuration"><title>Configuring Vim</title>
|
---|
[81fd230] | 116 | <indexterm zone="conf-vim"><primary sortas="e-/etc/vim">/etc/vim</primary></indexterm>
|
---|
[3f0c882] | 117 |
|
---|
[e5846ef] | 118 | <para>By default, <command>vim</command> runs in vi-incompatible mode. This may
|
---|
| 119 | be new to users who have used other editors in the past. The
|
---|
| 120 | <quote>nocompatible</quote> setting is included below to highlight the fact that
|
---|
| 121 | a new behavior is being used. It also reminds those who would change to
|
---|
| 122 | <quote>compatible</quote> mode that it should be the first setting in the
|
---|
| 123 | configuration file. This is necessary because it changes other settings, and
|
---|
| 124 | overrides must come after this setting. Create a default <command>vim</command>
|
---|
[81fd230] | 125 | configuration file by running the following:</para>
|
---|
[342b176] | 126 |
|
---|
[8ad7980] | 127 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
[d72e04a] | 128 | <literal>" Begin /etc/vimrc
|
---|
[342b176] | 129 |
|
---|
| 130 | set nocompatible
|
---|
| 131 | set backspace=2
|
---|
| 132 | syntax on
|
---|
[3e05705] | 133 | if (&term == "iterm") || (&term == "putty")
|
---|
| 134 | set background=dark
|
---|
| 135 | endif
|
---|
[342b176] | 136 |
|
---|
[d72e04a] | 137 | " End /etc/vimrc</literal>
|
---|
[8ad7980] | 138 | EOF</userinput></screen>
|
---|
[342b176] | 139 |
|
---|
[81fd230] | 140 | <para>The <parameter>set nocompatible</parameter> makes
|
---|
| 141 | <command>vim</command> behave in a more useful way (the default) than
|
---|
[f7ea35e] | 142 | the vi-compatible manner. Remove the <quote>no</quote> to keep the
|
---|
[81fd230] | 143 | old <command>vi</command> behavior. The <parameter>set
|
---|
| 144 | backspace=2</parameter> allows backspacing over line breaks,
|
---|
| 145 | autoindents, and the start of insert. The <parameter>syntax
|
---|
| 146 | on</parameter> enables vim's syntax highlighting. Finally, the
|
---|
| 147 | <emphasis>if</emphasis> statement with the <parameter>set
|
---|
| 148 | background=dark</parameter> corrects <command>vim</command>'s guess
|
---|
| 149 | about the background color of some terminal emulators. This gives the
|
---|
| 150 | highlighting a better color scheme for use on the black background of
|
---|
| 151 | these programs.</para>
|
---|
| 152 |
|
---|
| 153 | <para>Documentation for other available options can be obtained by
|
---|
| 154 | running the following command:</para>
|
---|
[dc32fef] | 155 |
|
---|
[de92788] | 156 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
|
---|
[dc32fef] | 157 |
|
---|
[342b176] | 158 | </sect2>
|
---|
[0ba2766b] | 159 |
|
---|
[c6cb3aa] | 160 | <sect2 id="contents-vim" role="content"><title>Contents of Vim</title>
|
---|
[673b0d8] | 161 |
|
---|
[81fd230] | 162 | <segmentedlist>
|
---|
| 163 | <segtitle>Installed programs</segtitle>
|
---|
[f7ea35e] | 164 | <seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
|
---|
| 165 | pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim),
|
---|
| 166 | view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh,
|
---|
[81fd230] | 167 | vimtutor, and xxd</seg></seglistitem>
|
---|
| 168 | </segmentedlist>
|
---|
| 169 |
|
---|
| 170 | <variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 171 | <?dbfo list-presentation="list"?>
|
---|
[8f97096] | 172 | <?dbhtml list-presentation="table"?>
|
---|
[81fd230] | 173 |
|
---|
| 174 | <varlistentry id="efm_filter.pl">
|
---|
| 175 | <term><command>efm_filter.pl</command></term>
|
---|
| 176 | <listitem>
|
---|
| 177 | <para>A filter for creating an error file that can be read by <command>vim</command></para>
|
---|
| 178 | <indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
|
---|
| 179 | </listitem>
|
---|
| 180 | </varlistentry>
|
---|
| 181 |
|
---|
| 182 | <varlistentry id="efm_perl.pl">
|
---|
| 183 | <term><command>efm_perl.pl</command></term>
|
---|
| 184 | <listitem>
|
---|
| 185 | <para>Reformats the error messages of the
|
---|
| 186 | Perl interpreter for use with the <quote>quickfix</quote> mode of <command>vim</command></para>
|
---|
| 187 | <indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
|
---|
| 188 | </listitem>
|
---|
| 189 | </varlistentry>
|
---|
| 190 |
|
---|
| 191 | <varlistentry id="ex">
|
---|
| 192 | <term><command>ex</command></term>
|
---|
| 193 | <listitem>
|
---|
| 194 | <para>Starts <command>vim</command> in ex mode</para>
|
---|
| 195 | <indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
|
---|
| 196 | </listitem>
|
---|
| 197 | </varlistentry>
|
---|
| 198 |
|
---|
| 199 | <varlistentry id="less.sh">
|
---|
| 200 | <term><command>less.sh</command></term>
|
---|
| 201 | <listitem>
|
---|
| 202 | <para>A script that starts <command>vim</command> with less.vim</para>
|
---|
| 203 | <indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
|
---|
| 204 | </listitem>
|
---|
| 205 | </varlistentry>
|
---|
| 206 |
|
---|
| 207 | <varlistentry id="mve.awk">
|
---|
| 208 | <term><command>mve.awk</command></term>
|
---|
| 209 | <listitem>
|
---|
| 210 | <para>Processes <command>vim</command> errors</para>
|
---|
| 211 | <indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
|
---|
| 212 | </listitem>
|
---|
| 213 | </varlistentry>
|
---|
| 214 |
|
---|
| 215 | <varlistentry id="pltags.pl">
|
---|
| 216 | <term><command>pltags.pl</command></term>
|
---|
| 217 | <listitem>
|
---|
| 218 | <para>Creates a tags file for Perl code for use by <command>vim</command></para>
|
---|
| 219 | <indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
|
---|
| 220 | </listitem>
|
---|
| 221 | </varlistentry>
|
---|
| 222 |
|
---|
| 223 | <varlistentry id="ref">
|
---|
| 224 | <term><command>ref</command></term>
|
---|
| 225 | <listitem>
|
---|
| 226 | <para>Checks the spelling of arguments</para>
|
---|
| 227 | <indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
|
---|
| 228 | </listitem>
|
---|
| 229 | </varlistentry>
|
---|
| 230 |
|
---|
| 231 | <varlistentry id="rview">
|
---|
| 232 | <term><command>rview</command></term>
|
---|
| 233 | <listitem>
|
---|
| 234 | <para>Is a restricted version of <command>view</command>; no shell
|
---|
| 235 | commands can be started and <command>view</command> cannot be suspended</para>
|
---|
| 236 | <indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
|
---|
| 237 | </listitem>
|
---|
| 238 | </varlistentry>
|
---|
| 239 |
|
---|
| 240 | <varlistentry id="rvim">
|
---|
| 241 | <term><command>rvim</command></term>
|
---|
| 242 | <listitem>
|
---|
| 243 | <para>Is a restricted version of <command>vim</command>; no shell
|
---|
| 244 | commands can be started and <command>vim</command> cannot be suspended</para>
|
---|
| 245 | <indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
|
---|
| 246 | </listitem>
|
---|
| 247 | </varlistentry>
|
---|
| 248 |
|
---|
| 249 | <varlistentry id="shtags.pl">
|
---|
| 250 | <term><command>shtags.pl</command></term>
|
---|
| 251 | <listitem>
|
---|
[e5846ef] | 252 | <para>Generates a tags file for Perl scripts</para>
|
---|
[81fd230] | 253 | <indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
|
---|
| 254 | </listitem>
|
---|
| 255 | </varlistentry>
|
---|
| 256 |
|
---|
| 257 | <varlistentry id="tcltags">
|
---|
| 258 | <term><command>tcltags</command></term>
|
---|
| 259 | <listitem>
|
---|
[e5846ef] | 260 | <para>Generates a tags file for TCL code</para>
|
---|
[81fd230] | 261 | <indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
|
---|
| 262 | </listitem>
|
---|
| 263 | </varlistentry>
|
---|
| 264 |
|
---|
| 265 | <varlistentry id="view">
|
---|
| 266 | <term><command>view</command></term>
|
---|
| 267 | <listitem>
|
---|
| 268 | <para>Starts <command>vim</command> in read-only mode</para>
|
---|
| 269 | <indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
|
---|
| 270 | </listitem>
|
---|
| 271 | </varlistentry>
|
---|
| 272 |
|
---|
| 273 | <varlistentry id="vi">
|
---|
| 274 | <term><command>vi</command></term>
|
---|
| 275 | <listitem>
|
---|
| 276 | <para>Is the editor</para>
|
---|
| 277 | <indexterm zone="ch-system-vim vi"><primary sortas="b-vi">vi</primary></indexterm>
|
---|
| 278 | </listitem>
|
---|
| 279 | </varlistentry>
|
---|
| 280 |
|
---|
| 281 | <varlistentry id="vim">
|
---|
| 282 | <term><command>vim</command></term>
|
---|
| 283 | <listitem>
|
---|
| 284 | <para>Is the editor</para>
|
---|
| 285 | <indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
|
---|
| 286 | </listitem>
|
---|
| 287 | </varlistentry>
|
---|
| 288 |
|
---|
| 289 | <varlistentry id="vim132">
|
---|
| 290 | <term><command>vim132</command></term>
|
---|
| 291 | <listitem>
|
---|
| 292 | <para>Starts <command>vim</command> with the terminal in 132-column mode</para>
|
---|
| 293 | <indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
|
---|
| 294 | </listitem>
|
---|
| 295 | </varlistentry>
|
---|
| 296 |
|
---|
| 297 | <varlistentry id="vim2html.pl">
|
---|
| 298 | <term><command>vim2html.pl</command></term>
|
---|
| 299 | <listitem>
|
---|
| 300 | <para>Converts Vim documentation to HypterText Markup Language (HTML)</para>
|
---|
| 301 | <indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
|
---|
| 302 | </listitem>
|
---|
| 303 | </varlistentry>
|
---|
| 304 |
|
---|
| 305 | <varlistentry id="vimdiff">
|
---|
| 306 | <term><command>vimdiff</command></term>
|
---|
| 307 | <listitem>
|
---|
| 308 | <para>Edits two or three versions of a file with <command>vim</command> and show differences</para>
|
---|
| 309 | <indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
|
---|
| 310 | </listitem>
|
---|
| 311 | </varlistentry>
|
---|
| 312 |
|
---|
| 313 | <varlistentry id="vimm">
|
---|
| 314 | <term><command>vimm</command></term>
|
---|
| 315 | <listitem>
|
---|
| 316 | <para>Enables the DEC locator input model on a remote terminal</para>
|
---|
| 317 | <indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
|
---|
| 318 | </listitem>
|
---|
| 319 | </varlistentry>
|
---|
| 320 |
|
---|
| 321 | <varlistentry id="vimspell.sh">
|
---|
| 322 | <term><command>vimspell.sh</command></term>
|
---|
| 323 | <listitem>
|
---|
[e5846ef] | 324 | <para>Spell checks a file and generates the syntax statements necessary to
|
---|
| 325 | highlight in <command>vim</command>. This script requires the old Unix
|
---|
| 326 | <command>spell</command> command, which is provided neither in LFS nor in
|
---|
| 327 | BLFS</para>
|
---|
[81fd230] | 328 | <indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
|
---|
| 329 | </listitem>
|
---|
| 330 | </varlistentry>
|
---|
| 331 |
|
---|
| 332 | <varlistentry id="vimtutor">
|
---|
| 333 | <term><command>vimtutor</command></term>
|
---|
| 334 | <listitem>
|
---|
| 335 | <para>Teaches the basic keys and commands of <command>vim</command></para>
|
---|
| 336 | <indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
|
---|
| 337 | </listitem>
|
---|
| 338 | </varlistentry>
|
---|
| 339 |
|
---|
| 340 | <varlistentry id="xxd">
|
---|
| 341 | <term><command>xxd</command></term>
|
---|
| 342 | <listitem>
|
---|
| 343 | <para>Creates a hex dump of the given file; it can
|
---|
| 344 | also do the reverse, so it can be used for binary patching</para>
|
---|
| 345 | <indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
|
---|
| 346 | </listitem>
|
---|
| 347 | </varlistentry>
|
---|
| 348 | </variablelist>
|
---|
[673b0d8] | 349 |
|
---|
| 350 | </sect2>
|
---|
| 351 |
|
---|
| 352 | </sect1>
|
---|
[81fd230] | 353 |
|
---|