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