source: chapter06/vim.xml@ 5f91d6e

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

Expanded the note in vim to better explain spell files

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

  • Property mode set to 100644
File size: 16.6 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>Finally, change the default location of the
63 <filename>vimrc</filename> configuration file to <filename
64 class="directory">/etc</filename>:</para>
65
66<screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h</userinput></screen>
67
68 <para>Now prepare Vim for compilation:</para>
69
70<screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
71
72 <variablelist>
73 <title>The meaning of the configure options:</title>
74
75 <varlistentry>
76 <term><parameter>--enable-multibyte</parameter></term>
77 <listitem>
78 <para>This switch enables support for editing files in multibyte
79 character encodings. This is needed if using a locale with a
80 multibyte character set. This switch is also helpful to be able
81 to edit text files initially created in Linux distributions like
82 Fedora Core that use UTF-8 as a default character set.</para>
83 </listitem>
84 </varlistentry>
85
86 </variablelist>
87
88 <para>Compile the package:</para>
89
90<screen><userinput>make</userinput></screen>
91
92 <para>To test the results, issue: <userinput>make test</userinput>. However,
93 this test suite outputs a lot of binary data to the screen, which can cause
94 issues with the settings of the current terminal. This can be resolved by
95 redirecting the output to a log file.</para>
96
97 <para>Install the package:</para>
98
99<screen><userinput>make install</userinput></screen>
100
101 <para>In UTF-8 locales, the <command>vimtutor</command> program tries to
102 convert the tutorials from ISO-8859-1 to UTF-8. Since some tutorials are
103 not in ISO-8859-1, the text in them is thus made unreadable. If you
104 unpacked the <filename>vim-&vim-version;-lang.tar.gz</filename> archive
105 and are going to use a UTF-8 based locale, remove non-ISO-8859-1 tutorials.
106 An English tutorial will be used instead.</para>
107 <!-- Removal is used instead of conversion in order for the user to be able to
108 painlessly revert his UTF-8 locale choice. -->
109
110<screen><userinput>rm -f /usr/share/vim/vim70/tutor/tutor.{gr,pl,ru,sk}
111rm -f /usr/share/vim/vim70/tutor/tutor.??.*</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>ln -sv vim /usr/bin/vi
120for L in "" fr it pl ru; do
121 ln -sv vim.1 /usr/share/man/$L/man1/vi.1
122done</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>ln -sv ../vim/vim70/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 &gt; /etc/vimrc &lt;&lt; "EOF"
159<literal>" Begin /etc/vimrc
160
161set nocompatible
162set backspace=2
163syntax on
164if (&amp;term == "iterm") || (&amp;term == "putty")
165 set background=dark
166endif
167
168" End /etc/vimrc</literal>
169EOF</userinput></screen>
170
171 <para>The <parameter>set nocompatible</parameter> 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> allows backspacing over line breaks,
176 autoindents, and the start of insert. The <parameter>syntax
177 on</parameter> enables vim's syntax highlighting. Finally, the
178 <emphasis>if</emphasis> statement with the <parameter>set
179 background=dark</parameter> corrects <command>vim</command>'s guess
180 about the background color of some terminal emulators. This gives the
181 highlighting a better color scheme for use on the black background of
182 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
191 <para>By default, Vim only installs spell files for the English language.
192 To install spell files for your preferred language, download the
193 <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
194 files for your language and character encoding from <ulink
195 url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and and save them to
196 <filename
197 class='directory'>/usr/share/vim/vim70/spell/</filename>.</para>
198
199 <para>To use these spell files, some configuration in
200 <filename>/etc/vimrc</filename> is needed, e.g.:</para>
201
202<screen role="nodump"><userinput>set spelllang=en,ru
203set spell</userinput></screen>
204
205 <para>For more information, see the appropriate README file located
206 at the the URL above.</para>
207 </note>
208
209 </sect2>
210
211 <sect2 id="contents-vim" role="content">
212 <title>Contents of Vim</title>
213
214 <segmentedlist>
215 <segtitle>Installed programs</segtitle>
216
217 <seglistitem>
218 <seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
219 pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl,
220 tcltags, vi (link to vim), view (link to vim), vim, vim132, vim2html.pl,
221 vimdiff (link to vim), vimm, vimspell.sh, vimtutor, and xxd</seg>
222 </seglistitem>
223 </segmentedlist>
224
225 <variablelist>
226 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
227 <?dbfo list-presentation="list"?>
228 <?dbhtml list-presentation="table"?>
229
230 <varlistentry id="efm_filter.pl">
231 <term><command>efm_filter.pl</command></term>
232 <listitem>
233 <para>A filter for creating an error file that can be read
234 by <command>vim</command></para>
235 <indexterm zone="ch-system-vim efm_filter.pl">
236 <primary sortas="b-efm_filter.pl">efm_filter.pl</primary>
237 </indexterm>
238 </listitem>
239 </varlistentry>
240
241 <varlistentry id="efm_perl.pl">
242 <term><command>efm_perl.pl</command></term>
243 <listitem>
244 <para>Reformats the error messages of the Perl interpreter for use
245 with the <quote>quickfix</quote> mode of <command>vim</command></para>
246 <indexterm zone="ch-system-vim efm_perl.pl">
247 <primary sortas="b-efm_perl.pl">efm_perl.pl</primary>
248 </indexterm>
249 </listitem>
250 </varlistentry>
251
252 <varlistentry id="ex">
253 <term><command>ex</command></term>
254 <listitem>
255 <para>Starts <command>vim</command> in ex mode</para>
256 <indexterm zone="ch-system-vim ex">
257 <primary sortas="b-ex">ex</primary>
258 </indexterm>
259 </listitem>
260 </varlistentry>
261
262 <varlistentry id="less.sh">
263 <term><command>less.sh</command></term>
264 <listitem>
265 <para>A script that starts <command>vim</command> with less.vim</para>
266 <indexterm zone="ch-system-vim less.sh">
267 <primary sortas="b-less.sh">less.sh</primary>
268 </indexterm>
269 </listitem>
270 </varlistentry>
271
272 <varlistentry id="mve.awk">
273 <term><command>mve.awk</command></term>
274 <listitem>
275 <para>Processes <command>vim</command> errors</para>
276 <indexterm zone="ch-system-vim mve.awk">
277 <primary sortas="b-mve.awk">mve.awk</primary>
278 </indexterm>
279 </listitem>
280 </varlistentry>
281
282 <varlistentry id="pltags.pl">
283 <term><command>pltags.pl</command></term>
284 <listitem>
285 <para>Creates a tags file for Perl code for use by
286 <command>vim</command></para>
287 <indexterm zone="ch-system-vim pltags.pl">
288 <primary sortas="b-pltags.pl">pltags.pl</primary>
289 </indexterm>
290 </listitem>
291 </varlistentry>
292
293 <varlistentry id="ref">
294 <term><command>ref</command></term>
295 <listitem>
296 <para>Checks the spelling of arguments</para>
297 <indexterm zone="ch-system-vim ref">
298 <primary sortas="b-ref">ref</primary>
299 </indexterm>
300 </listitem>
301 </varlistentry>
302
303 <varlistentry id="rview">
304 <term><command>rview</command></term>
305 <listitem>
306 <para>Is a restricted version of <command>view</command>; no shell
307 commands can be started and <command>view</command> cannot be
308 suspended</para>
309 <indexterm zone="ch-system-vim rview">
310 <primary sortas="b-rview">rview</primary>
311 </indexterm>
312 </listitem>
313 </varlistentry>
314
315 <varlistentry id="rvim">
316 <term><command>rvim</command></term>
317 <listitem>
318 <para>Is a restricted version of <command>vim</command>; no shell
319 commands can be started and <command>vim</command> cannot be
320 suspended</para>
321 <indexterm zone="ch-system-vim rvim">
322 <primary sortas="b-rvim">rvim</primary>
323 </indexterm>
324 </listitem>
325 </varlistentry>
326
327 <varlistentry id="shtags.pl">
328 <term><command>shtags.pl</command></term>
329 <listitem>
330 <para>Generates a tags file for Perl scripts</para>
331 <indexterm zone="ch-system-vim shtags.pl">
332 <primary sortas="b-shtags.pl">shtags.pl</primary>
333 </indexterm>
334 </listitem>
335 </varlistentry>
336
337 <varlistentry id="tcltags">
338 <term><command>tcltags</command></term>
339 <listitem>
340 <para>Generates a tags file for TCL code</para>
341 <indexterm zone="ch-system-vim tcltags">
342 <primary sortas="b-tcltags">tcltags</primary>
343 </indexterm>
344 </listitem>
345 </varlistentry>
346
347 <varlistentry id="view">
348 <term><command>view</command></term>
349 <listitem>
350 <para>Starts <command>vim</command> in read-only mode</para>
351 <indexterm zone="ch-system-vim view">
352 <primary sortas="b-view">view</primary>
353 </indexterm>
354 </listitem>
355 </varlistentry>
356
357 <varlistentry id="vi">
358 <term><command>vi</command></term>
359 <listitem>
360 <para>Link to <command>vim</command></para>
361 <indexterm zone="ch-system-vim vi">
362 <primary sortas="b-vi">vi</primary>
363 </indexterm>
364 </listitem>
365 </varlistentry>
366
367 <varlistentry id="vim">
368 <term><command>vim</command></term>
369 <listitem>
370 <para>Is the editor</para>
371 <indexterm zone="ch-system-vim vim">
372 <primary sortas="b-vim">vim</primary>
373 </indexterm>
374 </listitem>
375 </varlistentry>
376
377 <varlistentry id="vim132">
378 <term><command>vim132</command></term>
379 <listitem>
380 <para>Starts <command>vim</command> with the terminal in 132-column
381 mode</para>
382 <indexterm zone="ch-system-vim vim132">
383 <primary sortas="b-vim132">vim132</primary>
384 </indexterm>
385 </listitem>
386 </varlistentry>
387
388 <varlistentry id="vim2html.pl">
389 <term><command>vim2html.pl</command></term>
390 <listitem>
391 <para>Converts Vim documentation to HypterText Markup Language
392 (HTML)</para>
393 <indexterm zone="ch-system-vim vim2html.pl">
394 <primary sortas="b-vim2html.pl">vim2html.pl</primary>
395 </indexterm>
396 </listitem>
397 </varlistentry>
398
399 <varlistentry id="vimdiff">
400 <term><command>vimdiff</command></term>
401 <listitem>
402 <para>Edits two or three versions of a file with <command>vim</command>
403 and show differences</para>
404 <indexterm zone="ch-system-vim vimdiff">
405 <primary sortas="b-vimdiff">vimdiff</primary>
406 </indexterm>
407 </listitem>
408 </varlistentry>
409
410 <varlistentry id="vimm">
411 <term><command>vimm</command></term>
412 <listitem>
413 <para>Enables the DEC locator input model on a remote terminal</para>
414 <indexterm zone="ch-system-vim vimm">
415 <primary sortas="b-vimm">vimm</primary>
416 </indexterm>
417 </listitem>
418 </varlistentry>
419
420 <varlistentry id="vimspell.sh">
421 <term><command>vimspell.sh</command></term>
422 <listitem>
423 <para>Spell checks a file and generates the syntax statements
424 necessary to highlight in <command>vim</command>. This script
425 requires the old Unix <command>spell</command> command, which
426 is provided neither in LFS nor in BLFS</para>
427 <indexterm zone="ch-system-vim vimspell.sh">
428 <primary sortas="b-vimspell.sh">vimspell.sh</primary>
429 </indexterm>
430 </listitem>
431 </varlistentry>
432
433 <varlistentry id="vimtutor">
434 <term><command>vimtutor</command></term>
435 <listitem>
436 <para>Teaches the basic keys and commands of
437 <command>vim</command></para>
438 <indexterm zone="ch-system-vim vimtutor">
439 <primary sortas="b-vimtutor">vimtutor</primary>
440 </indexterm>
441 </listitem>
442 </varlistentry>
443
444 <varlistentry id="xxd">
445 <term><command>xxd</command></term>
446 <listitem>
447 <para>Creates a hex dump of the given file; it can
448 also do the reverse, so it can be used for binary patching</para>
449 <indexterm zone="ch-system-vim xxd">
450 <primary sortas="b-xxd">xxd</primary>
451 </indexterm>
452 </listitem>
453 </varlistentry>
454
455 </variablelist>
456
457 </sect2>
458
459</sect1>
Note: See TracBrowser for help on using the repository browser.