[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 |
|
---|
[78b3cd61] | 8 | <sect1 id="postlfs-config-vimrc" xreflabel="/etc/vimrc, ~/.vimrc">
|
---|
[a0f03b0] | 9 | <sect1info>
|
---|
[5cd0959d] | 10 | <othername>$LastChangedBy$</othername>
|
---|
| 11 | <date>$Date$</date>
|
---|
[a0f03b0] | 12 | </sect1info>
|
---|
[bae6e15] | 13 | <?dbhtml filename="vimrc.html"?>
|
---|
[f45b1953] | 14 | <title>/etc/vimrc, ~/.vimrc</title>
|
---|
| 15 |
|
---|
[1ea79a1] | 16 | <para>The <acronym>LFS</acronym> book installs <application>vim</application>
|
---|
| 17 | as its text editor. At this point we should state that there are a
|
---|
| 18 | <emphasis>lot</emphasis> of different editing applications out there including
|
---|
| 19 | <application>emacs</application>, <application>nano</application>,
|
---|
| 20 | <application>joe</application> and many more. Anyone who has been around the
|
---|
| 21 | Internet (especially usenet) for a short time will certainly have observed at
|
---|
| 22 | least one flame war, usually involving <application>vim</application> and
|
---|
[78b3cd61] | 23 | <application>emacs</application> users!</para>
|
---|
| 24 |
|
---|
| 25 | <para>The <acronym>LFS</acronym> book gives a basic <filename>vimrc
|
---|
| 26 | </filename> file. Here, we attempt to enhance this file. At startup,
|
---|
| 27 | <command>vim</command> reads <filename>/etc/vimrc</filename> and
|
---|
| 28 | <filename>~/.vimrc</filename> (i.e., the global
|
---|
| 29 | <filename>vimrc</filename> and the user-specific one.). Note that this is
|
---|
| 30 | only true if you compiled <application>vim</application> using
|
---|
| 31 | <acronym>LFS</acronym>-3.1 onwards. Prior to this,
|
---|
| 32 | the global <filename>vimrc</filename> was <filename>/usr/share/vim/vimrc
|
---|
| 33 | </filename>.</para>
|
---|
| 34 |
|
---|
| 35 | <para>Here is a slightly expanded <filename>vimrc</filename> that you can
|
---|
| 36 | put in <filename>/etc/vimrc</filename> to provide global effect. Of course, if
|
---|
[cfc2a54] | 37 | you put it into <filename>/etc/skel/.vimrc</filename> instead, it will
|
---|
| 38 | be made available to users you add to the system later. You can also copy
|
---|
| 39 | the file from <filename>/etc/skel/.vimrc</filename> to
|
---|
| 40 | <filename>/etc/vimrc</filename> and the home directory of users already
|
---|
[1ea79a1] | 41 | on the system, like root. Be sure to set permissions, owner, and group if
|
---|
[cfc2a54] | 42 | you do copy anything directly from <filename>/etc/skel</filename>.</para>
|
---|
[f45b1953] | 43 |
|
---|
[c442d19] | 44 | <screen>" Begin .vimrc
|
---|
[f45b1953] | 45 |
|
---|
[1cae4b1] | 46 | set nocompatible
|
---|
[f45b1953] | 47 | set bs=2
|
---|
[36ae4612] | 48 | set columns=80
|
---|
[f45b1953] | 49 | set background=dark
|
---|
[36ae4612] | 50 | set wrapmargin=8
|
---|
[f45b1953] | 51 | syntax on
|
---|
| 52 | set ruler
|
---|
| 53 |
|
---|
[c442d19] | 54 | " End .vimrc</screen>
|
---|
[f45b1953] | 55 |
|
---|
[78b3cd61] | 56 | <para>A <acronym>FAQ</acronym> on the lfs mailing lists regards the
|
---|
| 57 | comment tags in <filename>vimrc</filename>. Note that they are " instead
|
---|
| 58 | of the more usual # or //. This is correct, the syntax for <filename>vimrc
|
---|
| 59 | </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 | <itemizedlist>
|
---|
| 64 |
|
---|
[1cae4b1] | 65 | <listitem><para><option>set nocompatible</option> : This option
|
---|
| 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'
|
---|
| 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 |
|
---|
[2df36e4] | 78 | <listitem><para><option>set background=dark</option>: This tells
|
---|
[78b3cd61] | 79 | <command>vim</command> to use colors which look good on a dark
|
---|
[f45b1953] | 80 | background.</para></listitem>
|
---|
| 81 |
|
---|
[2df36e4] | 82 | <listitem><para><option>set wrapmargin=8</option>: This is the number of
|
---|
[36ae4612] | 83 | characters from the right window border where wrapping starts.</para>
|
---|
| 84 | </listitem>
|
---|
| 85 |
|
---|
[2df36e4] | 86 | <listitem><para><option>syntax on</option>: Enables
|
---|
[78b3cd61] | 87 | <command>vim</command>'s syntax highlighting.</para></listitem>
|
---|
[f45b1953] | 88 |
|
---|
[2df36e4] | 89 | <listitem><para><option>set ruler</option>: This makes <command>vim
|
---|
[78b3cd61] | 90 | </command> show the current row and column at the bottom right of
|
---|
[f45b1953] | 91 | the screen.</para></listitem>
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | </itemizedlist>
|
---|
| 95 |
|
---|
[78b3cd61] | 96 | <para>More information on the <emphasis>many</emphasis> <command>vim</command>
|
---|
| 97 | options can be found by reading the help inside <command>vim</command> itself.
|
---|
[3df86b66] | 98 | Do this by typing <command>:</command><option>help</option> in
|
---|
[78b3cd61] | 99 | <command>vim</command> to get the general help, or by typing <command>:
|
---|
[3df86b66] | 100 | </command><option>help usr_toc.txt</option> to view
|
---|
[78b3cd61] | 101 | the User Manual Table of Contents.</para>
|
---|
[f45b1953] | 102 |
|
---|
| 103 | </sect1>
|
---|
| 104 |
|
---|