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">
|
---|
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;<otheraddr>&vim-lang-url;</otheraddr></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-ch6-sbu;</seg>
|
---|
34 | <seg>&vim-ch6-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-root;view/svn/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, unpack both
|
---|
53 | <filename>vim-&vim-version;.tar.bz2</filename> and (optionally)
|
---|
54 | <filename>vim-&vim-version;-lang.tar.gz</filename> archives into the
|
---|
55 | same directory.</para>
|
---|
56 |
|
---|
57 | <para>Apply a patch which fixes various issues already found and fixed by
|
---|
58 | the upstream maintainers since the inital release of Vim-&vim-version;:
|
---|
59 | </para>
|
---|
60 |
|
---|
61 | <screen><userinput remap="pre">patch -Np1 -i ../&vim-fixes-patch;</userinput></screen>
|
---|
62 |
|
---|
63 | <para>This version of Vim installs translated man pages and places
|
---|
64 | them into directories that will not be searched by Man-DB. Patch Vim
|
---|
65 | so that it installs its man pages into searchable directories and
|
---|
66 | ultimately allows Man-DB to transcode the page into the desired format
|
---|
67 | at run-time:</para>
|
---|
68 |
|
---|
69 | <screen><userinput remap="pre">patch -Np1 -i ../&vim-mandir-patch;</userinput></screen>
|
---|
70 |
|
---|
71 | <para>Finally, change the default location of the
|
---|
72 | <filename>vimrc</filename> configuration file to <filename
|
---|
73 | class="directory">/etc</filename>:</para>
|
---|
74 |
|
---|
75 | <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
---|
76 |
|
---|
77 | <para>Now prepare Vim for compilation:</para>
|
---|
78 |
|
---|
79 | <screen><userinput remap="configure">./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
80 |
|
---|
81 | <variablelist>
|
---|
82 | <title>The meaning of the configure options:</title>
|
---|
83 |
|
---|
84 | <varlistentry>
|
---|
85 | <term><parameter>--enable-multibyte</parameter></term>
|
---|
86 | <listitem>
|
---|
87 | <para>This switch enables support for editing files in multibyte
|
---|
88 | character encodings. This is needed if using a locale with a
|
---|
89 | multibyte character set. This switch is also helpful to be able
|
---|
90 | to edit text files initially created in Linux distributions like
|
---|
91 | Fedora Core that use UTF-8 as a default character set.</para>
|
---|
92 | </listitem>
|
---|
93 | </varlistentry>
|
---|
94 |
|
---|
95 | </variablelist>
|
---|
96 |
|
---|
97 | <para>Compile the package:</para>
|
---|
98 |
|
---|
99 | <screen><userinput remap="make">make</userinput></screen>
|
---|
100 |
|
---|
101 | <para>To test the results, issue:</para>
|
---|
102 |
|
---|
103 | <screen><userinput remap="test">make test</userinput></screen>
|
---|
104 |
|
---|
105 | <para>However, this test suite outputs a lot of binary data to the screen,
|
---|
106 | which can cause issues with the settings of the current terminal. This can
|
---|
107 | be resolved by redirecting the output to a log file.</para>
|
---|
108 |
|
---|
109 | <para>Install the package:</para>
|
---|
110 |
|
---|
111 | <screen><userinput remap="install">make install</userinput></screen>
|
---|
112 |
|
---|
113 | <para>Many users are used to using <command>vi</command> instead of
|
---|
114 | <command>vim</command>. To allow execution of <command>vim</command>
|
---|
115 | when users habitually enter <command>vi</command>, create a
|
---|
116 | symlink for both the binary and the man page in the provided
|
---|
117 | languages:</para>
|
---|
118 |
|
---|
119 | <screen><userinput remap="install">ln -sv vim /usr/bin/vi
|
---|
120 | for L in "" fr it pl ru; do
|
---|
121 | ln -sv vim.1 /usr/share/man/$L/man1/vi.1
|
---|
122 | done</userinput></screen>
|
---|
123 |
|
---|
124 | <para>By default, Vim's documentation is installed in <filename
|
---|
125 | class="directory">/usr/share/vim</filename>. The following symlink
|
---|
126 | allows the documentation to be accessed via <filename
|
---|
127 | class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
|
---|
128 | it consistent with the location of documentation for other packages:</para>
|
---|
129 |
|
---|
130 | <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
|
---|
131 |
|
---|
132 | <para>If an X Window System is going to be installed on the LFS
|
---|
133 | system, it may be necessary to recompile Vim after installing X. Vim
|
---|
134 | comes with a GUI version of the editor that requires X and some
|
---|
135 | additional libraries to be installed. For more information on this
|
---|
136 | process, refer to the Vim documentation and the Vim installation page
|
---|
137 | in the BLFS book at <ulink
|
---|
138 | url="&blfs-root;view/svn/postlfs/editors.html#postlfs-editors-vim"/>.</para>
|
---|
139 |
|
---|
140 | </sect2>
|
---|
141 |
|
---|
142 | <sect2 id="conf-vim" role="configuration">
|
---|
143 | <title>Configuring Vim</title>
|
---|
144 |
|
---|
145 | <indexterm zone="conf-vim">
|
---|
146 | <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
|
---|
147 | </indexterm>
|
---|
148 |
|
---|
149 | <para>By default, <command>vim</command> runs in vi-incompatible mode.
|
---|
150 | This may be new to users who have used other editors in the past. The
|
---|
151 | <quote>nocompatible</quote> setting is included below to highlight the
|
---|
152 | fact that a new behavior is being used. It also reminds those who would
|
---|
153 | change to <quote>compatible</quote> mode that it should be the first
|
---|
154 | setting in the configuration file. This is necessary because it changes
|
---|
155 | other settings, and overrides must come after this setting. Create a default
|
---|
156 | <command>vim</command> configuration file by running the following:</para>
|
---|
157 |
|
---|
158 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
159 | <literal>" Begin /etc/vimrc
|
---|
160 |
|
---|
161 | set nocompatible
|
---|
162 | set backspace=2
|
---|
163 | syntax on
|
---|
164 | if (&term == "iterm") || (&term == "putty")
|
---|
165 | set background=dark
|
---|
166 | endif
|
---|
167 |
|
---|
168 | " End /etc/vimrc</literal>
|
---|
169 | EOF</userinput></screen>
|
---|
170 |
|
---|
171 | <para>The <parameter>set nocompatible</parameter> setting makes
|
---|
172 | <command>vim</command> behave in a more useful way (the default) than
|
---|
173 | the vi-compatible manner. Remove the <quote>no</quote> to keep the
|
---|
174 | old <command>vi</command> behavior. The <parameter>set
|
---|
175 | backspace=2</parameter> setting allows backspacing over line breaks,
|
---|
176 | autoindents, and the start of insert. The <parameter>syntax
|
---|
177 | on</parameter> parameter enables vim's syntax highlighting. Finally,
|
---|
178 | the <emphasis>if</emphasis> statement with the <parameter>set
|
---|
179 | background=dark</parameter> setting corrects <command>vim</command>'s
|
---|
180 | guess about the background color of some terminal emulators. This
|
---|
181 | gives the highlighting a better color scheme for use on the black
|
---|
182 | background of these programs.</para>
|
---|
183 |
|
---|
184 | <para>Documentation for other available options can be obtained by
|
---|
185 | running the following command:</para>
|
---|
186 |
|
---|
187 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
|
---|
188 |
|
---|
189 | <note>
|
---|
190 | <para>By default, Vim only installs spell files for the English language.
|
---|
191 | To install spell files for your preferred language, download the
|
---|
192 | <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
|
---|
193 | files for your language and character encoding from <ulink
|
---|
194 | url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
|
---|
195 | <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
|
---|
196 |
|
---|
197 | <para>To use these spell files, some configuration in
|
---|
198 | <filename>/etc/vimrc</filename> is needed, e.g.:</para>
|
---|
199 |
|
---|
200 | <screen><literal>set spelllang=en,ru
|
---|
201 | set spell</literal></screen>
|
---|
202 |
|
---|
203 | <para>For more information, see the appropriate README file located
|
---|
204 | at the URL above.</para>
|
---|
205 | </note>
|
---|
206 |
|
---|
207 | </sect2>
|
---|
208 |
|
---|
209 | <sect2 id="contents-vim" role="content">
|
---|
210 | <title>Contents of Vim</title>
|
---|
211 |
|
---|
212 | <segmentedlist>
|
---|
213 | <segtitle>Installed programs</segtitle>
|
---|
214 |
|
---|
215 | <seglistitem>
|
---|
216 | <seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
|
---|
217 | pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl,
|
---|
218 | vi (link to vim), view (link to vim), vim, vim132, vim2html.pl,
|
---|
219 | vimdiff (link to vim), vimm, vimspell.sh, vimtutor, and xxd</seg>
|
---|
220 | </seglistitem>
|
---|
221 | </segmentedlist>
|
---|
222 |
|
---|
223 | <variablelist>
|
---|
224 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
225 | <?dbfo list-presentation="list"?>
|
---|
226 | <?dbhtml list-presentation="table"?>
|
---|
227 |
|
---|
228 | <varlistentry id="efm_filter.pl">
|
---|
229 | <term><command>efm_filter.pl</command></term>
|
---|
230 | <listitem>
|
---|
231 | <para>A filter for creating an error file that can be read
|
---|
232 | by <command>vim</command></para>
|
---|
233 | <indexterm zone="ch-system-vim efm_filter.pl">
|
---|
234 | <primary sortas="b-efm_filter.pl">efm_filter.pl</primary>
|
---|
235 | </indexterm>
|
---|
236 | </listitem>
|
---|
237 | </varlistentry>
|
---|
238 |
|
---|
239 | <varlistentry id="efm_perl.pl">
|
---|
240 | <term><command>efm_perl.pl</command></term>
|
---|
241 | <listitem>
|
---|
242 | <para>Reformats the error messages of the Perl interpreter for use
|
---|
243 | with the <quote>quickfix</quote> mode of <command>vim</command></para>
|
---|
244 | <indexterm zone="ch-system-vim efm_perl.pl">
|
---|
245 | <primary sortas="b-efm_perl.pl">efm_perl.pl</primary>
|
---|
246 | </indexterm>
|
---|
247 | </listitem>
|
---|
248 | </varlistentry>
|
---|
249 |
|
---|
250 | <varlistentry id="ex">
|
---|
251 | <term><command>ex</command></term>
|
---|
252 | <listitem>
|
---|
253 | <para>Starts <command>vim</command> in ex mode</para>
|
---|
254 | <indexterm zone="ch-system-vim ex">
|
---|
255 | <primary sortas="b-ex">ex</primary>
|
---|
256 | </indexterm>
|
---|
257 | </listitem>
|
---|
258 | </varlistentry>
|
---|
259 |
|
---|
260 | <varlistentry id="less.sh">
|
---|
261 | <term><command>less.sh</command></term>
|
---|
262 | <listitem>
|
---|
263 | <para>A script that starts <command>vim</command> with less.vim</para>
|
---|
264 | <indexterm zone="ch-system-vim less.sh">
|
---|
265 | <primary sortas="b-less.sh">less.sh</primary>
|
---|
266 | </indexterm>
|
---|
267 | </listitem>
|
---|
268 | </varlistentry>
|
---|
269 |
|
---|
270 | <varlistentry id="mve.awk">
|
---|
271 | <term><command>mve.awk</command></term>
|
---|
272 | <listitem>
|
---|
273 | <para>Processes <command>vim</command> errors</para>
|
---|
274 | <indexterm zone="ch-system-vim mve.awk">
|
---|
275 | <primary sortas="b-mve.awk">mve.awk</primary>
|
---|
276 | </indexterm>
|
---|
277 | </listitem>
|
---|
278 | </varlistentry>
|
---|
279 |
|
---|
280 | <varlistentry id="pltags.pl">
|
---|
281 | <term><command>pltags.pl</command></term>
|
---|
282 | <listitem>
|
---|
283 | <para>Creates a tags file for Perl code for use by
|
---|
284 | <command>vim</command></para>
|
---|
285 | <indexterm zone="ch-system-vim pltags.pl">
|
---|
286 | <primary sortas="b-pltags.pl">pltags.pl</primary>
|
---|
287 | </indexterm>
|
---|
288 | </listitem>
|
---|
289 | </varlistentry>
|
---|
290 |
|
---|
291 | <varlistentry id="ref">
|
---|
292 | <term><command>ref</command></term>
|
---|
293 | <listitem>
|
---|
294 | <para>Checks the spelling of arguments</para>
|
---|
295 | <indexterm zone="ch-system-vim ref">
|
---|
296 | <primary sortas="b-ref">ref</primary>
|
---|
297 | </indexterm>
|
---|
298 | </listitem>
|
---|
299 | </varlistentry>
|
---|
300 |
|
---|
301 | <varlistentry id="rview">
|
---|
302 | <term><command>rview</command></term>
|
---|
303 | <listitem>
|
---|
304 | <para>Is a restricted version of <command>view</command>; no shell
|
---|
305 | commands can be started and <command>view</command> cannot be
|
---|
306 | suspended</para>
|
---|
307 | <indexterm zone="ch-system-vim rview">
|
---|
308 | <primary sortas="b-rview">rview</primary>
|
---|
309 | </indexterm>
|
---|
310 | </listitem>
|
---|
311 | </varlistentry>
|
---|
312 |
|
---|
313 | <varlistentry id="rvim">
|
---|
314 | <term><command>rvim</command></term>
|
---|
315 | <listitem>
|
---|
316 | <para>Is a restricted version of <command>vim</command>; no shell
|
---|
317 | commands can be started and <command>vim</command> cannot be
|
---|
318 | suspended</para>
|
---|
319 | <indexterm zone="ch-system-vim rvim">
|
---|
320 | <primary sortas="b-rvim">rvim</primary>
|
---|
321 | </indexterm>
|
---|
322 | </listitem>
|
---|
323 | </varlistentry>
|
---|
324 |
|
---|
325 | <varlistentry id="shtags.pl">
|
---|
326 | <term><command>shtags.pl</command></term>
|
---|
327 | <listitem>
|
---|
328 | <para>Generates a tags file for Perl scripts</para>
|
---|
329 | <indexterm zone="ch-system-vim shtags.pl">
|
---|
330 | <primary sortas="b-shtags.pl">shtags.pl</primary>
|
---|
331 | </indexterm>
|
---|
332 | </listitem>
|
---|
333 | </varlistentry>
|
---|
334 |
|
---|
335 | <varlistentry id="vi">
|
---|
336 | <term><command>vi</command></term>
|
---|
337 | <listitem>
|
---|
338 | <para>Link to <command>vim</command></para>
|
---|
339 | <indexterm zone="ch-system-vim vi">
|
---|
340 | <primary sortas="b-vi">vi</primary>
|
---|
341 | </indexterm>
|
---|
342 | </listitem>
|
---|
343 | </varlistentry>
|
---|
344 |
|
---|
345 | <varlistentry id="view">
|
---|
346 | <term><command>view</command></term>
|
---|
347 | <listitem>
|
---|
348 | <para>Starts <command>vim</command> in read-only mode</para>
|
---|
349 | <indexterm zone="ch-system-vim view">
|
---|
350 | <primary sortas="b-view">view</primary>
|
---|
351 | </indexterm>
|
---|
352 | </listitem>
|
---|
353 | </varlistentry>
|
---|
354 |
|
---|
355 | <varlistentry id="vim">
|
---|
356 | <term><command>vim</command></term>
|
---|
357 | <listitem>
|
---|
358 | <para>Is the editor</para>
|
---|
359 | <indexterm zone="ch-system-vim vim">
|
---|
360 | <primary sortas="b-vim">vim</primary>
|
---|
361 | </indexterm>
|
---|
362 | </listitem>
|
---|
363 | </varlistentry>
|
---|
364 |
|
---|
365 | <varlistentry id="vim132">
|
---|
366 | <term><command>vim132</command></term>
|
---|
367 | <listitem>
|
---|
368 | <para>Starts <command>vim</command> with the terminal in 132-column
|
---|
369 | mode</para>
|
---|
370 | <indexterm zone="ch-system-vim vim132">
|
---|
371 | <primary sortas="b-vim132">vim132</primary>
|
---|
372 | </indexterm>
|
---|
373 | </listitem>
|
---|
374 | </varlistentry>
|
---|
375 |
|
---|
376 | <varlistentry id="vim2html.pl">
|
---|
377 | <term><command>vim2html.pl</command></term>
|
---|
378 | <listitem>
|
---|
379 | <para>Converts Vim documentation to HypterText Markup Language
|
---|
380 | (HTML)</para>
|
---|
381 | <indexterm zone="ch-system-vim vim2html.pl">
|
---|
382 | <primary sortas="b-vim2html.pl">vim2html.pl</primary>
|
---|
383 | </indexterm>
|
---|
384 | </listitem>
|
---|
385 | </varlistentry>
|
---|
386 |
|
---|
387 | <varlistentry id="vimdiff">
|
---|
388 | <term><command>vimdiff</command></term>
|
---|
389 | <listitem>
|
---|
390 | <para>Edits two or three versions of a file with <command>vim</command>
|
---|
391 | and show differences</para>
|
---|
392 | <indexterm zone="ch-system-vim vimdiff">
|
---|
393 | <primary sortas="b-vimdiff">vimdiff</primary>
|
---|
394 | </indexterm>
|
---|
395 | </listitem>
|
---|
396 | </varlistentry>
|
---|
397 |
|
---|
398 | <varlistentry id="vimm">
|
---|
399 | <term><command>vimm</command></term>
|
---|
400 | <listitem>
|
---|
401 | <para>Enables the DEC locator input model on a remote terminal</para>
|
---|
402 | <indexterm zone="ch-system-vim vimm">
|
---|
403 | <primary sortas="b-vimm">vimm</primary>
|
---|
404 | </indexterm>
|
---|
405 | </listitem>
|
---|
406 | </varlistentry>
|
---|
407 |
|
---|
408 | <varlistentry id="vimspell.sh">
|
---|
409 | <term><command>vimspell.sh</command></term>
|
---|
410 | <listitem>
|
---|
411 | <para>Spell checks a file and generates the syntax statements
|
---|
412 | necessary to highlight in <command>vim</command>. This script
|
---|
413 | requires the old Unix <command>spell</command> command, which
|
---|
414 | is provided neither in LFS nor in BLFS</para>
|
---|
415 | <indexterm zone="ch-system-vim vimspell.sh">
|
---|
416 | <primary sortas="b-vimspell.sh">vimspell.sh</primary>
|
---|
417 | </indexterm>
|
---|
418 | </listitem>
|
---|
419 | </varlistentry>
|
---|
420 |
|
---|
421 | <varlistentry id="vimtutor">
|
---|
422 | <term><command>vimtutor</command></term>
|
---|
423 | <listitem>
|
---|
424 | <para>Teaches the basic keys and commands of
|
---|
425 | <command>vim</command></para>
|
---|
426 | <indexterm zone="ch-system-vim vimtutor">
|
---|
427 | <primary sortas="b-vimtutor">vimtutor</primary>
|
---|
428 | </indexterm>
|
---|
429 | </listitem>
|
---|
430 | </varlistentry>
|
---|
431 |
|
---|
432 | <varlistentry id="xxd">
|
---|
433 | <term><command>xxd</command></term>
|
---|
434 | <listitem>
|
---|
435 | <para>Creates a hex dump of the given file; it can
|
---|
436 | also do the reverse, so it can be used for binary patching</para>
|
---|
437 | <indexterm zone="ch-system-vim xxd">
|
---|
438 | <primary sortas="b-xxd">xxd</primary>
|
---|
439 | </indexterm>
|
---|
440 | </listitem>
|
---|
441 | </varlistentry>
|
---|
442 |
|
---|
443 | </variablelist>
|
---|
444 |
|
---|
445 | </sect2>
|
---|
446 |
|
---|
447 | </sect1>
|
---|