[f8d632ac] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[0290a023] | 8 | <sect1 id="postlfs-config-vimrc" xreflabel="The vimrc Files">
|
---|
[a0f03b0] | 9 | <sect1info>
|
---|
[5cd0959d] | 10 | <othername>$LastChangedBy$</othername>
|
---|
| 11 | <date>$Date$</date>
|
---|
[a0f03b0] | 12 | </sect1info>
|
---|
[bae6e15] | 13 | <?dbhtml filename="vimrc.html"?>
|
---|
[0290a023] | 14 | <title>The /etc/vimrc and ~/.vimrc Files</title>
|
---|
| 15 | <indexterm zone="postlfs-config-vimrc">
|
---|
| 16 | <primary sortas="e-etc-vimrc-vimrc">/etc/vimrc</primary></indexterm>
|
---|
| 17 | <indexterm zone="postlfs-config-vimrc">
|
---|
| 18 | <primary sortas="e-AA.vimrc-vimrc">~/.vimrc</primary></indexterm>
|
---|
[f45b1953] | 19 |
|
---|
[0290a023] | 20 | <para>The <acronym>LFS</acronym> book installs <application>Vim</application>
|
---|
[1ea79a1] | 21 | as its text editor. At this point we should state that there are a
|
---|
| 22 | <emphasis>lot</emphasis> of different editing applications out there including
|
---|
[0290a023] | 23 | <application>Emacs</application>, <application>nano</application>,
|
---|
| 24 | <application>Joe</application> and many more. Anyone who has been around the
|
---|
[1ea79a1] | 25 | Internet (especially usenet) for a short time will certainly have observed at
|
---|
[0290a023] | 26 | least one flame war, usually involving <application>Vim</application> and
|
---|
| 27 | <application>Emacs</application> users!</para>
|
---|
[78b3cd61] | 28 |
|
---|
| 29 | <para>The <acronym>LFS</acronym> book gives a basic <filename>vimrc
|
---|
| 30 | </filename> file. Here, we attempt to enhance this file. At startup,
|
---|
| 31 | <command>vim</command> reads <filename>/etc/vimrc</filename> and
|
---|
| 32 | <filename>~/.vimrc</filename> (i.e., the global
|
---|
| 33 | <filename>vimrc</filename> and the user-specific one.). Note that this is
|
---|
| 34 | only true if you compiled <application>vim</application> using
|
---|
| 35 | <acronym>LFS</acronym>-3.1 onwards. Prior to this,
|
---|
[0290a023] | 36 | the global <filename>vimrc</filename> was
|
---|
| 37 | <filename>/usr/share/vim/vimrc</filename>.</para>
|
---|
[78b3cd61] | 38 |
|
---|
[7aaad25] | 39 | <para>Here is a slightly expanded <filename>.vimrc</filename> that you can
|
---|
| 40 | put in <filename>~/.vimrc</filename> to provide user specific effects. Of
|
---|
| 41 | course, if you put it into <filename>/etc/skel/.vimrc</filename> instead, it
|
---|
| 42 | will be made available to users you add to the system later. You can also copy
|
---|
| 43 | the file from <filename>/etc/skel/.vimrc</filename> to the home directory of
|
---|
| 44 | users already on the system, like root. Be sure to set permissions, owner, and
|
---|
[0290a023] | 45 | group if you do copy anything directly from
|
---|
| 46 | <filename>/etc/skel</filename>.</para>
|
---|
[f45b1953] | 47 |
|
---|
[c442d19] | 48 | <screen>" Begin .vimrc
|
---|
[f45b1953] | 49 |
|
---|
[36ae4612] | 50 | set columns=80
|
---|
| 51 | set wrapmargin=8
|
---|
[f45b1953] | 52 | set ruler
|
---|
| 53 |
|
---|
[c442d19] | 54 | " End .vimrc</screen>
|
---|
[f45b1953] | 55 |
|
---|
[0290a023] | 56 | <para>A <acronym>FAQ</acronym> on the <acronym>LFS</acronym> mailing lists
|
---|
| 57 | regards the comment tags in <filename>vimrc</filename>. Note that they are "
|
---|
| 58 | instead of the more usual # or //. This is correct, the syntax for
|
---|
| 59 | <filename>vimrc</filename> is slightly unusual.</para>
|
---|
[f45b1953] | 60 |
|
---|
| 61 | <para>We'll run through a quick explanation of what each of the
|
---|
| 62 | options in this example file means here:</para>
|
---|
| 63 |
|
---|
[0290a023] | 64 | <itemizedlist>
|
---|
[7aaad25] | 65 | <!-- <listitem><para><option>set nocompatible</option> : This option
|
---|
[1cae4b1] | 66 | stops <command>vim</command> from behaving in a strongly <command>vi
|
---|
| 67 | </command>-compatible way. It should be at the start of any <filename>vimrc
|
---|
| 68 | </filename> file as it can affect lots of other options which you may want to
|
---|
| 69 | override.</para></listitem>
|
---|
| 70 |
|
---|
[2df36e4] | 71 | <listitem><para><option>set bs=2</option>: This influences the behavior
|
---|
[3df86b66] | 72 | of the backspace option. It is fairly complex so see <command>:help 'bs'
|
---|
[7aaad25] | 73 | </command> for more details.</para></listitem> -->
|
---|
[f45b1953] | 74 |
|
---|
[2df36e4] | 75 | <listitem><para><option>set columns=80</option>: This simply sets the
|
---|
[78b3cd61] | 76 | number of columns used on the screen.</para></listitem>
|
---|
[f45b1953] | 77 |
|
---|
[7aaad25] | 78 | <!-- <listitem><para><option>set background=dark</option>: This tells
|
---|
[78b3cd61] | 79 | <command>vim</command> to use colors which look good on a dark
|
---|
[7aaad25] | 80 | background.</para></listitem> -->
|
---|
[f45b1953] | 81 |
|
---|
[2df36e4] | 82 | <listitem><para><option>set wrapmargin=8</option>: This is the number of
|
---|
[0290a023] | 83 | characters from the right window border where wrapping starts.</para>
|
---|
[36ae4612] | 84 | </listitem>
|
---|
| 85 |
|
---|
[7aaad25] | 86 | <!-- <listitem><para><option>syntax on</option>: Enables
|
---|
| 87 | <command>vim</command>'s syntax highlighting.</para></listitem> -->
|
---|
[f45b1953] | 88 |
|
---|
[0290a023] | 89 | <listitem><para><option>set ruler</option>: This makes
|
---|
| 90 | <command>vim</command> show the current row and column at the bottom right of
|
---|
[f45b1953] | 91 | the screen.</para></listitem>
|
---|
| 92 | </itemizedlist>
|
---|
| 93 |
|
---|
[78b3cd61] | 94 | <para>More information on the <emphasis>many</emphasis> <command>vim</command>
|
---|
| 95 | options can be found by reading the help inside <command>vim</command> itself.
|
---|
[3df86b66] | 96 | Do this by typing <command>:</command><option>help</option> in
|
---|
[0290a023] | 97 | <command>vim</command> to get the general help, or by typing
|
---|
| 98 | <command>:</command><option>help usr_toc.txt</option> to view
|
---|
[78b3cd61] | 99 | the User Manual Table of Contents.</para>
|
---|
[f45b1953] | 100 |
|
---|
| 101 | </sect1>
|
---|
| 102 |
|
---|