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 | <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—such as Emacs, Joe, or
|
---|
36 | Nano—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, change the default location of the
|
---|
47 | <filename>vimrc</filename> configuration file to <filename
|
---|
48 | class="directory">/etc</filename>:</para>
|
---|
49 |
|
---|
50 | <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
---|
51 |
|
---|
52 | <para>Now prepare Vim for compilation:</para>
|
---|
53 |
|
---|
54 | <screen><userinput remap="configure">./configure --prefix=/usr --enable-multibyte</userinput></screen>
|
---|
55 |
|
---|
56 | <variablelist>
|
---|
57 | <title>The meaning of the configure options:</title>
|
---|
58 |
|
---|
59 | <varlistentry>
|
---|
60 | <term><parameter>--enable-multibyte</parameter></term>
|
---|
61 | <listitem>
|
---|
62 | <para>This switch enables support for editing files in multibyte
|
---|
63 | character encodings. This is needed if using a locale with a
|
---|
64 | multibyte character set. This switch is also helpful to be able
|
---|
65 | to edit text files initially created in Linux distributions like
|
---|
66 | Fedora that use UTF-8 as a default character set.</para>
|
---|
67 | </listitem>
|
---|
68 | </varlistentry>
|
---|
69 |
|
---|
70 | </variablelist>
|
---|
71 |
|
---|
72 | <para>Compile the package:</para>
|
---|
73 |
|
---|
74 | <screen><userinput remap="make">make</userinput></screen>
|
---|
75 |
|
---|
76 | <para>To test the results, issue:</para>
|
---|
77 |
|
---|
78 | <screen><userinput remap="test">make test</userinput></screen>
|
---|
79 |
|
---|
80 | <para>However, this test suite outputs a lot of binary data to the screen,
|
---|
81 | which can cause issues with the settings of the current terminal. This can
|
---|
82 | be resolved by redirecting the output to a log file.</para>
|
---|
83 |
|
---|
84 | <para>Install the package:</para>
|
---|
85 |
|
---|
86 | <screen><userinput remap="install">make install</userinput></screen>
|
---|
87 |
|
---|
88 | <para>Many users are used to using <command>vi</command> instead of
|
---|
89 | <command>vim</command>. To allow execution of <command>vim</command>
|
---|
90 | when users habitually enter <command>vi</command>, create a
|
---|
91 | symlink for both the binary and the man page in the provided
|
---|
92 | languages:</para>
|
---|
93 |
|
---|
94 | <screen><userinput remap="install">ln -sv vim /usr/bin/vi
|
---|
95 | for L in /usr/share/man/{,*/}man1/vim.1; do
|
---|
96 | ln -sv vim.1 $(dirname $L)/vi.1
|
---|
97 | done</userinput></screen>
|
---|
98 |
|
---|
99 | <para>By default, Vim's documentation is installed in <filename
|
---|
100 | class="directory">/usr/share/vim</filename>. The following symlink
|
---|
101 | allows the documentation to be accessed via <filename
|
---|
102 | class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
|
---|
103 | it consistent with the location of documentation for other packages:</para>
|
---|
104 |
|
---|
105 | <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
|
---|
106 |
|
---|
107 | <para>If an X Window System is going to be installed on the LFS
|
---|
108 | system, it may be necessary to recompile Vim after installing X. Vim
|
---|
109 | comes with a GUI version of the editor that requires X and some
|
---|
110 | additional libraries to be installed. For more information on this
|
---|
111 | process, refer to the Vim documentation and the Vim installation page
|
---|
112 | in the BLFS book at <ulink
|
---|
113 | url="&blfs-root;view/svn/postlfs/editors.html#postlfs-editors-vim"/>.</para>
|
---|
114 |
|
---|
115 | </sect2>
|
---|
116 |
|
---|
117 | <sect2 id="conf-vim" role="configuration">
|
---|
118 | <title>Configuring Vim</title>
|
---|
119 |
|
---|
120 | <indexterm zone="conf-vim">
|
---|
121 | <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
|
---|
122 | </indexterm>
|
---|
123 |
|
---|
124 | <para>By default, <command>vim</command> runs in vi-incompatible mode.
|
---|
125 | This may be new to users who have used other editors in the past. The
|
---|
126 | <quote>nocompatible</quote> setting is included below to highlight the
|
---|
127 | fact that a new behavior is being used. It also reminds those who would
|
---|
128 | change to <quote>compatible</quote> mode that it should be the first
|
---|
129 | setting in the configuration file. This is necessary because it changes
|
---|
130 | other settings, and overrides must come after this setting. Create a default
|
---|
131 | <command>vim</command> configuration file by running the following:</para>
|
---|
132 |
|
---|
133 | <screen><userinput>cat > /etc/vimrc << "EOF"
|
---|
134 | <literal>" Begin /etc/vimrc
|
---|
135 |
|
---|
136 | set nocompatible
|
---|
137 | set backspace=2
|
---|
138 | syntax on
|
---|
139 | if (&term == "iterm") || (&term == "putty")
|
---|
140 | set background=dark
|
---|
141 | endif
|
---|
142 |
|
---|
143 | " End /etc/vimrc</literal>
|
---|
144 | EOF</userinput></screen>
|
---|
145 |
|
---|
146 | <para>The <parameter>set nocompatible</parameter> setting makes
|
---|
147 | <command>vim</command> behave in a more useful way (the default) than
|
---|
148 | the vi-compatible manner. Remove the <quote>no</quote> to keep the
|
---|
149 | old <command>vi</command> behavior. The <parameter>set
|
---|
150 | backspace=2</parameter> setting allows backspacing over line breaks,
|
---|
151 | autoindents, and the start of insert. The <parameter>syntax
|
---|
152 | on</parameter> parameter enables vim's syntax highlighting. Finally,
|
---|
153 | the <emphasis>if</emphasis> statement with the <parameter>set
|
---|
154 | background=dark</parameter> setting corrects <command>vim</command>'s
|
---|
155 | guess about the background color of some terminal emulators. This
|
---|
156 | gives the highlighting a better color scheme for use on the black
|
---|
157 | background of these programs.</para>
|
---|
158 |
|
---|
159 | <para>Documentation for other available options can be obtained by
|
---|
160 | running the following command:</para>
|
---|
161 |
|
---|
162 | <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
|
---|
163 |
|
---|
164 | <note>
|
---|
165 | <para>By default, Vim only installs spell files for the English language.
|
---|
166 | To install spell files for your preferred language, download the
|
---|
167 | <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
|
---|
168 | files for your language and character encoding from <ulink
|
---|
169 | url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
|
---|
170 | <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
|
---|
171 |
|
---|
172 | <para>To use these spell files, some configuration in
|
---|
173 | <filename>/etc/vimrc</filename> is needed, e.g.:</para>
|
---|
174 |
|
---|
175 | <screen><literal>set spelllang=en,ru
|
---|
176 | set spell</literal></screen>
|
---|
177 |
|
---|
178 | <para>For more information, see the appropriate README file located
|
---|
179 | at the URL above.</para>
|
---|
180 | </note>
|
---|
181 |
|
---|
182 | </sect2>
|
---|
183 |
|
---|
184 | <sect2 id="contents-vim" role="content">
|
---|
185 | <title>Contents of Vim</title>
|
---|
186 |
|
---|
187 | <segmentedlist>
|
---|
188 | <segtitle>Installed programs</segtitle>
|
---|
189 | <segtitle>Installed directory</segtitle>
|
---|
190 |
|
---|
191 | <seglistitem>
|
---|
192 | <seg> ex (link to vim), rview (link to vim), rvim (link to vim), vi
|
---|
193 | (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor,
|
---|
194 | and xxd</seg>
|
---|
195 | <seg>/usr/share/vim</seg>
|
---|
196 | </seglistitem>
|
---|
197 | </segmentedlist>
|
---|
198 |
|
---|
199 | <variablelist>
|
---|
200 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
201 | <?dbfo list-presentation="list"?>
|
---|
202 | <?dbhtml list-presentation="table"?>
|
---|
203 |
|
---|
204 | <varlistentry id="ex">
|
---|
205 | <term><command>ex</command></term>
|
---|
206 | <listitem>
|
---|
207 | <para>Starts <command>vim</command> in ex mode</para>
|
---|
208 | <indexterm zone="ch-system-vim ex">
|
---|
209 | <primary sortas="b-ex">ex</primary>
|
---|
210 | </indexterm>
|
---|
211 | </listitem>
|
---|
212 | </varlistentry>
|
---|
213 |
|
---|
214 | <varlistentry id="rview">
|
---|
215 | <term><command>rview</command></term>
|
---|
216 | <listitem>
|
---|
217 | <para>Is a restricted version of <command>view</command>; no shell
|
---|
218 | commands can be started and <command>view</command> cannot be
|
---|
219 | suspended</para>
|
---|
220 | <indexterm zone="ch-system-vim rview">
|
---|
221 | <primary sortas="b-rview">rview</primary>
|
---|
222 | </indexterm>
|
---|
223 | </listitem>
|
---|
224 | </varlistentry>
|
---|
225 |
|
---|
226 | <varlistentry id="rvim">
|
---|
227 | <term><command>rvim</command></term>
|
---|
228 | <listitem>
|
---|
229 | <para>Is a restricted version of <command>vim</command>; no shell
|
---|
230 | commands can be started and <command>vim</command> cannot be
|
---|
231 | suspended</para>
|
---|
232 | <indexterm zone="ch-system-vim rvim">
|
---|
233 | <primary sortas="b-rvim">rvim</primary>
|
---|
234 | </indexterm>
|
---|
235 | </listitem>
|
---|
236 | </varlistentry>
|
---|
237 |
|
---|
238 | <varlistentry id="vi">
|
---|
239 | <term><command>vi</command></term>
|
---|
240 | <listitem>
|
---|
241 | <para>Link to <command>vim</command></para>
|
---|
242 | <indexterm zone="ch-system-vim vi">
|
---|
243 | <primary sortas="b-vi">vi</primary>
|
---|
244 | </indexterm>
|
---|
245 | </listitem>
|
---|
246 | </varlistentry>
|
---|
247 |
|
---|
248 | <varlistentry id="view">
|
---|
249 | <term><command>view</command></term>
|
---|
250 | <listitem>
|
---|
251 | <para>Starts <command>vim</command> in read-only mode</para>
|
---|
252 | <indexterm zone="ch-system-vim view">
|
---|
253 | <primary sortas="b-view">view</primary>
|
---|
254 | </indexterm>
|
---|
255 | </listitem>
|
---|
256 | </varlistentry>
|
---|
257 |
|
---|
258 | <varlistentry id="vim">
|
---|
259 | <term><command>vim</command></term>
|
---|
260 | <listitem>
|
---|
261 | <para>Is the editor</para>
|
---|
262 | <indexterm zone="ch-system-vim vim">
|
---|
263 | <primary sortas="b-vim">vim</primary>
|
---|
264 | </indexterm>
|
---|
265 | </listitem>
|
---|
266 | </varlistentry>
|
---|
267 |
|
---|
268 | <varlistentry id="vimdiff">
|
---|
269 | <term><command>vimdiff</command></term>
|
---|
270 | <listitem>
|
---|
271 | <para>Edits two or three versions of a file with <command>vim</command>
|
---|
272 | and show differences</para>
|
---|
273 | <indexterm zone="ch-system-vim vimdiff">
|
---|
274 | <primary sortas="b-vimdiff">vimdiff</primary>
|
---|
275 | </indexterm>
|
---|
276 | </listitem>
|
---|
277 | </varlistentry>
|
---|
278 |
|
---|
279 | <varlistentry id="vimtutor">
|
---|
280 | <term><command>vimtutor</command></term>
|
---|
281 | <listitem>
|
---|
282 | <para>Teaches the basic keys and commands of
|
---|
283 | <command>vim</command></para>
|
---|
284 | <indexterm zone="ch-system-vim vimtutor">
|
---|
285 | <primary sortas="b-vimtutor">vimtutor</primary>
|
---|
286 | </indexterm>
|
---|
287 | </listitem>
|
---|
288 | </varlistentry>
|
---|
289 |
|
---|
290 | <varlistentry id="xxd">
|
---|
291 | <term><command>xxd</command></term>
|
---|
292 | <listitem>
|
---|
293 | <para>Creates a hex dump of the given file; it can
|
---|
294 | also do the reverse, so it can be used for binary patching</para>
|
---|
295 | <indexterm zone="ch-system-vim xxd">
|
---|
296 | <primary sortas="b-xxd">xxd</primary>
|
---|
297 | </indexterm>
|
---|
298 | </listitem>
|
---|
299 | </varlistentry>
|
---|
300 |
|
---|
301 | </variablelist>
|
---|
302 |
|
---|
303 | </sect2>
|
---|
304 |
|
---|
305 | </sect1>
|
---|