[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
[ddd5542] | 7 |
|
---|
[81fd230] | 8 | <sect1 id="ch-system-vim" role="wrap">
|
---|
[ddd5542] | 9 | <?dbhtml filename="vim.html"?>
|
---|
| 10 |
|
---|
[e747759] | 11 | <sect1info condition="script">
|
---|
| 12 | <productname>vim</productname>
|
---|
| 13 | <productnumber>&vim-version;</productnumber>
|
---|
| 14 | <address>&vim-url;<otheraddr>&vim-lang-url;</otheraddr></address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
[ddd5542] | 17 | <title>Vim-&vim-version;</title>
|
---|
| 18 |
|
---|
| 19 | <indexterm zone="ch-system-vim">
|
---|
| 20 | <primary sortas="a-Vim">Vim</primary>
|
---|
| 21 | </indexterm>
|
---|
| 22 |
|
---|
| 23 | <sect2 role="package">
|
---|
| 24 | <title/>
|
---|
| 25 |
|
---|
| 26 | <para>The Vim package contains a powerful text editor.</para>
|
---|
| 27 |
|
---|
| 28 | <segmentedlist>
|
---|
| 29 | <segtitle>&buildtime;</segtitle>
|
---|
| 30 | <segtitle>&diskspace;</segtitle>
|
---|
| 31 |
|
---|
| 32 | <seglistitem>
|
---|
[e4a5635] | 33 | <seg>&vim-ch6-sbu;</seg>
|
---|
| 34 | <seg>&vim-ch6-du;</seg>
|
---|
[ddd5542] | 35 | </seglistitem>
|
---|
| 36 | </segmentedlist>
|
---|
| 37 |
|
---|
| 38 | <tip>
|
---|
| 39 | <title>Alternatives to Vim</title>
|
---|
| 40 |
|
---|
| 41 | <para>If you prefer another editor—such as Emacs, Joe, or
|
---|
| 42 | Nano—please refer to <ulink
|
---|
| 43 | url="&blfs-root;view/svn/postlfs/editors.html"/> for suggested
|
---|
| 44 | installation instructions.</para>
|
---|
| 45 | </tip>
|
---|
| 46 |
|
---|
| 47 | </sect2>
|
---|
| 48 |
|
---|
| 49 | <sect2 role="installation">
|
---|
| 50 | <title>Installation of Vim</title>
|
---|
| 51 |
|
---|
| 52 | <para>First, unpack both
|
---|
| 53 | <filename>vim-&vim-version;.tar.bz2</filename> and (optionally)
|
---|
| 54 | <filename>vim-&vim-version;-lang.tar.gz</filename> archives into the
|
---|
[53c5151] | 55 | same directory.</para>
|
---|
[2fe5051a] | 56 |
|
---|
[33d608d] | 57 | <para>Change the default location of the
|
---|
[ddd5542] | 58 | <filename>vimrc</filename> configuration file to <filename
|
---|
| 59 | class="directory">/etc</filename>:</para>
|
---|
[73aedd1d] | 60 |
|
---|
[0445a3d] | 61 | <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
---|
[008a51d] | 62 |
|
---|
[ddd5542] | 63 | <para>Now prepare Vim for compilation:</para>
|
---|
[73aedd1d] | 64 |
|
---|
[0445a3d] | 65 | <screen><userinput remap="configure">./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
[73aedd1d] | 66 |
|
---|
[ddd5542] | 67 | <variablelist>
|
---|
| 68 | <title>The meaning of the configure options:</title>
|
---|
| 69 |
|
---|
| 70 | <varlistentry>
|
---|
| 71 | <term><parameter>--enable-multibyte</parameter></term>
|
---|
| 72 | <listitem>
|
---|
| 73 | <para>This switch enables support for editing files in multibyte
|
---|
[fe6ca49] | 74 | character encodings. This is needed if using a locale with a
|
---|
[ddd5542] | 75 | multibyte character set. This switch is also helpful to be able
|
---|
| 76 | to edit text files initially created in Linux distributions like
|
---|
[fe6ca49] | 77 | Fedora that use UTF-8 as a default character set.</para>
|
---|
[ddd5542] | 78 | </listitem>
|
---|
| 79 | </varlistentry>
|
---|
[06948c1] | 80 |
|
---|
[ddd5542] | 81 | </variablelist>
|
---|
[81fd230] | 82 |
|
---|
[ddd5542] | 83 | <para>Compile the package:</para>
|
---|
[73aedd1d] | 84 |
|
---|
[0445a3d] | 85 | <screen><userinput remap="make">make</userinput></screen>
|
---|
[73aedd1d] | 86 |
|
---|
[0445a3d] | 87 | <para>To test the results, issue:</para>
|
---|
| 88 |
|
---|
| 89 | <screen><userinput remap="test">make test</userinput></screen>
|
---|
| 90 |
|
---|
| 91 | <para>However, this test suite outputs a lot of binary data to the screen,
|
---|
| 92 | which can cause issues with the settings of the current terminal. This can
|
---|
| 93 | be resolved by redirecting the output to a log file.</para>
|
---|
[1a73ed4] | 94 |
|
---|
[ddd5542] | 95 | <para>Install the package:</para>
|
---|
[73aedd1d] | 96 |
|
---|
[0445a3d] | 97 | <screen><userinput remap="install">make install</userinput></screen>
|
---|
[73aedd1d] | 98 |
|
---|
[ddd5542] | 99 | <para>Many users are used to using <command>vi</command> instead of
|
---|
| 100 | <command>vim</command>. To allow execution of <command>vim</command>
|
---|
| 101 | when users habitually enter <command>vi</command>, create a
|
---|
[cd2f7f0] | 102 | symlink for both the binary and the man page in the provided
|
---|
| 103 | languages:</para>
|
---|
[73aedd1d] | 104 |
|
---|
[0445a3d] | 105 | <screen><userinput remap="install">ln -sv vim /usr/bin/vi
|
---|
[e54882e] | 106 | for L in /usr/share/man/{,*/}man1/vim.1; do
|
---|
| 107 | ln -sv vim.1 $(dirname $L)/vi.1
|
---|
[cd2f7f0] | 108 | done</userinput></screen>
|
---|
[73aedd1d] | 109 |
|
---|
[ddd5542] | 110 | <para>By default, Vim's documentation is installed in <filename
|
---|
| 111 | class="directory">/usr/share/vim</filename>. The following symlink
|
---|
| 112 | allows the documentation to be accessed via <filename
|
---|
| 113 | class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
|
---|
| 114 | it consistent with the location of documentation for other packages:</para>
|
---|
[f8d484d] | 115 |
|
---|
[0445a3d] | 116 | <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
|
---|
[f8d484d] | 117 |
|
---|
[ddd5542] | 118 | <para>If an X Window System is going to be installed on the LFS
|
---|
| 119 | system, it may be necessary to recompile Vim after installing X. Vim
|
---|
| 120 | comes with a GUI version of the editor that requires X and some
|
---|
| 121 | additional libraries to be installed. For more information on this
|
---|
| 122 | process, refer to the Vim documentation and the Vim installation page
|
---|
| 123 | in the BLFS book at <ulink
|
---|
| 124 | url="&blfs-root;view/svn/postlfs/editors.html#postlfs-editors-vim"/>.</para>
|
---|
[0ba2766b] | 125 |
|
---|
[ddd5542] | 126 | </sect2>
|
---|
[342b176] | 127 |
|
---|
[ddd5542] | 128 | <sect2 id="conf-vim" role="configuration">
|
---|
| 129 | <title>Configuring Vim</title>
|
---|
[3f0c882] | 130 |
|
---|
[ddd5542] | 131 | <indexterm zone="conf-vim">
|
---|
| 132 | <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
|
---|
| 133 | </indexterm>
|
---|
| 134 |
|
---|
| 135 | <para>By default, <command>vim</command> runs in vi-incompatible mode.
|
---|
| 136 | This may be new to users who have used other editors in the past. The
|
---|
| 137 | <quote>nocompatible</quote> setting is included below to highlight the
|
---|
| 138 | fact that a new behavior is being used. It also reminds those who would
|
---|
| 139 | change to <quote>compatible</quote> mode that it should be the first
|
---|
| 140 | setting in the configuration file. This is necessary because it changes
|
---|
| 141 | other settings, and overrides must come after this setting. Create a default
|
---|
| 142 | <command>vim</command> configuration file by running the following:</para>
|
---|
[342b176] | 143 |
|
---|
[8ad7980] | 144 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
[d72e04a] | 145 | <literal>" Begin /etc/vimrc
|
---|
[342b176] | 146 |
|
---|
| 147 | set nocompatible
|
---|
| 148 | set backspace=2
|
---|
| 149 | syntax on
|
---|
[3e05705] | 150 | if (&term == "iterm") || (&term == "putty")
|
---|
| 151 | set background=dark
|
---|
| 152 | endif
|
---|
[342b176] | 153 |
|
---|
[d72e04a] | 154 | " End /etc/vimrc</literal>
|
---|
[8ad7980] | 155 | EOF</userinput></screen>
|
---|
[342b176] | 156 |
|
---|
[92e51a3] | 157 | <para>The <parameter>set nocompatible</parameter> setting makes
|
---|
[ddd5542] | 158 | <command>vim</command> behave in a more useful way (the default) than
|
---|
| 159 | the vi-compatible manner. Remove the <quote>no</quote> to keep the
|
---|
| 160 | old <command>vi</command> behavior. The <parameter>set
|
---|
[92e51a3] | 161 | backspace=2</parameter> setting allows backspacing over line breaks,
|
---|
[ddd5542] | 162 | autoindents, and the start of insert. The <parameter>syntax
|
---|
[92e51a3] | 163 | on</parameter> parameter enables vim's syntax highlighting. Finally,
|
---|
| 164 | the <emphasis>if</emphasis> statement with the <parameter>set
|
---|
| 165 | background=dark</parameter> setting corrects <command>vim</command>'s
|
---|
| 166 | guess about the background color of some terminal emulators. This
|
---|
| 167 | gives the highlighting a better color scheme for use on the black
|
---|
| 168 | background of these programs.</para>
|
---|
[ddd5542] | 169 |
|
---|
| 170 | <para>Documentation for other available options can be obtained by
|
---|
| 171 | running the following command:</para>
|
---|
[dc32fef] | 172 |
|
---|
[de92788] | 173 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
|
---|
[dc32fef] | 174 |
|
---|
[a1a0a65] | 175 | <note>
|
---|
| 176 | <para>By default, Vim only installs spell files for the English language.
|
---|
[c226182] | 177 | To install spell files for your preferred language, download the
|
---|
| 178 | <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
|
---|
| 179 | files for your language and character encoding from <ulink
|
---|
[92e51a3] | 180 | url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
|
---|
[5111cd5] | 181 | <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
|
---|
[c226182] | 182 |
|
---|
| 183 | <para>To use these spell files, some configuration in
|
---|
| 184 | <filename>/etc/vimrc</filename> is needed, e.g.:</para>
|
---|
| 185 |
|
---|
| 186 | <screen><literal>set spelllang=en,ru
|
---|
| 187 | set spell</literal></screen>
|
---|
| 188 |
|
---|
| 189 | <para>For more information, see the appropriate README file located
|
---|
[92e51a3] | 190 | at the URL above.</para>
|
---|
[a1a0a65] | 191 | </note>
|
---|
| 192 |
|
---|
[ddd5542] | 193 | </sect2>
|
---|
| 194 |
|
---|
| 195 | <sect2 id="contents-vim" role="content">
|
---|
| 196 | <title>Contents of Vim</title>
|
---|
| 197 |
|
---|
| 198 | <segmentedlist>
|
---|
| 199 | <segtitle>Installed programs</segtitle>
|
---|
| 200 |
|
---|
| 201 | <seglistitem>
|
---|
[33d608d] | 202 | <seg>ex (link to vim), rview (link to vim), rvim (link to vim),
|
---|
| 203 | vi (link to vim), view (link to vim), vim,
|
---|
| 204 | vimdiff (link to vim), vimtutor, and xxd</seg>
|
---|
[ddd5542] | 205 | </seglistitem>
|
---|
| 206 | </segmentedlist>
|
---|
| 207 |
|
---|
| 208 | <variablelist>
|
---|
| 209 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 210 | <?dbfo list-presentation="list"?>
|
---|
| 211 | <?dbhtml list-presentation="table"?>
|
---|
| 212 |
|
---|
| 213 | <varlistentry id="ex">
|
---|
| 214 | <term><command>ex</command></term>
|
---|
| 215 | <listitem>
|
---|
| 216 | <para>Starts <command>vim</command> in ex mode</para>
|
---|
| 217 | <indexterm zone="ch-system-vim ex">
|
---|
| 218 | <primary sortas="b-ex">ex</primary>
|
---|
| 219 | </indexterm>
|
---|
| 220 | </listitem>
|
---|
| 221 | </varlistentry>
|
---|
| 222 |
|
---|
| 223 | <varlistentry id="rview">
|
---|
| 224 | <term><command>rview</command></term>
|
---|
| 225 | <listitem>
|
---|
| 226 | <para>Is a restricted version of <command>view</command>; no shell
|
---|
| 227 | commands can be started and <command>view</command> cannot be
|
---|
| 228 | suspended</para>
|
---|
| 229 | <indexterm zone="ch-system-vim rview">
|
---|
| 230 | <primary sortas="b-rview">rview</primary>
|
---|
| 231 | </indexterm>
|
---|
| 232 | </listitem>
|
---|
| 233 | </varlistentry>
|
---|
| 234 |
|
---|
| 235 | <varlistentry id="rvim">
|
---|
| 236 | <term><command>rvim</command></term>
|
---|
| 237 | <listitem>
|
---|
| 238 | <para>Is a restricted version of <command>vim</command>; no shell
|
---|
| 239 | commands can be started and <command>vim</command> cannot be
|
---|
| 240 | suspended</para>
|
---|
| 241 | <indexterm zone="ch-system-vim rvim">
|
---|
| 242 | <primary sortas="b-rvim">rvim</primary>
|
---|
| 243 | </indexterm>
|
---|
| 244 | </listitem>
|
---|
| 245 | </varlistentry>
|
---|
| 246 |
|
---|
[2791a8e] | 247 | <varlistentry id="vi">
|
---|
| 248 | <term><command>vi</command></term>
|
---|
[ddd5542] | 249 | <listitem>
|
---|
[2791a8e] | 250 | <para>Link to <command>vim</command></para>
|
---|
| 251 | <indexterm zone="ch-system-vim vi">
|
---|
| 252 | <primary sortas="b-vi">vi</primary>
|
---|
[ddd5542] | 253 | </indexterm>
|
---|
| 254 | </listitem>
|
---|
| 255 | </varlistentry>
|
---|
| 256 |
|
---|
| 257 | <varlistentry id="view">
|
---|
| 258 | <term><command>view</command></term>
|
---|
| 259 | <listitem>
|
---|
| 260 | <para>Starts <command>vim</command> in read-only mode</para>
|
---|
| 261 | <indexterm zone="ch-system-vim view">
|
---|
| 262 | <primary sortas="b-view">view</primary>
|
---|
| 263 | </indexterm>
|
---|
| 264 | </listitem>
|
---|
| 265 | </varlistentry>
|
---|
| 266 |
|
---|
| 267 | <varlistentry id="vim">
|
---|
| 268 | <term><command>vim</command></term>
|
---|
| 269 | <listitem>
|
---|
| 270 | <para>Is the editor</para>
|
---|
| 271 | <indexterm zone="ch-system-vim vim">
|
---|
| 272 | <primary sortas="b-vim">vim</primary>
|
---|
| 273 | </indexterm>
|
---|
| 274 | </listitem>
|
---|
| 275 | </varlistentry>
|
---|
| 276 |
|
---|
| 277 | <varlistentry id="vimdiff">
|
---|
| 278 | <term><command>vimdiff</command></term>
|
---|
| 279 | <listitem>
|
---|
| 280 | <para>Edits two or three versions of a file with <command>vim</command>
|
---|
| 281 | and show differences</para>
|
---|
| 282 | <indexterm zone="ch-system-vim vimdiff">
|
---|
| 283 | <primary sortas="b-vimdiff">vimdiff</primary>
|
---|
| 284 | </indexterm>
|
---|
| 285 | </listitem>
|
---|
| 286 | </varlistentry>
|
---|
| 287 |
|
---|
| 288 | <varlistentry id="vimtutor">
|
---|
| 289 | <term><command>vimtutor</command></term>
|
---|
| 290 | <listitem>
|
---|
| 291 | <para>Teaches the basic keys and commands of
|
---|
| 292 | <command>vim</command></para>
|
---|
| 293 | <indexterm zone="ch-system-vim vimtutor">
|
---|
| 294 | <primary sortas="b-vimtutor">vimtutor</primary>
|
---|
| 295 | </indexterm>
|
---|
| 296 | </listitem>
|
---|
| 297 | </varlistentry>
|
---|
| 298 |
|
---|
| 299 | <varlistentry id="xxd">
|
---|
| 300 | <term><command>xxd</command></term>
|
---|
| 301 | <listitem>
|
---|
| 302 | <para>Creates a hex dump of the given file; it can
|
---|
| 303 | also do the reverse, so it can be used for binary patching</para>
|
---|
| 304 | <indexterm zone="ch-system-vim xxd">
|
---|
| 305 | <primary sortas="b-xxd">xxd</primary>
|
---|
| 306 | </indexterm>
|
---|
| 307 | </listitem>
|
---|
| 308 | </varlistentry>
|
---|
| 309 |
|
---|
| 310 | </variablelist>
|
---|
| 311 |
|
---|
| 312 | </sect2>
|
---|
[673b0d8] | 313 |
|
---|
| 314 | </sect1>
|
---|