[7152faa] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[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 |
|
---|
[fc294857] | 11 | <sect1info condition="script">
|
---|
| 12 | <productname>vim</productname>
|
---|
| 13 | <productnumber>&vim-version;</productnumber>
|
---|
| 14 | <address>&vim-url;</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>
|
---|
[fb386e0] | 33 | <seg>&vim-fin-sbu;</seg>
|
---|
| 34 | <seg>&vim-fin-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
|
---|
[0ee07e5] | 43 | url="&blfs-book;postlfs/editors.html"/> for suggested
|
---|
[ddd5542] | 44 | installation instructions.</para>
|
---|
| 45 | </tip>
|
---|
| 46 |
|
---|
| 47 | </sect2>
|
---|
| 48 |
|
---|
| 49 | <sect2 role="installation">
|
---|
| 50 | <title>Installation of Vim</title>
|
---|
| 51 |
|
---|
[0720a4e] | 52 | <para>First, change the default location of the <filename>vimrc</filename>
|
---|
| 53 | configuration file to <filename class="directory">/etc</filename>:</para>
|
---|
[73aedd1d] | 54 |
|
---|
[0445a3d] | 55 | <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
---|
[0720a4e] | 56 |
|
---|
[0c4501b] | 57 | <para>Prepare Vim for compilation:</para>
|
---|
[73aedd1d] | 58 |
|
---|
[254c03be] | 59 | <screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
|
---|
[81fd230] | 60 |
|
---|
[ddd5542] | 61 | <para>Compile the package:</para>
|
---|
[73aedd1d] | 62 |
|
---|
[0445a3d] | 63 | <screen><userinput remap="make">make</userinput></screen>
|
---|
[73aedd1d] | 64 |
|
---|
[d672ab7] | 65 | <para>To prepare the tests, ensure that user
|
---|
| 66 | <systemitem class="username">tester</systemitem> can write
|
---|
[6a156bab] | 67 | to the source tree:</para>
|
---|
[76a706e] | 68 |
|
---|
[9c73d911] | 69 | <screen><userinput remap="test">chown -R tester .</userinput></screen>
|
---|
[76a706e] | 70 |
|
---|
[6a156bab] | 71 | <para>Now run the tests as user <systemitem
|
---|
| 72 | class="username">tester</systemitem>:</para>
|
---|
[76a706e] | 73 |
|
---|
[3827fcf6] | 74 | <screen><userinput remap="test">su tester -c "TERM=xterm-256color LANG=en_US.UTF-8 make -j1 test" \
|
---|
| 75 | &> vim-test.log</userinput></screen>
|
---|
[0445a3d] | 76 |
|
---|
[0d84af1] | 77 | <para>The test suite outputs a lot of binary data to the screen. This can
|
---|
[3827fcf6] | 78 | cause issues with the settings of the current terminal (especially while
|
---|
[c301941] | 79 | we are overriding the <envar>TERM</envar> variable to satisfy some
|
---|
[3827fcf6] | 80 | assumptions of the test suite). The problem can be
|
---|
[0d84af1] | 81 | avoided by redirecting the output to a log file as shown above. A
|
---|
[141a1fa] | 82 | successful test will result in the words <computeroutput>ALL
|
---|
| 83 | DONE</computeroutput> in the log file at completion.</para>
|
---|
[1a73ed4] | 84 |
|
---|
[ddd5542] | 85 | <para>Install the package:</para>
|
---|
[73aedd1d] | 86 |
|
---|
[0d81e3c] | 87 | <screen><userinput remap="install">make install</userinput></screen>
|
---|
[73aedd1d] | 88 |
|
---|
[0c4501b] | 89 | <para>Many users reflexively type <command>vi</command> instead of
|
---|
[ddd5542] | 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 |
|
---|
[0c4501b] | 100 | <para>By default, Vim's documentation is installed in <filename
|
---|
[0d81e3c] | 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>
|
---|
| 105 |
|
---|
| 106 | <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
|
---|
| 107 |
|
---|
[ddd5542] | 108 | <para>If an X Window System is going to be installed on the LFS
|
---|
[0c4501b] | 109 | system, it may be necessary to recompile Vim after installing X. Vim
|
---|
[ddd5542] | 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
|
---|
[0c4501b] | 112 | process, refer to the Vim documentation and the Vim installation page
|
---|
[ddd5542] | 113 | in the BLFS book at <ulink
|
---|
[0ee07e5] | 114 | url="&blfs-book;postlfs/vim.html"/>.</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 |
|
---|
[173aea3] | 137 | " Ensure defaults are set before customizing settings, not after
|
---|
| 138 | source $VIMRUNTIME/defaults.vim
|
---|
[d672ab7] | 139 | let skip_defaults_vim=1
|
---|
[173aea3] | 140 |
|
---|
[342b176] | 141 | set nocompatible
|
---|
| 142 | set backspace=2
|
---|
[173aea3] | 143 | set mouse=
|
---|
[342b176] | 144 | syntax on
|
---|
[4032ec9c] | 145 | if (&term == "xterm") || (&term == "putty")
|
---|
[3e05705] | 146 | set background=dark
|
---|
| 147 | endif
|
---|
[342b176] | 148 |
|
---|
[d72e04a] | 149 | " End /etc/vimrc</literal>
|
---|
[173aea3] | 150 | EOF</userinput></screen>
|
---|
[342b176] | 151 |
|
---|
[92e51a3] | 152 | <para>The <parameter>set nocompatible</parameter> setting makes
|
---|
[8557cab] | 153 | <command>vim</command> behave in a more useful way (the default) than the
|
---|
| 154 | vi-compatible manner. Remove the <quote>no</quote> to keep the old
|
---|
| 155 | <command>vi</command> behavior. The <parameter>set backspace=2</parameter>
|
---|
| 156 | setting allows backspacing over line breaks, autoindents, and the start of
|
---|
[6a156bab] | 157 | an insert. The <parameter>syntax on</parameter> parameter enables vim's syntax
|
---|
[173aea3] | 158 | highlighting. The <parameter>set mouse=</parameter> setting enables
|
---|
[8557cab] | 159 | proper pasting of text with the mouse when working in chroot or over a
|
---|
| 160 | remote connection. Finally, the <emphasis>if</emphasis> statement with the
|
---|
| 161 | <parameter>set background=dark</parameter> setting corrects
|
---|
| 162 | <command>vim</command>'s guess about the background color of some terminal
|
---|
| 163 | emulators. This gives the highlighting a better color scheme for use on the
|
---|
| 164 | black background of these programs.</para>
|
---|
[6a156bab] | 165 |
|
---|
[ddd5542] | 166 | <para>Documentation for other available options can be obtained by
|
---|
| 167 | running the following command:</para>
|
---|
[dc32fef] | 168 |
|
---|
[de92788] | 169 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
|
---|
[dc32fef] | 170 |
|
---|
[a1a0a65] | 171 | <note>
|
---|
[0c4501b] | 172 | <para>By default, vim only installs spell-checking files for the English language.
|
---|
| 173 | To install spell-checking files for your preferred language, copy the
|
---|
[9d3ba7b] | 174 | <filename class='extension'>.spl</filename> and optionally, the
|
---|
| 175 | <filename class='extension'>.sug</filename> files for your language
|
---|
| 176 | and character encoding from
|
---|
| 177 | <filename class='directory'>runtime/spell</filename> into
|
---|
| 178 | <filename class='directory'>
|
---|
[c37e846] | 179 | /usr/share/&vim-docdir;/spell/</filename>.</para>
|
---|
[c226182] | 180 |
|
---|
[0c4501b] | 181 | <para>To use these spell-checking files, some configuration in
|
---|
[c226182] | 182 | <filename>/etc/vimrc</filename> is needed, e.g.:</para>
|
---|
| 183 |
|
---|
| 184 | <screen><literal>set spelllang=en,ru
|
---|
| 185 | set spell</literal></screen>
|
---|
| 186 |
|
---|
[9d3ba7b] | 187 | <para>For more information, see
|
---|
| 188 | <filename>runtime/spell/README.txt</filename>.</para>
|
---|
[a1a0a65] | 189 | </note>
|
---|
| 190 |
|
---|
[ddd5542] | 191 | </sect2>
|
---|
| 192 |
|
---|
| 193 | <sect2 id="contents-vim" role="content">
|
---|
| 194 | <title>Contents of Vim</title>
|
---|
| 195 |
|
---|
| 196 | <segmentedlist>
|
---|
| 197 | <segtitle>Installed programs</segtitle>
|
---|
[0d81e3c] | 198 | <segtitle>Installed directory</segtitle>
|
---|
[ddd5542] | 199 |
|
---|
| 200 | <seglistitem>
|
---|
[9a483b2] | 201 | <seg> ex (link to vim), rview (link to vim), rvim (link to vim), vi
|
---|
| 202 | (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor,
|
---|
| 203 | and xxd</seg>
|
---|
[0d81e3c] | 204 | <seg>/usr/share/vim</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>
|
---|
[0d84af1] | 281 | and shows differences</para>
|
---|
[ddd5542] | 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
|
---|
[0c4501b] | 303 | also perform the inverse operation, so it can be used for binary
|
---|
| 304 | patching</para>
|
---|
[ddd5542] | 305 | <indexterm zone="ch-system-vim xxd">
|
---|
| 306 | <primary sortas="b-xxd">xxd</primary>
|
---|
| 307 | </indexterm>
|
---|
| 308 | </listitem>
|
---|
| 309 | </varlistentry>
|
---|
| 310 |
|
---|
| 311 | </variablelist>
|
---|
| 312 |
|
---|
| 313 | </sect2>
|
---|
[673b0d8] | 314 |
|
---|
| 315 | </sect1>
|
---|