mirror of
https://github.com/Zeckmathederg/glfs.git
synced 2025-01-27 18:02:12 +08:00
bae6e15af9
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@2105 af4574ff-66df-0310-9fd7-8a98e5e911e0
95 lines
3.9 KiB
XML
95 lines
3.9 KiB
XML
<sect1 id="postlfs-config-vimrc" xreflabel="/etc/vimrc, ~/.vimrc">
|
|
<?dbhtml filename="vimrc.html"?>
|
|
<title>/etc/vimrc, ~/.vimrc</title>
|
|
|
|
<para>The <acronym>LFS</acronym> book installs
|
|
<application>vim</application> as its editor. At this point we should
|
|
state that there are a <emphasis>lot</emphasis> of different editors out
|
|
there including <application>emacs</application>,
|
|
<application>nano</application>, <application>joe</application> and many
|
|
more. Anyone who has been around the Internet (especially usenet) for a
|
|
short time will certainly have observed at least one flame war, usually
|
|
involving <application>vim</application> and
|
|
<application>emacs</application> users!</para>
|
|
|
|
<para>The <acronym>LFS</acronym> book gives a basic <filename>vimrc
|
|
</filename> file. Here, we attempt to enhance this file. At startup,
|
|
<command>vim</command> reads <filename>/etc/vimrc</filename> and
|
|
<filename>~/.vimrc</filename> (i.e., the global
|
|
<filename>vimrc</filename> and the user-specific one.). Note that this is
|
|
only true if you compiled <application>vim</application> using
|
|
<acronym>LFS</acronym>-3.1 onwards. Prior to this,
|
|
the global <filename>vimrc</filename> was <filename>/usr/share/vim/vimrc
|
|
</filename>.</para>
|
|
|
|
<para>Here is a slightly expanded <filename>vimrc</filename> that you can
|
|
put in <filename>/etc/vimrc</filename> to provide global effect. Of course, if
|
|
you put it into <filename>/etc/skel/.vimrc</filename> instead, it will
|
|
be made available to users you add to the system later. You can also copy
|
|
the file from <filename>/etc/skel/.vimrc</filename> to
|
|
<filename>/etc/vimrc</filename> and the home directory of users already
|
|
on the system, like root. Be sure to set permissions, owner and group if
|
|
you do copy anything directly from <filename>/etc/skel</filename>.</para>
|
|
|
|
<screen>" Begin .vimrc
|
|
|
|
set nocompatible
|
|
set bs=2
|
|
set columns=80
|
|
set background=dark
|
|
set wrapmargin=8
|
|
syntax on
|
|
set ruler
|
|
|
|
" End .vimrc</screen>
|
|
|
|
<para>A <acronym>FAQ</acronym> on the lfs mailing lists regards the
|
|
comment tags in <filename>vimrc</filename>. Note that they are " instead
|
|
of the more usual # or //. This is correct, the syntax for <filename>vimrc
|
|
</filename> is slightly unusual.</para>
|
|
|
|
<para>We'll run through a quick explanation of what each of the
|
|
options in this example file means here:</para>
|
|
<itemizedlist>
|
|
|
|
<listitem><para><option>set nocompatible</option> : This option
|
|
stops <command>vim</command> from behaving in a strongly <command>vi
|
|
</command>-compatible way. It should be at the start of any <filename>vimrc
|
|
</filename> file as it can affect lots of other options which you may want to
|
|
override.</para></listitem>
|
|
|
|
<listitem><para><option>set bs=2</option>: This influences the behavior
|
|
of the backspace option. It is fairly complex so see <command>:help 'bs'
|
|
</command> for more details.</para></listitem>
|
|
|
|
<listitem><para><option>set columns=80</option>: This simply sets the
|
|
number of columns used on the screen.</para></listitem>
|
|
|
|
<listitem><para><option>set background=dark</option>: This tells
|
|
<command>vim</command> to use colors which look good on a dark
|
|
background.</para></listitem>
|
|
|
|
<listitem><para><option>set wrapmargin=8</option>: This is the number of
|
|
characters from the right window border where wrapping starts.</para>
|
|
</listitem>
|
|
|
|
<listitem><para><option>syntax on</option>: Enables
|
|
<command>vim</command>'s syntax highlighting.</para></listitem>
|
|
|
|
<listitem><para><option>set ruler</option>: This makes <command>vim
|
|
</command> show the current row and column at the bottom right of
|
|
the screen.</para></listitem>
|
|
|
|
|
|
</itemizedlist>
|
|
|
|
<para>More information on the <emphasis>many</emphasis> <command>vim</command>
|
|
options can be found by reading the help inside <command>vim</command> itself.
|
|
Do this by typing <command>:</command><option>help</option> in
|
|
<command>vim</command> to get the general help, or by typing <command>:
|
|
</command><option>help usr_toc.txt</option> to view
|
|
the User Manual Table of Contents.</para>
|
|
|
|
</sect1>
|
|
|