1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
8 <sect1 id="ch-system-vim" role="wrap">
9 <?dbhtml filename="vim.html"?>
11 <sect1info condition="script">
12 <productname>vim</productname>
13 <productnumber>&vim-version;</productnumber>
14 <address>&vim-url;</address>
17 <title>Vim-&vim-version;</title>
19 <indexterm zone="ch-system-vim">
20 <primary sortas="a-Vim">Vim</primary>
23 <sect2 role="package">
26 <para>The Vim package contains a powerful text editor.</para>
29 <segtitle>&buildtime;</segtitle>
30 <segtitle>&diskspace;</segtitle>
33 <seg>&vim-ch6-sbu;</seg>
34 <seg>&vim-ch6-du;</seg>
39 <title>Alternatives to Vim</title>
41 <para>If you prefer another editor—such as Emacs, Joe, or
42 Nano—please refer to <ulink
43 url="&blfs-book;postlfs/editors.html"/> for suggested
44 installation instructions.</para>
49 <sect2 role="installation">
50 <title>Installation of Vim</title>
52 <para>First, change the default location of the <filename>vimrc</filename>
53 configuration file to <filename class="directory">/etc</filename>:</para>
55 <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
57 <!-- <para>Disable a test that fails:</para>
59 <screen><userinput remap="pre">sed -i '/call/{s/split/xsplit/;s/303/492/}' src/testdir/test_recover.vim</userinput></screen>
61 <para>Prepare Vim for compilation:</para>
63 <screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
65 <para>Compile the package:</para>
67 <screen><userinput remap="make">make</userinput></screen>
69 <para>To test the results, issue:</para>
71 <screen><userinput remap="test">LANG=en_US.UTF-8 make -j1 test &> vim-test.log</userinput></screen>
73 <para>The test suite outputs a lot of binary data to the screen. This can
74 cause issues with the settings of the current terminal. The problem can be
75 avoided by redirecting the output to a log file as shown above. A
76 successful test will result in the words "ALL DONE" in the log file
79 <para>Install the package:</para>
81 <screen><userinput remap="install">make install</userinput></screen>
83 <para>Many users are used to using <command>vi</command> instead of
84 <command>vim</command>. To allow execution of <command>vim</command>
85 when users habitually enter <command>vi</command>, create a
86 symlink for both the binary and the man page in the provided
89 <screen><userinput remap="install">ln -sv vim /usr/bin/vi
90 for L in /usr/share/man/{,*/}man1/vim.1; do
91 ln -sv vim.1 $(dirname $L)/vi.1
92 done</userinput></screen>
94 <para>By default, Vim's documentation is installed in <filename
95 class="directory">/usr/share/vim</filename>. The following symlink
96 allows the documentation to be accessed via <filename
97 class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
98 it consistent with the location of documentation for other packages:</para>
100 <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
102 <para>If an X Window System is going to be installed on the LFS
103 system, it may be necessary to recompile Vim after installing X. Vim
104 comes with a GUI version of the editor that requires X and some
105 additional libraries to be installed. For more information on this
106 process, refer to the Vim documentation and the Vim installation page
107 in the BLFS book at <ulink
108 url="&blfs-book;postlfs/vim.html"/>.</para>
112 <sect2 id="conf-vim" role="configuration">
113 <title>Configuring Vim</title>
115 <indexterm zone="conf-vim">
116 <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
119 <para>By default, <command>vim</command> runs in vi-incompatible mode.
120 This may be new to users who have used other editors in the past. The
121 <quote>nocompatible</quote> setting is included below to highlight the
122 fact that a new behavior is being used. It also reminds those who would
123 change to <quote>compatible</quote> mode that it should be the first
124 setting in the configuration file. This is necessary because it changes
125 other settings, and overrides must come after this setting. Create a default
126 <command>vim</command> configuration file by running the following:</para>
128 <screen><userinput>cat > /etc/vimrc << "EOF"
129 <literal>" Begin /etc/vimrc
131 " Ensure defaults are set before customizing settings, not after
132 source $VIMRUNTIME/defaults.vim
133 let skip_defaults_vim=1
139 if (&term == "xterm") || (&term == "putty")
143 " End /etc/vimrc</literal>
144 EOF</userinput></screen>
146 <para>The <parameter>set nocompatible</parameter> setting makes
147 <command>vim</command> behave in a more useful way (the default) than the
148 vi-compatible manner. Remove the <quote>no</quote> to keep the old
149 <command>vi</command> behavior. The <parameter>set backspace=2</parameter>
150 setting allows backspacing over line breaks, autoindents, and the start of
151 insert. The <parameter>syntax on</parameter> parameter enables vim's syntax
152 highlighting. The <parameter>set mouse=</parameter> setting enables
153 proper pasting of text with the mouse when working in chroot or over a
154 remote connection. Finally, the <emphasis>if</emphasis> statement with the
155 <parameter>set background=dark</parameter> setting corrects
156 <command>vim</command>'s guess about the background color of some terminal
157 emulators. This gives the highlighting a better color scheme for use on the
158 black background of these programs.</para>
160 <para>Creating an empty <filename>~/.vimrc</filename> prevents vim from
161 overriding settings in <filename>/etc/vimrc</filename> by using
162 <filename>/usr/share/vim/vim80/defaults.vim</filename>.</para>
164 <para>Documentation for other available options can be obtained by
165 running the following command:</para>
167 <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
170 <para>By default, Vim only installs spell files for the English language.
171 To install spell files for your preferred language, download the
172 <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
173 files for your language and character encoding from <ulink
174 url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
175 <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
177 <para>To use these spell files, some configuration in
178 <filename>/etc/vimrc</filename> is needed, e.g.:</para>
180 <screen><literal>set spelllang=en,ru
181 set spell</literal></screen>
183 <para>For more information, see the appropriate README file located
184 at the URL above.</para>
189 <sect2 id="contents-vim" role="content">
190 <title>Contents of Vim</title>
193 <segtitle>Installed programs</segtitle>
194 <segtitle>Installed directory</segtitle>
197 <seg> ex (link to vim), rview (link to vim), rvim (link to vim), vi
198 (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor,
200 <seg>/usr/share/vim</seg>
205 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
206 <?dbfo list-presentation="list"?>
207 <?dbhtml list-presentation="table"?>
209 <varlistentry id="ex">
210 <term><command>ex</command></term>
212 <para>Starts <command>vim</command> in ex mode</para>
213 <indexterm zone="ch-system-vim ex">
214 <primary sortas="b-ex">ex</primary>
219 <varlistentry id="rview">
220 <term><command>rview</command></term>
222 <para>Is a restricted version of <command>view</command>; no shell
223 commands can be started and <command>view</command> cannot be
225 <indexterm zone="ch-system-vim rview">
226 <primary sortas="b-rview">rview</primary>
231 <varlistentry id="rvim">
232 <term><command>rvim</command></term>
234 <para>Is a restricted version of <command>vim</command>; no shell
235 commands can be started and <command>vim</command> cannot be
237 <indexterm zone="ch-system-vim rvim">
238 <primary sortas="b-rvim">rvim</primary>
243 <varlistentry id="vi">
244 <term><command>vi</command></term>
246 <para>Link to <command>vim</command></para>
247 <indexterm zone="ch-system-vim vi">
248 <primary sortas="b-vi">vi</primary>
253 <varlistentry id="view">
254 <term><command>view</command></term>
256 <para>Starts <command>vim</command> in read-only mode</para>
257 <indexterm zone="ch-system-vim view">
258 <primary sortas="b-view">view</primary>
263 <varlistentry id="vim">
264 <term><command>vim</command></term>
266 <para>Is the editor</para>
267 <indexterm zone="ch-system-vim vim">
268 <primary sortas="b-vim">vim</primary>
273 <varlistentry id="vimdiff">
274 <term><command>vimdiff</command></term>
276 <para>Edits two or three versions of a file with <command>vim</command>
277 and shows differences</para>
278 <indexterm zone="ch-system-vim vimdiff">
279 <primary sortas="b-vimdiff">vimdiff</primary>
284 <varlistentry id="vimtutor">
285 <term><command>vimtutor</command></term>
287 <para>Teaches the basic keys and commands of
288 <command>vim</command></para>
289 <indexterm zone="ch-system-vim vimtutor">
290 <primary sortas="b-vimtutor">vimtutor</primary>
295 <varlistentry id="xxd">
296 <term><command>xxd</command></term>
298 <para>Creates a hex dump of the given file; it can
299 also do the reverse, so it can be used for binary patching</para>
300 <indexterm zone="ch-system-vim xxd">
301 <primary sortas="b-xxd">xxd</primary>