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">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="ch-system-vim" role="wrap">
|
---|
9 | <?dbhtml filename="vim.html"?>
|
---|
10 |
|
---|
11 | <sect1info condition="script">
|
---|
12 | <productname>vim</productname>
|
---|
13 | <productnumber>&vim-version;</productnumber>
|
---|
14 | <address>&vim-url;</address>
|
---|
15 | </sect1info>
|
---|
16 |
|
---|
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>
|
---|
33 | <seg>&vim-fin-sbu;</seg>
|
---|
34 | <seg>&vim-fin-du;</seg>
|
---|
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
|
---|
43 | url="&blfs-book;postlfs/editors.html"/> for suggested
|
---|
44 | installation instructions.</para>
|
---|
45 | </tip>
|
---|
46 |
|
---|
47 | </sect2>
|
---|
48 |
|
---|
49 | <sect2 role="installation">
|
---|
50 | <title>Installation of Vim</title>
|
---|
51 |
|
---|
52 | <para>First, change the default location of the <filename>vimrc</filename>
|
---|
53 | configuration file to <filename class="directory">/etc</filename>:</para>
|
---|
54 |
|
---|
55 | <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
---|
56 |
|
---|
57 | <para>Prepare Vim for compilation:</para>
|
---|
58 |
|
---|
59 | <screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
|
---|
60 |
|
---|
61 | <para>Compile the package:</para>
|
---|
62 |
|
---|
63 | <screen><userinput remap="make">make</userinput></screen>
|
---|
64 |
|
---|
65 | <para>To prepare the tests, ensure that user
|
---|
66 | <systemitem class="username">tester</systemitem> can write
|
---|
67 | to the source tree:</para>
|
---|
68 |
|
---|
69 | <screen><userinput remap="test">chown -R tester .</userinput></screen>
|
---|
70 |
|
---|
71 | <para>Now run the tests as user <systemitem
|
---|
72 | class="username">tester</systemitem>:</para>
|
---|
73 |
|
---|
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>
|
---|
76 |
|
---|
77 | <para>The test suite outputs a lot of binary data to the screen. This can
|
---|
78 | cause issues with the settings of the current terminal (especially while
|
---|
79 | we are overriding the <envar>TERM</envar> variable to satisfy some
|
---|
80 | assumptions of the test suite). The problem can be
|
---|
81 | avoided by redirecting the output to a log file as shown above. A
|
---|
82 | successful test will result in the words <computeroutput>ALL
|
---|
83 | DONE</computeroutput> in the log file at completion.</para>
|
---|
84 |
|
---|
85 | <para>Install the package:</para>
|
---|
86 |
|
---|
87 | <screen><userinput remap="install">make install</userinput></screen>
|
---|
88 |
|
---|
89 | <para>Many users reflexively type <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
|
---|
92 | symlink for both the binary and the man page in the provided
|
---|
93 | languages:</para>
|
---|
94 |
|
---|
95 | <screen><userinput remap="install">ln -sv vim /usr/bin/vi
|
---|
96 | for L in /usr/share/man/{,*/}man1/vim.1; do
|
---|
97 | ln -sv vim.1 $(dirname $L)/vi.1
|
---|
98 | done</userinput></screen>
|
---|
99 |
|
---|
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>
|
---|
105 |
|
---|
106 | <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
|
---|
107 |
|
---|
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-book;postlfs/vim.html"/>.</para>
|
---|
115 |
|
---|
116 | </sect2>
|
---|
117 |
|
---|
118 | <sect2 id="conf-vim" role="configuration">
|
---|
119 | <title>Configuring Vim</title>
|
---|
120 |
|
---|
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>
|
---|
133 |
|
---|
134 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
135 | <literal>" Begin /etc/vimrc
|
---|
136 |
|
---|
137 | " Ensure defaults are set before customizing settings, not after
|
---|
138 | source $VIMRUNTIME/defaults.vim
|
---|
139 | let skip_defaults_vim=1
|
---|
140 |
|
---|
141 | set nocompatible
|
---|
142 | set backspace=2
|
---|
143 | set mouse=
|
---|
144 | syntax on
|
---|
145 | if (&term == "xterm") || (&term == "putty")
|
---|
146 | set background=dark
|
---|
147 | endif
|
---|
148 |
|
---|
149 | " End /etc/vimrc</literal>
|
---|
150 | EOF</userinput></screen>
|
---|
151 |
|
---|
152 | <para>The <parameter>set nocompatible</parameter> setting makes
|
---|
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
|
---|
157 | an insert. The <parameter>syntax on</parameter> parameter enables vim's syntax
|
---|
158 | highlighting. The <parameter>set mouse=</parameter> setting enables
|
---|
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>
|
---|
165 |
|
---|
166 | <para>Documentation for other available options can be obtained by
|
---|
167 | running the following command:</para>
|
---|
168 |
|
---|
169 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
|
---|
170 |
|
---|
171 | <note>
|
---|
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
|
---|
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'>
|
---|
179 | /usr/share/&vim-docdir;/spell/</filename>.</para>
|
---|
180 |
|
---|
181 | <para>To use these spell-checking files, some configuration in
|
---|
182 | <filename>/etc/vimrc</filename> is needed, e.g.:</para>
|
---|
183 |
|
---|
184 | <screen><literal>set spelllang=en,ru
|
---|
185 | set spell</literal></screen>
|
---|
186 |
|
---|
187 | <para>For more information, see
|
---|
188 | <filename>runtime/spell/README.txt</filename>.</para>
|
---|
189 | </note>
|
---|
190 |
|
---|
191 | </sect2>
|
---|
192 |
|
---|
193 | <sect2 id="contents-vim" role="content">
|
---|
194 | <title>Contents of Vim</title>
|
---|
195 |
|
---|
196 | <segmentedlist>
|
---|
197 | <segtitle>Installed programs</segtitle>
|
---|
198 | <segtitle>Installed directory</segtitle>
|
---|
199 |
|
---|
200 | <seglistitem>
|
---|
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>
|
---|
204 | <seg>/usr/share/vim</seg>
|
---|
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 |
|
---|
247 | <varlistentry id="vi">
|
---|
248 | <term><command>vi</command></term>
|
---|
249 | <listitem>
|
---|
250 | <para>Link to <command>vim</command></para>
|
---|
251 | <indexterm zone="ch-system-vim vi">
|
---|
252 | <primary sortas="b-vi">vi</primary>
|
---|
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>
|
---|
281 | and shows differences</para>
|
---|
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
|
---|
303 | also perform the inverse operation, so it can be used for binary
|
---|
304 | patching</para>
|
---|
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>
|
---|
314 |
|
---|
315 | </sect1>
|
---|