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