source: chapter06/vim.xml@ 0d81e3c

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 0d81e3c was 0d81e3c, checked in by Chris Staub <chris@…>, 10 years ago

Undo change to Vim docs, so that Vim can find them

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

  • Property mode set to 100644
File size: 10.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 <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 --enable-multibyte</userinput></screen>
54
55 <variablelist>
56 <title>The meaning of the configure options:</title>
57
58 <varlistentry>
59 <term><parameter>--enable-multibyte</parameter></term>
60 <listitem>
61 <para>This switch enables support for editing files in multibyte
62 character encodings. This is needed if using a locale with a
63 multibyte character set. This switch is also helpful to be able
64 to edit text files initially created in Linux distributions like
65 Fedora that use UTF-8 as a default character set.</para>
66 </listitem>
67 </varlistentry>
68
69 </variablelist>
70
71 <para>Compile the package:</para>
72
73<screen><userinput remap="make">make</userinput></screen>
74
75 <para>To test the results, issue:</para>
76
77<screen><userinput remap="test">make test</userinput></screen>
78
79 <para>However, this test suite outputs a lot of binary data to the screen,
80 which can cause issues with the settings of the current terminal. This can
81 be resolved by redirecting the output to a log file. A successful test
82 will result in the words "ALL DONE" at completion.</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
95for L in /usr/share/man/{,*/}man1/vim.1; do
96 ln -sv vim.1 $(dirname $L)/vi.1
97done</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/&short-version;/postlfs/vim.html"/>.</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 &gt; /etc/vimrc &lt;&lt; "EOF"
134<literal>" Begin /etc/vimrc
135
136set nocompatible
137set backspace=2
138syntax on
139if (&amp;term == "iterm") || (&amp;term == "putty")
140 set background=dark
141endif
142
143" End /etc/vimrc</literal>
144EOF</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
176set 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>
Note: See TracBrowser for help on using the repository browser.