[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[c2133bc] | 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 | ]>
|
---|
[752f4e5] | 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/>
|
---|
[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>
|
---|
[a0e1913] | 22 | <segtitle>&dependencies;</segtitle>
|
---|
[a001133] | 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
|
---|
[3f6be93] | 30 | Nano—please refer to <ulink url="&blfs-root;view/svn/postlfs/editors.html"/>
|
---|
[69993f4] | 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 |
|
---|
[b48b8c5] | 65 |
|
---|
[69993f4] | 66 | <para>To test the results, 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
|
---|
[69993f4] | 70 | suite here is optional.</para>
|
---|
[1a73ed4] | 71 |
|
---|
[ef13657] | 72 | <para>Install the package:</para>
|
---|
[73aedd1d] | 73 |
|
---|
| 74 | <screen><userinput>make install</userinput></screen>
|
---|
| 75 |
|
---|
[69993f4] | 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>
|
---|
[69993f4] | 78 | when users habitually enter <command>vi</command>, create a
|
---|
[ef13657] | 79 | symlink:</para>
|
---|
[73aedd1d] | 80 |
|
---|
| 81 | <screen><userinput>ln -s vim /usr/bin/vi</userinput></screen>
|
---|
| 82 |
|
---|
[791f27e4] | 83 | <para>If the X Window System is going to be installed on the LFS
|
---|
[69993f4] | 84 | system, it may be necessary to recompile Vim after installing X. Vim
|
---|
[ef13657] | 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
|
---|
[24a08b9] | 87 | process, refer to the Vim documentation and the Vim installation page
|
---|
| 88 | in the BLFS book at <ulink
|
---|
[3f6be93] | 89 | url="&blfs-root;view/svn/postlfs/editors.html#postlfs-editors-vim"/>.</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
|
---|
[752f4e5] | 102 | overrides must come after this setting. Create a default <command>vim</command>
|
---|
[ef13657] | 103 | configuration file by running the following:</para>
|
---|
[342b176] | 104 |
|
---|
[8ad7980] | 105 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
[3890f5a] | 106 | <literal>" Begin /etc/vimrc
|
---|
[342b176] | 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 |
|
---|
[3890f5a] | 115 | " End /etc/vimrc</literal>
|
---|
[8ad7980] | 116 | EOF</userinput></screen>
|
---|
[342b176] | 117 |
|
---|
[b48b8c5] | 118 |
|
---|
[8ad7980] | 119 | <para>The <parameter>set nocompatible</parameter> makes
|
---|
[ef13657] | 120 | <command>vim</command> behave in a more useful way (the default) than
|
---|
[69993f4] | 121 | the vi-compatible manner. Remove the <quote>no</quote> to keep the
|
---|
[ef13657] | 122 | old <command>vi</command> behavior. The <parameter>set
|
---|
| 123 | backspace=2</parameter> allows backspacing over line breaks,
|
---|
| 124 | autoindents, and the start of insert. The <parameter>syntax
|
---|
| 125 | on</parameter> enables vim's syntax highlighting. Finally, the
|
---|
[752f4e5] | 126 | <emphasis>if</emphasis> statement with the <parameter>set
|
---|
[ef13657] | 127 | background=dark</parameter> corrects <command>vim</command>'s guess
|
---|
| 128 | about the background color of some terminal emulators. This gives the
|
---|
| 129 | highlighting a better color scheme for use on the black background of
|
---|
| 130 | these programs.</para>
|
---|
| 131 |
|
---|
| 132 | <para>Documentation for other available options can be obtained by
|
---|
| 133 | running the following command:</para>
|
---|
[dc32fef] | 134 |
|
---|
| 135 | <screen><userinput>vim -c ':options'</userinput></screen>
|
---|
| 136 |
|
---|
[342b176] | 137 | </sect2>
|
---|
[0ba2766b] | 138 |
|
---|
[c6cb3aa] | 139 | <sect2 id="contents-vim" role="content"><title>Contents of Vim</title>
|
---|
[673b0d8] | 140 |
|
---|
[c6cb3aa] | 141 | <segmentedlist>
|
---|
| 142 | <segtitle>Installed programs</segtitle>
|
---|
| 143 | <seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
|
---|
| 144 | pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim),
|
---|
| 145 | view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh,
|
---|
[69993f4] | 146 | vimtutor, and xxd</seg></seglistitem>
|
---|
[c6cb3aa] | 147 | </segmentedlist>
|
---|
[673b0d8] | 148 |
|
---|
[2256873] | 149 | <variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
[3ed279f] | 150 | <?dbfo list-presentation="list"?>
|
---|
[c5f9180] | 151 | <?dbhtml list-presentation="table"?>
|
---|
[673b0d8] | 152 |
|
---|
[b8a819f] | 153 | <varlistentry id="efm_filter.pl">
|
---|
| 154 | <term><command>efm_filter.pl</command></term>
|
---|
[c6cb3aa] | 155 | <listitem>
|
---|
[2256873] | 156 | <para>A filter for creating an error file that can be read by <command>vim</command></para>
|
---|
[3ed279f] | 157 | <indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
|
---|
[c6cb3aa] | 158 | </listitem>
|
---|
| 159 | </varlistentry>
|
---|
[673b0d8] | 160 |
|
---|
[b8a819f] | 161 | <varlistentry id="efm_perl.pl">
|
---|
| 162 | <term><command>efm_perl.pl</command></term>
|
---|
[c6cb3aa] | 163 | <listitem>
|
---|
[2256873] | 164 | <para>Reformats the error messages of the
|
---|
| 165 | Perl interpreter for use with the <quote>quickfix</quote> mode of <command>vim</command></para>
|
---|
[3ed279f] | 166 | <indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
|
---|
[c6cb3aa] | 167 | </listitem>
|
---|
| 168 | </varlistentry>
|
---|
[673b0d8] | 169 |
|
---|
[b8a819f] | 170 | <varlistentry id="ex">
|
---|
| 171 | <term><command>ex</command></term>
|
---|
[c6cb3aa] | 172 | <listitem>
|
---|
[2256873] | 173 | <para>Starts <command>vim</command> in ex mode</para>
|
---|
[3ed279f] | 174 | <indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
|
---|
[c6cb3aa] | 175 | </listitem>
|
---|
| 176 | </varlistentry>
|
---|
[673b0d8] | 177 |
|
---|
[b8a819f] | 178 | <varlistentry id="less.sh">
|
---|
| 179 | <term><command>less.sh</command></term>
|
---|
[c6cb3aa] | 180 | <listitem>
|
---|
[2256873] | 181 | <para>A script that starts <command>vim</command> with less.vim</para>
|
---|
[3ed279f] | 182 | <indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
|
---|
[c6cb3aa] | 183 | </listitem>
|
---|
| 184 | </varlistentry>
|
---|
[673b0d8] | 185 |
|
---|
[b8a819f] | 186 | <varlistentry id="mve.awk">
|
---|
| 187 | <term><command>mve.awk</command></term>
|
---|
[c6cb3aa] | 188 | <listitem>
|
---|
[2256873] | 189 | <para>Processes <command>vim</command> errors</para>
|
---|
[3ed279f] | 190 | <indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
|
---|
[c6cb3aa] | 191 | </listitem>
|
---|
| 192 | </varlistentry>
|
---|
[673b0d8] | 193 |
|
---|
[b8a819f] | 194 | <varlistentry id="pltags.pl">
|
---|
| 195 | <term><command>pltags.pl</command></term>
|
---|
[c6cb3aa] | 196 | <listitem>
|
---|
[2256873] | 197 | <para>Creates a tags file for Perl code for use by <command>vim</command></para>
|
---|
[3ed279f] | 198 | <indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
|
---|
[c6cb3aa] | 199 | </listitem>
|
---|
| 200 | </varlistentry>
|
---|
[673b0d8] | 201 |
|
---|
[b8a819f] | 202 | <varlistentry id="ref">
|
---|
| 203 | <term><command>ref</command></term>
|
---|
[c6cb3aa] | 204 | <listitem>
|
---|
[2256873] | 205 | <para>Checks the spelling of arguments</para>
|
---|
[3ed279f] | 206 | <indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
|
---|
[c6cb3aa] | 207 | </listitem>
|
---|
| 208 | </varlistentry>
|
---|
[673b0d8] | 209 |
|
---|
[b8a819f] | 210 | <varlistentry id="rview">
|
---|
| 211 | <term><command>rview</command></term>
|
---|
[c6cb3aa] | 212 | <listitem>
|
---|
[2256873] | 213 | <para>Is a restricted version of <command>view</command>; no shell
|
---|
| 214 | commands can be started and <command>view</command> cannot be suspended</para>
|
---|
[3ed279f] | 215 | <indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
|
---|
[c6cb3aa] | 216 | </listitem>
|
---|
| 217 | </varlistentry>
|
---|
[673b0d8] | 218 |
|
---|
[b8a819f] | 219 | <varlistentry id="rvim">
|
---|
| 220 | <term><command>rvim</command></term>
|
---|
[c6cb3aa] | 221 | <listitem>
|
---|
[2256873] | 222 | <para>Is a restricted version of <command>vim</command>; no shell
|
---|
| 223 | commands can be started and <command>vim</command> cannot be suspended</para>
|
---|
[3ed279f] | 224 | <indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
|
---|
[c6cb3aa] | 225 | </listitem>
|
---|
| 226 | </varlistentry>
|
---|
[73aedd1d] | 227 |
|
---|
[b8a819f] | 228 | <varlistentry id="shtags.pl">
|
---|
| 229 | <term><command>shtags.pl</command></term>
|
---|
[c6cb3aa] | 230 | <listitem>
|
---|
[2256873] | 231 | <para>Generates a tag file for Perl scripts</para>
|
---|
[3ed279f] | 232 | <indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
|
---|
[c6cb3aa] | 233 | </listitem>
|
---|
| 234 | </varlistentry>
|
---|
[673b0d8] | 235 |
|
---|
[b8a819f] | 236 | <varlistentry id="tcltags">
|
---|
| 237 | <term><command>tcltags</command></term>
|
---|
[c6cb3aa] | 238 | <listitem>
|
---|
[2256873] | 239 | <para>Generates a tag file for TCL code</para>
|
---|
[3ed279f] | 240 | <indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
|
---|
[c6cb3aa] | 241 | </listitem>
|
---|
| 242 | </varlistentry>
|
---|
[673b0d8] | 243 |
|
---|
[b8a819f] | 244 | <varlistentry id="view">
|
---|
| 245 | <term><command>view</command></term>
|
---|
[c6cb3aa] | 246 | <listitem>
|
---|
[2256873] | 247 | <para>Starts <command>vim</command> in read-only mode</para>
|
---|
[3ed279f] | 248 | <indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
|
---|
[c6cb3aa] | 249 | </listitem>
|
---|
| 250 | </varlistentry>
|
---|
[673b0d8] | 251 |
|
---|
[2256873] | 252 | <varlistentry id="vi">
|
---|
| 253 | <term><command>vi</command></term>
|
---|
| 254 | <listitem>
|
---|
| 255 | <para>Is the editor</para>
|
---|
| 256 | <indexterm zone="ch-system-vim vi"><primary sortas="b-vi">vi</primary></indexterm>
|
---|
| 257 | </listitem>
|
---|
| 258 | </varlistentry>
|
---|
| 259 |
|
---|
[b8a819f] | 260 | <varlistentry id="vim">
|
---|
| 261 | <term><command>vim</command></term>
|
---|
[c6cb3aa] | 262 | <listitem>
|
---|
[2256873] | 263 | <para>Is the editor</para>
|
---|
[3ed279f] | 264 | <indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
|
---|
[c6cb3aa] | 265 | </listitem>
|
---|
| 266 | </varlistentry>
|
---|
[673b0d8] | 267 |
|
---|
[b8a819f] | 268 | <varlistentry id="vim132">
|
---|
| 269 | <term><command>vim132</command></term>
|
---|
[c6cb3aa] | 270 | <listitem>
|
---|
[2256873] | 271 | <para>Starts <command>vim</command> with the terminal in 132-column mode</para>
|
---|
[3ed279f] | 272 | <indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
|
---|
[c6cb3aa] | 273 | </listitem>
|
---|
| 274 | </varlistentry>
|
---|
[673b0d8] | 275 |
|
---|
[b8a819f] | 276 | <varlistentry id="vim2html.pl">
|
---|
| 277 | <term><command>vim2html.pl</command></term>
|
---|
[c6cb3aa] | 278 | <listitem>
|
---|
[2256873] | 279 | <para>Converts Vim documentation to HypterText Markup Language (HTML)</para>
|
---|
[3ed279f] | 280 | <indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
|
---|
[c6cb3aa] | 281 | </listitem>
|
---|
| 282 | </varlistentry>
|
---|
[673b0d8] | 283 |
|
---|
[b8a819f] | 284 | <varlistentry id="vimdiff">
|
---|
| 285 | <term><command>vimdiff</command></term>
|
---|
[c6cb3aa] | 286 | <listitem>
|
---|
[2256873] | 287 | <para>Edits two or three versions of a file with <command>vim</command> and show differences</para>
|
---|
[3ed279f] | 288 | <indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
|
---|
[c6cb3aa] | 289 | </listitem>
|
---|
| 290 | </varlistentry>
|
---|
[673b0d8] | 291 |
|
---|
[b8a819f] | 292 | <varlistentry id="vimm">
|
---|
| 293 | <term><command>vimm</command></term>
|
---|
[c6cb3aa] | 294 | <listitem>
|
---|
[2256873] | 295 | <para>Enables the DEC locator input model on a remote terminal</para>
|
---|
[3ed279f] | 296 | <indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
|
---|
[c6cb3aa] | 297 | </listitem>
|
---|
| 298 | </varlistentry>
|
---|
[673b0d8] | 299 |
|
---|
[b8a819f] | 300 | <varlistentry id="vimspell.sh">
|
---|
| 301 | <term><command>vimspell.sh</command></term>
|
---|
[c6cb3aa] | 302 | <listitem>
|
---|
[2256873] | 303 | <para>Spells a file and generates the syntax statements necessary
|
---|
[8ad7980] | 304 | to highlight in <command>vim</command>. This script requires the old Unix <command>spell</command>
|
---|
[2256873] | 305 | command, which is provided neither in LFS nor in BLFS</para>
|
---|
[3ed279f] | 306 | <indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
|
---|
[c6cb3aa] | 307 | </listitem>
|
---|
| 308 | </varlistentry>
|
---|
| 309 |
|
---|
[b8a819f] | 310 | <varlistentry id="vimtutor">
|
---|
| 311 | <term><command>vimtutor</command></term>
|
---|
[c6cb3aa] | 312 | <listitem>
|
---|
[2256873] | 313 | <para>Teaches the basic keys and commands of <command>vim</command></para>
|
---|
[3ed279f] | 314 | <indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
|
---|
[c6cb3aa] | 315 | </listitem>
|
---|
| 316 | </varlistentry>
|
---|
[673b0d8] | 317 |
|
---|
[b8a819f] | 318 | <varlistentry id="xxd">
|
---|
| 319 | <term><command>xxd</command></term>
|
---|
[c6cb3aa] | 320 | <listitem>
|
---|
[2256873] | 321 | <para>Creates a hex dump of the given file; it can
|
---|
| 322 | also do the reverse, so it can be used for binary patching</para>
|
---|
[3ed279f] | 323 | <indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
|
---|
[c6cb3aa] | 324 | </listitem>
|
---|
| 325 | </varlistentry>
|
---|
| 326 | </variablelist>
|
---|
[673b0d8] | 327 |
|
---|
| 328 | </sect2>
|
---|
| 329 |
|
---|
| 330 | </sect1>
|
---|
[ef13657] | 331 |
|
---|