aboutsummaryrefslogtreecommitdiffstats
path: root/chapter06/vim.xml
blob: ffb38e01e07927b3928607be3f64b87695af8c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>
<sect1 id="ch-system-vim" xreflabel="Vim" role="wrap">
<title>Vim-&vim-version;</title>
<?dbhtml filename="vim.html"?>

<indexterm zone="ch-system-vim"><primary sortas="a-Vim">Vim</primary></indexterm>

<sect2 role="package"><title/>
<para>The Vim package contains a powerful text editor.</para>

<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem><seg>0.4 SBU</seg><seg>34 MB</seg></seglistitem>
</segmentedlist>

<segmentedlist>
<segtitle>Vim installation depends on</segtitle>
<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils,
GCC, Glibc, Grep, Make, Ncurses, Sed</seg></seglistitem>
</segmentedlist>

<tip>
<title>Alternatives to Vim</title>
<para>If you prefer another editor -- like Emacs, Joe, or Nano -- to Vim,
have a look at <ulink url="&blfs-root;view/stable/postlfs/editors.html"/> for
suggested installation instructions.</para>
</tip>
</sect2>

<sect2 role="installation">
<title>Installation of Vim</title>

<para>First change the default locations of the <filename>vimrc</filename> and
<filename>gvimrc</filename> configuration files to <filename class="directory">/etc</filename>.</para>

<screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h
echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' &gt;&gt; src/feature.h</userinput></screen>

<para>Now prepare Vim for compilation:</para>

<screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>

<para>The optional <userinput>--enable-multibyte</userinput> switch
includes multibyte editing support into
vim. It is only needed for those people who ignore our recommendation not to
use LFS in locales with multibyte character sets, but it does not hurt
others.</para>

<para>Compile the package:</para>

<screen><userinput>make</userinput></screen>

<para>To test the results, you can issue:
<userinput>make test</userinput>. However, this test suite outputs a lot of
seemingly garbage characters to the screen, and this can wreak havoc with the
settings of the current terminal. Therefore the running of the test suite here
is strictly optional.</para>

<para>Now install the package:</para>

<screen><userinput>make install</userinput></screen>

<para>Many users are used to using <command>vi</command>, instead of
<command>vim</command>. To let them execute <command>vim</command> when
they habitually enter <command>vi</command>, create a symlink:</para>

<screen><userinput>ln -s vim /usr/bin/vi</userinput></screen>

<para>If you are going to install the X Window system on your LFS system, you
may want to re-compile Vim after having installed X. Vim comes with a nice GUI
version of the editor that requires X and a few other libraries to be
installed. For more information read the Vim documentation.</para>

</sect2>


<sect2 id="conf-vim" role="configuration"><title>Configuring Vim</title>
<indexterm zone="conf-vim"><primary sortas="e-/etc/vim">/etc/vim</primary></indexterm>

<para>By default, <command>vim</command> runs in vi-incompatible mode. Some
people might not like this, but we prefer to run <command>vim</command> in its
own mode (else we wouldn't have included it in this book, but the original
<command>vi</command>). We've included the setting of "nocompatible"
below to high-light the fact that the new behavior is being used. It
also reminds those who would change to "compatible" mode that it should
appear first because it changes other settings and overrides must come
after this setting. Create a default vim configuration file by running
the following:</para>

<screen><userinput>cat &gt; /etc/vimrc &lt;&lt; "EOF"</userinput>
" Begin /etc/vimrc

set nocompatible
set backspace=2
syntax on
set background=dark

" End /etc/vimrc
<userinput>EOF</userinput></screen>

<para>The <emphasis>set nocompatible</emphasis> makes
<command>vim</command> behave in a more useful way (the default) than the
vi-compatible manner. Remove the "no" if you want the old <command>vi</command>
behavior. The <emphasis>set backspace=2</emphasis> allows
backspacing over line breaks, autoindents and the start of insert. The
<emphasis>syntax on</emphasis> enables <command>vim</command>'s
syntax highliting, while <emphasis>set background=dark</emphasis> gives the
highliting a better color scheme for use on the black background of a linux
console.  If you later use X and terminals with a light background, changing
this will be useful.</para>

<para>Documentation for other available options can be obtained by running
the following command:</para>

<screen><userinput>vim -c ':options'</userinput></screen>

</sect2>


<sect2 id="contents-vim" role="content"><title>Contents of Vim</title>

<segmentedlist>
<segtitle>Installed programs</segtitle>
<seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk, 
pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim), 
view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh, 
vimtutor and xxd</seg></seglistitem>
</segmentedlist>

<variablelist><title>Short descriptions</title>

<varlistentry id="efm_filter.pl">
<term><command>efm_filter.pl</command></term>
<listitem>
<indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
<para>is a filter for creating an error file that can be read by vim.</para>
</listitem>
</varlistentry>

<varlistentry id="efm_perl.pl">
<term><command>efm_perl.pl</command></term>
<listitem>
<indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
<para>reformats the error messages of the
Perl interpreter for use with the <quote>quickfix</quote> mode of vim.</para>
</listitem>
</varlistentry>

<varlistentry id="ex">
<term><command>ex</command></term>
<listitem>
<indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
<para>starts vim in ex mode.</para>
</listitem>
</varlistentry>

<varlistentry id="less.sh">
<term><command>less.sh</command></term>
<listitem>
<indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
<para>is a script that starts vim with less.vim.</para>
</listitem>
</varlistentry>

<varlistentry id="mve.awk">
<term><command>mve.awk</command></term>
<listitem>
<indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
<para>processes vim errors.</para>
</listitem>
</varlistentry>

<varlistentry id="pltags.pl">
<term><command>pltags.pl</command></term>
<listitem>
<indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
<para>creates a tags file for perl code, for use by vim.</para>
</listitem>
</varlistentry>

<varlistentry id="ref">
<term><command>ref</command></term>
<listitem>
<indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
<para>checks the spelling of arguments.</para>
</listitem>
</varlistentry>

<varlistentry id="rview">
<term><command>rview</command></term>
<listitem>
<indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
<para>is a restricted version of view: no shell
commands can be started and view can't be suspended.</para>
</listitem>
</varlistentry>

<varlistentry id="rvim">
<term><command>rvim</command></term>
<listitem>
<indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
<para>is a restricted version of vim: no shell
commands can be started and vim can't be suspended.</para>
</listitem>
</varlistentry>

<varlistentry id="shtags.pl">
<term><command>shtags.pl</command></term>
<listitem>
<indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
<para>generates a tag file for perl scripts.</para>
</listitem>
</varlistentry>

<varlistentry id="tcltags">
<term><command>tcltags</command></term>
<listitem>
<indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
<para>generates a tag file for TCL code.</para>
</listitem>
</varlistentry>

<varlistentry id="view">
<term><command>view</command></term>
<listitem>
<indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
<para>starts vim in read-only mode.</para>
</listitem>
</varlistentry>

<varlistentry id="vim">
<term><command>vim</command></term>
<listitem>
<indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
<para>is the editor.</para>
</listitem>
</varlistentry>

<varlistentry id="vim132">
<term><command>vim132</command></term>
<listitem>
<indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
<para>starts vim with the terminal in 132-column mode.</para>
</listitem>
</varlistentry>

<varlistentry id="vim2html.pl">
<term><command>vim2html.pl</command></term>
<listitem>
<indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
<para>converts vim documentation to HTML.</para>
</listitem>
</varlistentry>

<varlistentry id="vimdiff">
<term><command>vimdiff</command></term>
<listitem>
<indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
<para>edits two or three versions of a file with vim and show differences.</para>
</listitem>
</varlistentry>

<varlistentry id="vimm">
<term><command>vimm</command></term>
<listitem>
<indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
<para>enables the DEC locator input model on a remote terminal.</para>
</listitem>
</varlistentry>

<varlistentry id="vimspell.sh">
<term><command>vimspell.sh</command></term>
<listitem>
<indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
<para>is a script which spells a file and generates the syntax statements necessary 
to highlight in vim. This script requires the old Unix <command>spell</command> 
command, which is provided neither in LFS nor in BLFS.</para>
</listitem>
</varlistentry>

<varlistentry id="vimtutor">
<term><command>vimtutor</command></term>
<listitem>
<indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
<para>teaches you the basic keys and commands of vim.</para>
</listitem>
</varlistentry>

<varlistentry id="xxd">
<term><command>xxd</command></term>
<listitem>
<indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
<para>makes a hex dump of the given file. It can
also do the reverse, so it can be used for binary patching.</para>
</listitem>
</varlistentry>
</variablelist>

</sect2>

</sect1>