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