2004-06-10 12:31:35 +08:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
<!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
|
|
|
<!ENTITY % general-entities SYSTEM "../../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
|
|
|
|
2003-09-22 00:44:58 +08:00
|
|
|
<sect1 id="postlfs-config-vimrc" xreflabel="/etc/vimrc, ~/.vimrc">
|
2004-08-10 12:23:09 +08:00
|
|
|
<sect1info>
|
2004-08-10 12:25:57 +08:00
|
|
|
<othername>$LastChangedBy$</othername>
|
|
|
|
<date>$Date$</date>
|
2004-08-10 12:23:09 +08:00
|
|
|
</sect1info>
|
2004-05-07 04:30:53 +08:00
|
|
|
<?dbhtml filename="vimrc.html"?>
|
2002-07-08 04:28:42 +08:00
|
|
|
<title>/etc/vimrc, ~/.vimrc</title>
|
|
|
|
|
2004-05-30 13:30:47 +08:00
|
|
|
<para>The <acronym>LFS</acronym> book installs <application>vim</application>
|
|
|
|
as its text editor. At this point we should state that there are a
|
|
|
|
<emphasis>lot</emphasis> of different editing applications 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
|
2003-09-22 00:44:58 +08:00
|
|
|
<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>
|
|
|
|
|
2004-11-09 00:03:59 +08:00
|
|
|
<para>Here is a slightly expanded <filename>.vimrc</filename> that you can
|
|
|
|
put in <filename>~/.vimrc</filename> to provide user specific effects. 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 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>
|
2002-07-08 04:28:42 +08:00
|
|
|
|
2003-09-24 00:38:50 +08:00
|
|
|
<screen>" Begin .vimrc
|
2002-07-08 04:28:42 +08:00
|
|
|
|
2003-09-28 22:59:29 +08:00
|
|
|
set columns=80
|
|
|
|
set wrapmargin=8
|
2002-07-08 04:28:42 +08:00
|
|
|
set ruler
|
|
|
|
|
2003-09-24 00:38:50 +08:00
|
|
|
" End .vimrc</screen>
|
2002-07-08 04:28:42 +08:00
|
|
|
|
2003-09-22 00:44:58 +08:00
|
|
|
<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>
|
2002-07-08 04:28:42 +08:00
|
|
|
|
|
|
|
<para>We'll run through a quick explanation of what each of the
|
|
|
|
options in this example file means here:</para>
|
|
|
|
<itemizedlist>
|
|
|
|
|
2004-11-09 00:03:59 +08:00
|
|
|
<!-- <listitem><para><option>set nocompatible</option> : This option
|
2003-11-14 05:39:50 +08:00
|
|
|
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>
|
|
|
|
|
2003-10-01 03:56:18 +08:00
|
|
|
<listitem><para><option>set bs=2</option>: This influences the behavior
|
2003-10-01 03:21:06 +08:00
|
|
|
of the backspace option. It is fairly complex so see <command>:help 'bs'
|
2004-11-09 00:03:59 +08:00
|
|
|
</command> for more details.</para></listitem> -->
|
2002-07-08 04:28:42 +08:00
|
|
|
|
2003-10-01 03:56:18 +08:00
|
|
|
<listitem><para><option>set columns=80</option>: This simply sets the
|
2003-09-22 00:44:58 +08:00
|
|
|
number of columns used on the screen.</para></listitem>
|
2002-07-08 04:28:42 +08:00
|
|
|
|
2004-11-09 00:03:59 +08:00
|
|
|
<!-- <listitem><para><option>set background=dark</option>: This tells
|
2003-09-22 00:44:58 +08:00
|
|
|
<command>vim</command> to use colors which look good on a dark
|
2004-11-09 00:03:59 +08:00
|
|
|
background.</para></listitem> -->
|
2002-07-08 04:28:42 +08:00
|
|
|
|
2003-10-01 03:56:18 +08:00
|
|
|
<listitem><para><option>set wrapmargin=8</option>: This is the number of
|
2003-09-28 22:59:29 +08:00
|
|
|
characters from the right window border where wrapping starts.</para>
|
|
|
|
</listitem>
|
|
|
|
|
2004-11-09 00:03:59 +08:00
|
|
|
<!-- <listitem><para><option>syntax on</option>: Enables
|
|
|
|
<command>vim</command>'s syntax highlighting.</para></listitem> -->
|
2002-07-08 04:28:42 +08:00
|
|
|
|
2003-10-01 03:56:18 +08:00
|
|
|
<listitem><para><option>set ruler</option>: This makes <command>vim
|
2003-09-22 00:44:58 +08:00
|
|
|
</command> show the current row and column at the bottom right of
|
2002-07-08 04:28:42 +08:00
|
|
|
the screen.</para></listitem>
|
|
|
|
|
|
|
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
2003-09-22 00:44:58 +08:00
|
|
|
<para>More information on the <emphasis>many</emphasis> <command>vim</command>
|
|
|
|
options can be found by reading the help inside <command>vim</command> itself.
|
2003-10-01 03:21:06 +08:00
|
|
|
Do this by typing <command>:</command><option>help</option> in
|
2003-09-22 00:44:58 +08:00
|
|
|
<command>vim</command> to get the general help, or by typing <command>:
|
2003-10-01 03:21:06 +08:00
|
|
|
</command><option>help usr_toc.txt</option> to view
|
2003-09-22 00:44:58 +08:00
|
|
|
the User Manual Table of Contents.</para>
|
2002-07-08 04:28:42 +08:00
|
|
|
|
|
|
|
</sect1>
|
|
|
|
|