source: chapter06/vim.xml@ 4032ec9c

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 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 4032ec9c was 4032ec9c, checked in by Bruce Dubbs <bdubbs@…>, 7 years ago

Fix minor typos

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

  • Property mode set to 100644
File size: 10.3 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-book;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 -j1 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-book;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
122set mouse=r
123syntax on
124if (&amp;term == "xterm") || (&amp;term == "putty")
125 set background=dark
126endif
127
128
129" End /etc/vimrc</literal>
130EOF</userinput></screen>
131
132 <para>The <parameter>set nocompatible</parameter> setting makes
133 <command>vim</command> behave in a more useful way (the default) than the
134 vi-compatible manner. Remove the <quote>no</quote> to keep the old
135 <command>vi</command> behavior. The <parameter>set backspace=2</parameter>
136 setting allows backspacing over line breaks, autoindents, and the start of
137 insert. The <parameter>syntax on</parameter> parameter enables vim's syntax
138 highlighting. The <parameter>set mouse=r</parameter> setting enables
139 proper pasting of text with the mouse when working in chroot or over a
140 remote connection. Finally, the <emphasis>if</emphasis> statement with the
141 <parameter>set background=dark</parameter> setting corrects
142 <command>vim</command>'s guess about the background color of some terminal
143 emulators. This gives the highlighting a better color scheme for use on the
144 black background of these programs.</para>
145
146 <para>Documentation for other available options can be obtained by
147 running the following command:</para>
148
149<screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
150
151 <note>
152 <para>By default, Vim only installs spell files for the English language.
153 To install spell files for your preferred language, download the
154 <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
155 files for your language and character encoding from <ulink
156 url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
157 <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
158
159 <para>To use these spell files, some configuration in
160 <filename>/etc/vimrc</filename> is needed, e.g.:</para>
161
162<screen><literal>set spelllang=en,ru
163set spell</literal></screen>
164
165 <para>For more information, see the appropriate README file located
166 at the URL above.</para>
167 </note>
168
169 </sect2>
170
171 <sect2 id="contents-vim" role="content">
172 <title>Contents of Vim</title>
173
174 <segmentedlist>
175 <segtitle>Installed programs</segtitle>
176 <segtitle>Installed directory</segtitle>
177
178 <seglistitem>
179 <seg> ex (link to vim), rview (link to vim), rvim (link to vim), vi
180 (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor,
181 and xxd</seg>
182 <seg>/usr/share/vim</seg>
183 </seglistitem>
184 </segmentedlist>
185
186 <variablelist>
187 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
188 <?dbfo list-presentation="list"?>
189 <?dbhtml list-presentation="table"?>
190
191 <varlistentry id="ex">
192 <term><command>ex</command></term>
193 <listitem>
194 <para>Starts <command>vim</command> in ex mode</para>
195 <indexterm zone="ch-system-vim ex">
196 <primary sortas="b-ex">ex</primary>
197 </indexterm>
198 </listitem>
199 </varlistentry>
200
201 <varlistentry id="rview">
202 <term><command>rview</command></term>
203 <listitem>
204 <para>Is a restricted version of <command>view</command>; no shell
205 commands can be started and <command>view</command> cannot be
206 suspended</para>
207 <indexterm zone="ch-system-vim rview">
208 <primary sortas="b-rview">rview</primary>
209 </indexterm>
210 </listitem>
211 </varlistentry>
212
213 <varlistentry id="rvim">
214 <term><command>rvim</command></term>
215 <listitem>
216 <para>Is a restricted version of <command>vim</command>; no shell
217 commands can be started and <command>vim</command> cannot be
218 suspended</para>
219 <indexterm zone="ch-system-vim rvim">
220 <primary sortas="b-rvim">rvim</primary>
221 </indexterm>
222 </listitem>
223 </varlistentry>
224
225 <varlistentry id="vi">
226 <term><command>vi</command></term>
227 <listitem>
228 <para>Link to <command>vim</command></para>
229 <indexterm zone="ch-system-vim vi">
230 <primary sortas="b-vi">vi</primary>
231 </indexterm>
232 </listitem>
233 </varlistentry>
234
235 <varlistentry id="view">
236 <term><command>view</command></term>
237 <listitem>
238 <para>Starts <command>vim</command> in read-only mode</para>
239 <indexterm zone="ch-system-vim view">
240 <primary sortas="b-view">view</primary>
241 </indexterm>
242 </listitem>
243 </varlistentry>
244
245 <varlistentry id="vim">
246 <term><command>vim</command></term>
247 <listitem>
248 <para>Is the editor</para>
249 <indexterm zone="ch-system-vim vim">
250 <primary sortas="b-vim">vim</primary>
251 </indexterm>
252 </listitem>
253 </varlistentry>
254
255 <varlistentry id="vimdiff">
256 <term><command>vimdiff</command></term>
257 <listitem>
258 <para>Edits two or three versions of a file with <command>vim</command>
259 and show differences</para>
260 <indexterm zone="ch-system-vim vimdiff">
261 <primary sortas="b-vimdiff">vimdiff</primary>
262 </indexterm>
263 </listitem>
264 </varlistentry>
265
266 <varlistentry id="vimtutor">
267 <term><command>vimtutor</command></term>
268 <listitem>
269 <para>Teaches the basic keys and commands of
270 <command>vim</command></para>
271 <indexterm zone="ch-system-vim vimtutor">
272 <primary sortas="b-vimtutor">vimtutor</primary>
273 </indexterm>
274 </listitem>
275 </varlistentry>
276
277 <varlistentry id="xxd">
278 <term><command>xxd</command></term>
279 <listitem>
280 <para>Creates a hex dump of the given file; it can
281 also do the reverse, so it can be used for binary patching</para>
282 <indexterm zone="ch-system-vim xxd">
283 <primary sortas="b-xxd">xxd</primary>
284 </indexterm>
285 </listitem>
286 </varlistentry>
287
288 </variablelist>
289
290 </sect2>
291
292</sect1>
Note: See TracBrowser for help on using the repository browser.