source: BOOK/final-system/common/vim.xml@ abdca7b

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since abdca7b was d6416dd, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Added set ruler to the default system vimrc. This can be a very useful option when doing text editing.

  • Property mode set to 100644
File size: 14.7 KB
Line 
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 <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 </sect2>
23
24 <sect2 role="installation">
25 <title>Installation of Vim</title>
26
27 <tip os="t1">
28 <title>Alternatives to Vim</title>
29
30 <para>If you prefer another editor&mdash;such as Emacs, Joe, or
31 Nano&mdash;please refer to <ulink
32 url="&cblfs-root;index.php/Category:Text_Editors"/>
33 for suggested installation instructions.</para>
34 </tip>
35
36 <para os="a">First, unpack both <filename>vim-&vim-version;.tar.bz2</filename>
37 and (optionally) <filename>vim-&vim-version;-lang.tar.gz</filename>
38 archives into the same directory.</para>
39
40 <para os="p1">The following patch merges all updates from the &vim-version; Branch
41 from the Vim developers:</para>
42
43<screen os="p2"><userinput>patch -Np1 -i ../&vim-branch_update-patch;</userinput></screen>
44
45 <para os="b">Change the default location of
46 the <filename>vimrc</filename> configuration file to <filename
47 class="directory">/etc</filename>:</para>
48
49<screen os="c"><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h</userinput></screen>
50
51 <para os="d">Prepare Vim for compilation:</para>
52
53<screen os="e"><userinput>CPPFLAGS="-DUNUSED=" ./configure \
54 --prefix=/usr --enable-multibyte</userinput></screen>
55
56 <variablelist os="f">
57 <title>The meaning of the configure options:</title>
58
59 <varlistentry>
60 <term><parameter>--enable-multibyte</parameter></term>
61 <listitem>
62 <para>This optional but highly recommended switch enables support
63 for editing files in multibyte character encodings. This is needed
64 if using a locale with a multibyte character set. This switch is
65 also helpful to be able to edit text files initially created in
66 Linux distributions like Fedora that use UTF-8 as a default
67 character set.</para>
68 </listitem>
69 </varlistentry>
70
71 </variablelist>
72
73 <para os="g">Compile the package:</para>
74
75<screen os="h"><userinput>make</userinput></screen>
76
77 <para os="i">To test the results, issue: <userinput>make test</userinput>.
78 However, this test suite outputs a lot of binary data to the
79 screen, which can cause issues with the settings of the current terminal.
80 This can be resolved by redirecting the output to a log file.</para>
81
82 <para os="j">Install the package:</para>
83
84<screen os="k"><userinput>make install</userinput></screen>
85
86 <para os="l">Many users are accustomed to using <command>vi</command>
87 instead of <command>vim</command>. Some programs, such as
88 <command>vigr</command> and <command>vipw</command>, also use
89 <command>vi</command>. Create a symlink to permit execution of
90 <command>vim</command> when users habitually enter <command>vi</command>
91 and allow programs that use <command>vi</command> to work:</para>
92
93<screen os="m"><userinput>ln -sv vim /usr/bin/vi</userinput></screen>
94
95<para os="n">By default, Vim's documentation is installed in
96<filename class="directory">/usr/share/vim</filename>. The following symlink
97allows the documentation to be accessed via
98<filename class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
99it consistent with the location of documentation for other packages:</para>
100
101<screen os="o"><userinput>ln -sv ../vim/vim&vim-version2;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
102
103 <para os="p">If an X Window System is going to be installed on the CLFS
104 system, you may want to recompile Vim after installing X. Vim
105 comes with a GUI version of the editor that requires X and some
106 additional libraries to be installed. For more information, refer to the
107 Vim documentation and the Vim installation page in CBLFS at <ulink
108 url="&cblfs-root;index.php/Vim"/>.</para>
109
110 </sect2>
111
112 <sect2 id="conf-vim" role="configuration">
113 <title>Configuring Vim</title>
114
115 <indexterm zone="conf-vim">
116 <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
117 </indexterm>
118
119 <para>By default, <command>vim</command> runs in vi-incompatible mode.
120 This may be new to users who have used other editors in the past. The
121 <quote>nocompatible</quote> setting is included below to highlight the
122 fact that a new behavior is being used. It also reminds those who would
123 change to <quote>compatible</quote> mode that it should be the first
124 setting in the configuration file. This is necessary because it changes
125 other settings, and overrides must come after this setting. Create a
126 default <command>vim</command> configuration file by running the
127 following:</para>
128
129<screen><userinput>cat &gt; /etc/vimrc &lt;&lt; "EOF"
130<literal>" Begin /etc/vimrc
131
132set nocompatible
133set backspace=2
134set ruler
135syntax on
136if (&amp;term == "iterm") || (&amp;term == "putty")
137 set background=dark
138endif
139
140" End /etc/vimrc</literal>
141EOF</userinput></screen>
142
143
144 <para>The <parameter>set nocompatible</parameter> makes
145 <command>vim</command> behave in a more useful way (the default) than
146 the vi-compatible manner. Remove the <quote>no</quote> to keep the
147 old <command>vi</command> behavior. The <parameter>set
148 backspace=2</parameter> allows backspacing over line breaks,
149 autoindents, and the start of insert. The <parameter>syntax
150 on</parameter> enables vim's syntax highlighting. Finally, the
151 <emphasis>if</emphasis> statement with the <parameter>set
152 background=dark</parameter> corrects <command>vim</command>'s guess
153 about the background color of some terminal emulators. This gives the
154 highlighting a better color scheme for use on the black background of
155 these programs.</para>
156
157 <para>Documentation for other available options can be obtained by
158 running the following command:</para>
159
160<screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
161
162 </sect2>
163
164 <sect2 id="contents-vim" role="content">
165 <title>Contents of Vim</title>
166
167 <segmentedlist>
168 <segtitle>Installed programs</segtitle>
169 <segtitle>Installed directory</segtitle>
170
171 <seglistitem>
172 <seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
173 pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl,
174 tcltags, vi (link to vim), view (link to vim), vim, vim132, vim2html.pl,
175 vimdiff (link to vim), vimm, vimspell.sh, vimtutor, and xxd</seg>
176 <seg>/usr/share/vim</seg>
177 </seglistitem>
178 </segmentedlist>
179
180 <variablelist>
181 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
182 <?dbfo list-presentation="list"?>
183 <?dbhtml list-presentation="table"?>
184
185 <varlistentry id="efm_filter.pl">
186 <term><command>efm_filter.pl</command></term>
187 <listitem>
188 <para>A filter for creating an error file that can be read
189 by <command>vim</command></para>
190 <indexterm zone="ch-system-vim efm_filter.pl">
191 <primary sortas="b-efm_filter.pl">efm_filter.pl</primary>
192 </indexterm>
193 </listitem>
194 </varlistentry>
195
196 <varlistentry id="efm_perl.pl">
197 <term><command>efm_perl.pl</command></term>
198 <listitem>
199 <para>Reformats the error messages of the Perl interpreter for use
200 with the <quote>quickfix</quote> mode of <command>vim</command></para>
201 <indexterm zone="ch-system-vim efm_perl.pl">
202 <primary sortas="b-efm_perl.pl">efm_perl.pl</primary>
203 </indexterm>
204 </listitem>
205 </varlistentry>
206
207 <varlistentry id="ex">
208 <term><command>ex</command></term>
209 <listitem>
210 <para>Starts <command>vim</command> in ex mode</para>
211 <indexterm zone="ch-system-vim ex">
212 <primary sortas="b-ex">ex</primary>
213 </indexterm>
214 </listitem>
215 </varlistentry>
216
217 <varlistentry id="less.sh">
218 <term><command>less.sh</command></term>
219 <listitem>
220 <para>A script that starts <command>vim</command> with less.vim</para>
221 <indexterm zone="ch-system-vim less.sh">
222 <primary sortas="b-less.sh">less.sh</primary>
223 </indexterm>
224 </listitem>
225 </varlistentry>
226
227 <varlistentry id="mve.awk">
228 <term><command>mve.awk</command></term>
229 <listitem>
230 <para>Processes <command>vim</command> errors</para>
231 <indexterm zone="ch-system-vim mve.awk">
232 <primary sortas="b-mve.awk">mve.awk</primary>
233 </indexterm>
234 </listitem>
235 </varlistentry>
236
237 <varlistentry id="pltags.pl">
238 <term><command>pltags.pl</command></term>
239 <listitem>
240 <para>Creates a tags file for Perl code for use by
241 <command>vim</command></para>
242 <indexterm zone="ch-system-vim pltags.pl">
243 <primary sortas="b-pltags.pl">pltags.pl</primary>
244 </indexterm>
245 </listitem>
246 </varlistentry>
247
248 <varlistentry id="ref">
249 <term><command>ref</command></term>
250 <listitem>
251 <para>Checks the spelling of arguments</para>
252 <indexterm zone="ch-system-vim ref">
253 <primary sortas="b-ref">ref</primary>
254 </indexterm>
255 </listitem>
256 </varlistentry>
257
258 <varlistentry id="rview">
259 <term><command>rview</command></term>
260 <listitem>
261 <para>Is a restricted version of <command>view</command>; no shell
262 commands can be started and <command>view</command> cannot be
263 suspended</para>
264 <indexterm zone="ch-system-vim rview">
265 <primary sortas="b-rview">rview</primary>
266 </indexterm>
267 </listitem>
268 </varlistentry>
269
270 <varlistentry id="rvim">
271 <term><command>rvim</command></term>
272 <listitem>
273 <para>Is a restricted version of <command>vim</command>; no shell
274 commands can be started and <command>vim</command> cannot be
275 suspended</para>
276 <indexterm zone="ch-system-vim rvim">
277 <primary sortas="b-rvim">rvim</primary>
278 </indexterm>
279 </listitem>
280 </varlistentry>
281
282 <varlistentry id="shtags.pl">
283 <term><command>shtags.pl</command></term>
284 <listitem>
285 <para>Generates a tags file for Perl scripts</para>
286 <indexterm zone="ch-system-vim shtags.pl">
287 <primary sortas="b-shtags.pl">shtags.pl</primary>
288 </indexterm>
289 </listitem>
290 </varlistentry>
291
292 <varlistentry id="tcltags">
293 <term><command>tcltags</command></term>
294 <listitem>
295 <para>Generates a tags file for TCL code</para>
296 <indexterm zone="ch-system-vim tcltags">
297 <primary sortas="b-tcltags">tcltags</primary>
298 </indexterm>
299 </listitem>
300 </varlistentry>
301
302 <varlistentry id="view">
303 <term><command>view</command></term>
304 <listitem>
305 <para>Starts <command>vim</command> in read-only mode</para>
306 <indexterm zone="ch-system-vim view">
307 <primary sortas="b-view">view</primary>
308 </indexterm>
309 </listitem>
310 </varlistentry>
311
312 <varlistentry id="vi">
313 <term><command>vi</command></term>
314 <listitem>
315 <para>Link to <command>vim</command></para>
316 <indexterm zone="ch-system-vim vi">
317 <primary sortas="b-vi">vi</primary>
318 </indexterm>
319 </listitem>
320 </varlistentry>
321
322 <varlistentry id="vim">
323 <term><command>vim</command></term>
324 <listitem>
325 <para>Is the editor</para>
326 <indexterm zone="ch-system-vim vim">
327 <primary sortas="b-vim">vim</primary>
328 </indexterm>
329 </listitem>
330 </varlistentry>
331
332 <varlistentry id="vim132">
333 <term><command>vim132</command></term>
334 <listitem>
335 <para>Starts <command>vim</command> with the terminal in 132-column
336 mode</para>
337 <indexterm zone="ch-system-vim vim132">
338 <primary sortas="b-vim132">vim132</primary>
339 </indexterm>
340 </listitem>
341 </varlistentry>
342
343 <varlistentry id="vim2html.pl">
344 <term><command>vim2html.pl</command></term>
345 <listitem>
346 <para>Converts Vim documentation to HypterText Markup Language
347 (HTML)</para>
348 <indexterm zone="ch-system-vim vim2html.pl">
349 <primary sortas="b-vim2html.pl">vim2html.pl</primary>
350 </indexterm>
351 </listitem>
352 </varlistentry>
353
354 <varlistentry id="vimdiff">
355 <term><command>vimdiff</command></term>
356 <listitem>
357 <para>Edits two or three versions of a file with <command>vim</command>
358 and show differences</para>
359 <indexterm zone="ch-system-vim vimdiff">
360 <primary sortas="b-vimdiff">vimdiff</primary>
361 </indexterm>
362 </listitem>
363 </varlistentry>
364
365 <varlistentry id="vimm">
366 <term><command>vimm</command></term>
367 <listitem>
368 <para>Enables the DEC locator input model on a remote terminal</para>
369 <indexterm zone="ch-system-vim vimm">
370 <primary sortas="b-vimm">vimm</primary>
371 </indexterm>
372 </listitem>
373 </varlistentry>
374
375 <varlistentry id="vimspell.sh">
376 <term><command>vimspell.sh</command></term>
377 <listitem>
378 <para>Spell checks a file and generates the syntax statements
379 necessary to highlight in <command>vim</command>. This script
380 requires the old Unix <command>spell</command> command, which
381 is provided neither in CLFS nor in CBLFS</para>
382 <indexterm zone="ch-system-vim vimspell.sh">
383 <primary sortas="b-vimspell.sh">vimspell.sh</primary>
384 </indexterm>
385 </listitem>
386 </varlistentry>
387
388 <varlistentry id="vimtutor">
389 <term><command>vimtutor</command></term>
390 <listitem>
391 <para>Teaches the basic keys and commands of
392 <command>vim</command></para>
393 <indexterm zone="ch-system-vim vimtutor">
394 <primary sortas="b-vimtutor">vimtutor</primary>
395 </indexterm>
396 </listitem>
397 </varlistentry>
398
399 <varlistentry id="xxd">
400 <term><command>xxd</command></term>
401 <listitem>
402 <para>Creates a hex dump of the given file; it can
403 also do the reverse, so it can be used for binary patching</para>
404 <indexterm zone="ch-system-vim xxd">
405 <primary sortas="b-xxd">xxd</primary>
406 </indexterm>
407 </listitem>
408 </varlistentry>
409
410 </variablelist>
411
412 </sect2>
413
414</sect1>
Note: See TracBrowser for help on using the repository browser.