glfs/postlfs/config/vimrc.xml
Mark Hymers f45b195302 Initial revision
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@3 af4574ff-66df-0310-9fd7-8a98e5e911e0
2002-07-07 20:28:42 +00:00

93 lines
3.3 KiB
XML

<sect1 id="postlfs-config-vimrc">
<?dbhtml filename="vimrc.html" dir="postlfs"?>
<title>/etc/vimrc, ~/.vimrc</title>
<para>The LFS book installs vim as its editor. At this point we should
state that there are a <emphasis>lot</emphasis> of different editors out
there including emacs, nano, joe 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 vim and emacs
users!</para>
<para>The LFS book gives a basic <filename>vimrc</filename> file. Here,
we attempt to enhance this file. At startup, vim reads
<filename>/etc/vimrc</filename> and <filename>~/.vimrc</filename>
(i.e., the global vimrc and the user-specific one.). Note that this is
only true if you compiled vim using LFS-3.1 onwards. Prior to this,
the global vimrc was <filename>/usr/share/vim/vimrc</filename>.</para>
<para>Here is an example of a slightly expanded vimrc:</para>
<para><screen>" Begin .vimrc
set nocompatible
set bs=2
set columns=80
set background=dark
set tabstop=8
set wrapmargin=8
set nobk
syntax on
set ruler
set noexpandtab
" End .vimrc</screen></para>
<para>A FAQ on the lfs lists regards the comment tags in vimrc. Note
that they are " instead of the more usual # or //. This is correct, the
syntax for vimrc 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><userinput>set nocompatible :</userinput>
This option stops vim from behaving in a strongly vi-compatible way. It
should be at the start of any vimrc file as it can affect lots of other
options which you may want to override.</para></listitem>
<listitem><para><userinput>set bs=2 :</userinput>
This influences the behaviour of the backspace option. It is fairly
complex so see <userinput>:help 'bs'</userinput> for more
details.</para></listitem>
<listitem><para><userinput>set columns=80 :</userinput>
This simply sets the number of columns used on the
screen.</para></listitem>
<listitem><para><userinput>set background=dark :</userinput>
This tells vim to use colours which look good on a dark
background.</para></listitem>
<listitem><para><userinput>set tabstop=8 :</userinput>
The number of spaces which a tabstop takes.</para></listitem>
<listitem><para><userinput>set wrapmargin=8 :</userinput>
This is the number of characters from the right window
border where wrapping starts.</para></listitem>
<listitem><para><userinput>set nobk :</userinput>
This stops vim from creating a backup before
overwriting a file.</para></listitem>
<listitem><para><userinput>syntax on :</userinput>
Enables vim's syntax highlighting.</para></listitem>
<listitem><para><userinput>set ruler :</userinput>
This makes vim show the current row and column at the bottom right of
the screen.</para></listitem>
<listitem><para><userinput>set noexpandtab :</userinput>
This makes vim insert tabs as tab characters instead of as a set of
spaces.</para></listitem>
</itemizedlist>
<para>More information on the <emphasis>many</emphasis> vim options
can be found by reading the help inside vim itself. Do this by typing
<userinput>:help</userinput> in vim to get the general help, or by
typing <userinput>:help usr_toc.txt</userinput> to view the User Manual
Table of Contents.</para>
</sect1>