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