source: chapter06/vim.xml@ 7e1a1f8

7.6-systemd 7.7-systemd 7.8-systemd 7.9-systemd
Last change on this file since 7e1a1f8 was 7e1a1f8, checked in by Krejzi <krejzi@…>, 10 years ago

Merged trunk.

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

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