source: chapter06/vim.xml@ dd03426

Last change on this file since dd03426 was a78da15, checked in by Bruce Dubbs <bdubbs@…>, 18 years ago

Prep for stable 6.2 release

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/6.2/BOOK@7745 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

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