1 <?xml version="1.0" encoding="UTF-8"?>
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-fin-sbu;</seg>
34 <seg>&vim-fin-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>Prepare Vim for compilation:</para>
59 <screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
61 <para>Compile the package:</para>
63 <screen><userinput remap="make">make</userinput></screen>
65 <para>To prepare the tests, ensure that user
66 <systemitem class="username">tester</systemitem> can write
67 to the source tree and exclude one file containing tests requiring
68 <command>curl</command> or <command>wget</command>:</para>
70 <screen><userinput remap="test">chown -R tester .
71 sed '/test_glvs/d' -i src/testdir/Make_all.mak</userinput></screen>
73 <para>Now run the tests as user <systemitem
74 class="username">tester</systemitem>:</para>
76 <screen><userinput remap="test">su tester -c "TERM=xterm-256color LANG=en_US.UTF-8 make -j1 test" \
77 &> vim-test.log</userinput></screen>
79 <para>The test suite outputs a lot of binary data to the screen. This can
80 cause issues with the settings of the current terminal (especially while
81 we are overriding the <envar>TERM</envar> variable to satisfy some
82 assumptions of the test suite). The problem can be
83 avoided by redirecting the output to a log file as shown above. A
84 successful test will result in the words <computeroutput>ALL
85 DONE</computeroutput> in the log file at completion.</para>
87 <para>Install the package:</para>
89 <screen><userinput remap="install">make install</userinput></screen>
91 <para>Many users reflexively type <command>vi</command> instead of
92 <command>vim</command>. To allow execution of <command>vim</command>
93 when users habitually enter <command>vi</command>, create a
94 symlink for both the binary and the man page in the provided
97 <screen><userinput remap="install">ln -sv vim /usr/bin/vi
98 for L in /usr/share/man/{,*/}man1/vim.1; do
99 ln -sv vim.1 $(dirname $L)/vi.1
100 done</userinput></screen>
102 <para>By default, Vim's documentation is installed in <filename
103 class="directory">/usr/share/vim</filename>. The following symlink
104 allows the documentation to be accessed via <filename
105 class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
106 it consistent with the location of documentation for other packages:</para>
108 <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
110 <para>If an X Window System is going to be installed on the LFS
111 system, it may be necessary to recompile Vim after installing X. Vim
112 comes with a GUI version of the editor that requires X and some
113 additional libraries to be installed. For more information on this
114 process, refer to the Vim documentation and the Vim installation page
115 in the BLFS book at <ulink
116 url="&blfs-book;postlfs/vim.html"/>.</para>
120 <sect2 id="conf-vim" role="configuration">
121 <title>Configuring Vim</title>
123 <indexterm zone="conf-vim">
124 <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
127 <para>By default, <command>vim</command> runs in vi-incompatible mode.
128 This may be new to users who have used other editors in the past. The
129 <quote>nocompatible</quote> setting is included below to highlight the
130 fact that a new behavior is being used. It also reminds those who would
131 change to <quote>compatible</quote> mode that it should be the first
132 setting in the configuration file. This is necessary because it changes
133 other settings, and overrides must come after this setting. Create a default
134 <command>vim</command> configuration file by running the following:</para>
136 <screen><userinput>cat > /etc/vimrc << "EOF"
137 <literal>" Begin /etc/vimrc
139 " Ensure defaults are set before customizing settings, not after
140 source $VIMRUNTIME/defaults.vim
141 let skip_defaults_vim=1
147 if (&term == "xterm") || (&term == "putty")
151 " End /etc/vimrc</literal>
152 EOF</userinput></screen>
154 <para>The <parameter>set nocompatible</parameter> setting makes
155 <command>vim</command> behave in a more useful way (the default) than the
156 vi-compatible manner. Remove the <quote>no</quote> to keep the old
157 <command>vi</command> behavior. The <parameter>set backspace=2</parameter>
158 setting allows backspacing over line breaks, autoindents, and the start of
159 an insert. The <parameter>syntax on</parameter> parameter enables vim's syntax
160 highlighting. The <parameter>set mouse=</parameter> setting enables
161 proper pasting of text with the mouse when working in chroot or over a
162 remote connection. Finally, the <emphasis>if</emphasis> statement with the
163 <parameter>set background=dark</parameter> setting corrects
164 <command>vim</command>'s guess about the background color of some terminal
165 emulators. This gives the highlighting a better color scheme for use on the
166 black background of these programs.</para>
168 <para>Documentation for other available options can be obtained by
169 running the following command:</para>
171 <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
174 <para>By default, vim only installs spell-checking files for the English language.
175 To install spell-checking files for your preferred language, copy the
176 <filename class='extension'>.spl</filename> and optionally, the
177 <filename class='extension'>.sug</filename> files for your language
178 and character encoding from
179 <filename class='directory'>runtime/spell</filename> into
180 <filename class='directory'>
181 /usr/share/&vim-docdir;/spell/</filename>.</para>
183 <para>To use these spell-checking files, some configuration in
184 <filename>/etc/vimrc</filename> is needed, e.g.:</para>
186 <screen><literal>set spelllang=en,ru
187 set spell</literal></screen>
189 <para>For more information, see
190 <filename>runtime/spell/README.txt</filename>.</para>
195 <sect2 id="contents-vim" role="content">
196 <title>Contents of Vim</title>
199 <segtitle>Installed programs</segtitle>
200 <segtitle>Installed directory</segtitle>
203 <seg> ex (link to vim), rview (link to vim), rvim (link to vim), vi
204 (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor,
206 <seg>/usr/share/vim</seg>
211 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
212 <?dbfo list-presentation="list"?>
213 <?dbhtml list-presentation="table"?>
215 <varlistentry id="ex">
216 <term><command>ex</command></term>
218 <para>Starts <command>vim</command> in ex mode</para>
219 <indexterm zone="ch-system-vim ex">
220 <primary sortas="b-ex">ex</primary>
225 <varlistentry id="rview">
226 <term><command>rview</command></term>
228 <para>Is a restricted version of <command>view</command>; no shell
229 commands can be started and <command>view</command> cannot be
231 <indexterm zone="ch-system-vim rview">
232 <primary sortas="b-rview">rview</primary>
237 <varlistentry id="rvim">
238 <term><command>rvim</command></term>
240 <para>Is a restricted version of <command>vim</command>; no shell
241 commands can be started and <command>vim</command> cannot be
243 <indexterm zone="ch-system-vim rvim">
244 <primary sortas="b-rvim">rvim</primary>
249 <varlistentry id="vi">
250 <term><command>vi</command></term>
252 <para>Link to <command>vim</command></para>
253 <indexterm zone="ch-system-vim vi">
254 <primary sortas="b-vi">vi</primary>
259 <varlistentry id="view">
260 <term><command>view</command></term>
262 <para>Starts <command>vim</command> in read-only mode</para>
263 <indexterm zone="ch-system-vim view">
264 <primary sortas="b-view">view</primary>
269 <varlistentry id="vim">
270 <term><command>vim</command></term>
272 <para>Is the editor</para>
273 <indexterm zone="ch-system-vim vim">
274 <primary sortas="b-vim">vim</primary>
279 <varlistentry id="vimdiff">
280 <term><command>vimdiff</command></term>
282 <para>Edits two or three versions of a file with <command>vim</command>
283 and shows differences</para>
284 <indexterm zone="ch-system-vim vimdiff">
285 <primary sortas="b-vimdiff">vimdiff</primary>
290 <varlistentry id="vimtutor">
291 <term><command>vimtutor</command></term>
293 <para>Teaches the basic keys and commands of
294 <command>vim</command></para>
295 <indexterm zone="ch-system-vim vimtutor">
296 <primary sortas="b-vimtutor">vimtutor</primary>
301 <varlistentry id="xxd">
302 <term><command>xxd</command></term>
304 <para>Creates a hex dump of the given file; it can
305 also perform the inverse operation, so it can be used for binary
307 <indexterm zone="ch-system-vim xxd">
308 <primary sortas="b-xxd">xxd</primary>