source: chapter06/vim.xml@ 31bee15

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 12.2 12.2-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 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/loongarch-12.2 xry111/mips64el xry111/multilib xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 31bee15 was 3e05705, checked in by Alexander E. Patrakov <alexander@…>, 20 years ago

Re-added the "background" option to /etc/vimrc

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

  • Property mode set to 100644
File size: 11.8 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
[a001133]6<sect1 id="ch-system-vim" xreflabel="Vim" role="wrap">
[673b0d8]7<title>Vim-&vim-version;</title>
8<?dbhtml filename="vim.html"?>
9
10<indexterm zone="ch-system-vim"><primary sortas="a-Vim">Vim</primary></indexterm>
[6370fa6]11
[a001133]12<sect2 role="package"><title/>
[5888299]13<para>The Vim package contains a powerful text editor.</para>
14
[a001133]15<segmentedlist>
16<segtitle>&buildtime;</segtitle>
17<segtitle>&diskspace;</segtitle>
18<seglistitem><seg>0.4 SBU</seg><seg>34 MB</seg></seglistitem>
19</segmentedlist>
20
21<segmentedlist>
22<segtitle>Vim installation depends on</segtitle>
23<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils,
24GCC, Glibc, Grep, Make, Ncurses, Sed</seg></seglistitem>
25</segmentedlist>
[5888299]26
[df8334f]27<tip>
[35c2fa60]28<title>Alternatives to Vim</title>
29<para>If you prefer another editor -- like Emacs, Joe, or Nano -- to Vim,
[f861982]30have a look at <ulink url="&blfs-root;view/stable/postlfs/editors.html"/> for
[35c2fa60]31suggested installation instructions.</para>
[df8334f]32</tip>
[35c2fa60]33</sect2>
34
[a001133]35<sect2 role="installation">
[73aedd1d]36<title>Installation of Vim</title>
37
[b5b61fd]38<para>First, unpack both
39<filename>vim-&vim-version;.tar.bz2</filename> and (optionally)
40<filename>vim-&vim-version;-lang.tar.gz</filename> archives into the same
41directory. Then change the default locations of the <filename>vimrc</filename> and
[673b0d8]42<filename>gvimrc</filename> configuration files to <filename class="directory">/etc</filename>.</para>
[73aedd1d]43
44<screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h
45echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' &gt;&gt; src/feature.h</userinput></screen>
46
47<para>Now prepare Vim for compilation:</para>
48
[c3d6ceb]49<screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
[73aedd1d]50
[b5b61fd]51<para>The optional but highly recommended
52<userinput>--enable-multibyte</userinput> switch
53includes support for editing files in multibyte character encodings into
[3546862]54<command>vim</command>.
55It is needed for those people who ignore our recommendation not to
[b5b61fd]56use LFS in locales with multibyte character sets. It is also needed for
57people who want to be able to edit text files initially created
58in Linux distributions like Fedora Core
59that use UTF-8 as a default character set.</para>
[dc32fef]60
[73aedd1d]61<para>Compile the package:</para>
62
63<screen><userinput>make</userinput></screen>
64
[673b0d8]65<para>To test the results, you can issue:
[9dfc02f]66<userinput>make test</userinput>. However, this test suite outputs a lot of
[8a5f906]67seemingly garbage characters to the screen, and this can wreak havoc with the
[db9d773c]68settings of the current terminal. Therefore the running of the test suite here
69is strictly optional.</para>
[1a73ed4]70
[673b0d8]71<para>Now install the package:</para>
[73aedd1d]72
73<screen><userinput>make install</userinput></screen>
74
[673b0d8]75<para>Many users are used to using <command>vi</command>, instead of
76<command>vim</command>. To let them execute <command>vim</command> when
77they habitually enter <command>vi</command>, create a symlink:</para>
[73aedd1d]78
79<screen><userinput>ln -s vim /usr/bin/vi</userinput></screen>
80
[0ba2766b]81<para>If you are going to install the X Window system on your LFS system, you
82may want to re-compile Vim after having installed X. Vim comes with a nice GUI
83version of the editor that requires X and a few other libraries to be
84installed. For more information read the Vim documentation.</para>
[73aedd1d]85
86</sect2>
[0ba2766b]87
[342b176]88
[df8334f]89<sect2 id="conf-vim" role="configuration"><title>Configuring Vim</title>
[673b0d8]90<indexterm zone="conf-vim"><primary sortas="e-/etc/vim">/etc/vim</primary></indexterm>
[342b176]91
[673b0d8]92<para>By default, <command>vim</command> runs in vi-incompatible mode. Some
93people might not like this, but we prefer to run <command>vim</command> in its
[342b176]94own mode (else we wouldn't have included it in this book, but the original
[673b0d8]95<command>vi</command>). We've included the setting of "nocompatible"
96below to high-light the fact that the new behavior is being used. It
97also reminds those who would change to "compatible" mode that it should
98appear first because it changes other settings and overrides must come
99after this setting. Create a default vim configuration file by running
[342b176]100the following:</para>
101
102<screen><userinput>cat &gt; /etc/vimrc &lt;&lt; "EOF"</userinput>
103" Begin /etc/vimrc
104
105set nocompatible
106set backspace=2
107syntax on
[b5b61fd]108set fileencodings=ucs-bom,utf-8,<replaceable>your-8-bit-charset</replaceable>
[3e05705]109if (&amp;term == "iterm") || (&amp;term == "putty")
110 set background=dark
111endif
[342b176]112
113" End /etc/vimrc
114<userinput>EOF</userinput></screen>
115
[673b0d8]116<para>The <emphasis>set nocompatible</emphasis> makes
117<command>vim</command> behave in a more useful way (the default) than the
118vi-compatible manner. Remove the "no" if you want the old <command>vi</command>
119behavior. The <emphasis>set backspace=2</emphasis> allows
120backspacing over line breaks, autoindents and the start of insert. The
121<emphasis>syntax on</emphasis> enables <command>vim</command>'s
[3546862]122syntax highliting. The <emphasis>set fileencodings=...</emphasis> makes
123<command>vim</command> capable of automatically detecting the character
124set of the file being edited (replace
125"<replaceable>your-8-bit-charset</replaceable>"
126with the value appropriate for your country, e.g. iso-8859-15 in Italy).
127This line is useful because bleeding-edge distributions
[b5b61fd]128like Fedora Core use UTF-8, and conservative ones like Debian
129use traditional 8-bit encodings for text files. If you have not
130passed the <option>--enable-multibyte</option> switch to the
131<command>./configure</command> command above, this line will not work.
[3e05705]132Finally, the <emphasis>if</emphasis> statement with the
133<emphasis>set background=dark</emphasis> corrects <command>vim</command>'s
134guess about the background color of some terminal emulators. This gives the
135highliting a better color scheme for use on the black background of
136these programs.
[b5b61fd]137</para>
[342b176]138
[dc32fef]139<para>Documentation for other available options can be obtained by running
140the following command:</para>
141
142<screen><userinput>vim -c ':options'</userinput></screen>
143
[342b176]144</sect2>
[0ba2766b]145
[5888299]146
[c6cb3aa]147<sect2 id="contents-vim" role="content"><title>Contents of Vim</title>
[673b0d8]148
[c6cb3aa]149<segmentedlist>
150<segtitle>Installed programs</segtitle>
151<seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
152pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim),
153view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh,
154vimtutor and xxd</seg></seglistitem>
155</segmentedlist>
[673b0d8]156
[c6cb3aa]157<variablelist><title>Short descriptions</title>
[673b0d8]158
[b8a819f]159<varlistentry id="efm_filter.pl">
160<term><command>efm_filter.pl</command></term>
[c6cb3aa]161<listitem>
[673b0d8]162<indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
[c6cb3aa]163<para>is a filter for creating an error file that can be read by vim.</para>
164</listitem>
165</varlistentry>
[673b0d8]166
[b8a819f]167<varlistentry id="efm_perl.pl">
168<term><command>efm_perl.pl</command></term>
[c6cb3aa]169<listitem>
[673b0d8]170<indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
[c6cb3aa]171<para>reformats the error messages of the
[673b0d8]172Perl interpreter for use with the <quote>quickfix</quote> mode of vim.</para>
[c6cb3aa]173</listitem>
174</varlistentry>
[673b0d8]175
[b8a819f]176<varlistentry id="ex">
177<term><command>ex</command></term>
[c6cb3aa]178<listitem>
[673b0d8]179<indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
[c6cb3aa]180<para>starts vim in ex mode.</para>
181</listitem>
182</varlistentry>
[673b0d8]183
[b8a819f]184<varlistentry id="less.sh">
185<term><command>less.sh</command></term>
[c6cb3aa]186<listitem>
[673b0d8]187<indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
[c6cb3aa]188<para>is a script that starts vim with less.vim.</para>
189</listitem>
190</varlistentry>
[673b0d8]191
[b8a819f]192<varlistentry id="mve.awk">
193<term><command>mve.awk</command></term>
[c6cb3aa]194<listitem>
[673b0d8]195<indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
[c6cb3aa]196<para>processes vim errors.</para>
197</listitem>
198</varlistentry>
[673b0d8]199
[b8a819f]200<varlistentry id="pltags.pl">
201<term><command>pltags.pl</command></term>
[c6cb3aa]202<listitem>
[673b0d8]203<indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
[c6cb3aa]204<para>creates a tags file for perl code, for use by vim.</para>
205</listitem>
206</varlistentry>
[673b0d8]207
[b8a819f]208<varlistentry id="ref">
209<term><command>ref</command></term>
[c6cb3aa]210<listitem>
[673b0d8]211<indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
[c6cb3aa]212<para>checks the spelling of arguments.</para>
213</listitem>
214</varlistentry>
[673b0d8]215
[b8a819f]216<varlistentry id="rview">
217<term><command>rview</command></term>
[c6cb3aa]218<listitem>
[673b0d8]219<indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
[c6cb3aa]220<para>is a restricted version of view: no shell
[673b0d8]221commands can be started and view can't be suspended.</para>
[c6cb3aa]222</listitem>
223</varlistentry>
[673b0d8]224
[b8a819f]225<varlistentry id="rvim">
226<term><command>rvim</command></term>
[c6cb3aa]227<listitem>
[673b0d8]228<indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
[c6cb3aa]229<para>is a restricted version of vim: no shell
[673b0d8]230commands can be started and vim can't be suspended.</para>
[c6cb3aa]231</listitem>
232</varlistentry>
[73aedd1d]233
[b8a819f]234<varlistentry id="shtags.pl">
235<term><command>shtags.pl</command></term>
[c6cb3aa]236<listitem>
[673b0d8]237<indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
[c6cb3aa]238<para>generates a tag file for perl scripts.</para>
239</listitem>
240</varlistentry>
[673b0d8]241
[b8a819f]242<varlistentry id="tcltags">
243<term><command>tcltags</command></term>
[c6cb3aa]244<listitem>
[673b0d8]245<indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
[c6cb3aa]246<para>generates a tag file for TCL code.</para>
247</listitem>
248</varlistentry>
[673b0d8]249
[b8a819f]250<varlistentry id="view">
251<term><command>view</command></term>
[c6cb3aa]252<listitem>
[673b0d8]253<indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
[c6cb3aa]254<para>starts vim in read-only mode.</para>
255</listitem>
256</varlistentry>
[673b0d8]257
[b8a819f]258<varlistentry id="vim">
259<term><command>vim</command></term>
[c6cb3aa]260<listitem>
[673b0d8]261<indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
[c6cb3aa]262<para>is the editor.</para>
263</listitem>
264</varlistentry>
[673b0d8]265
[b8a819f]266<varlistentry id="vim132">
267<term><command>vim132</command></term>
[c6cb3aa]268<listitem>
[673b0d8]269<indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
[c6cb3aa]270<para>starts vim with the terminal in 132-column mode.</para>
271</listitem>
272</varlistentry>
[673b0d8]273
[b8a819f]274<varlistentry id="vim2html.pl">
275<term><command>vim2html.pl</command></term>
[c6cb3aa]276<listitem>
[673b0d8]277<indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
[c6cb3aa]278<para>converts vim documentation to HTML.</para>
279</listitem>
280</varlistentry>
[673b0d8]281
[b8a819f]282<varlistentry id="vimdiff">
283<term><command>vimdiff</command></term>
[c6cb3aa]284<listitem>
[673b0d8]285<indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
[c6cb3aa]286<para>edits two or three versions of a file with vim and show differences.</para>
287</listitem>
288</varlistentry>
[673b0d8]289
[b8a819f]290<varlistentry id="vimm">
291<term><command>vimm</command></term>
[c6cb3aa]292<listitem>
[673b0d8]293<indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
[c6cb3aa]294<para>enables the DEC locator input model on a remote terminal.</para>
295</listitem>
296</varlistentry>
[673b0d8]297
[b8a819f]298<varlistentry id="vimspell.sh">
299<term><command>vimspell.sh</command></term>
[c6cb3aa]300<listitem>
[673b0d8]301<indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
[c6cb3aa]302<para>is a script which spells a file and generates the syntax statements necessary
303to highlight in vim. This script requires the old Unix <command>spell</command>
304command, which is provided neither in LFS nor in BLFS.</para>
305</listitem>
306</varlistentry>
307
[b8a819f]308<varlistentry id="vimtutor">
309<term><command>vimtutor</command></term>
[c6cb3aa]310<listitem>
[673b0d8]311<indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
[c6cb3aa]312<para>teaches you the basic keys and commands of vim.</para>
313</listitem>
314</varlistentry>
[673b0d8]315
[b8a819f]316<varlistentry id="xxd">
317<term><command>xxd</command></term>
[c6cb3aa]318<listitem>
[673b0d8]319<indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
[c6cb3aa]320<para>makes a hex dump of the given file. It can
[673b0d8]321also do the reverse, so it can be used for binary patching.</para>
[c6cb3aa]322</listitem>
323</varlistentry>
324</variablelist>
[673b0d8]325
326</sect2>
327
328</sect1>
Note: See TracBrowser for help on using the repository browser.