[f8d632ac] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[f8d632ac] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[0290a023] | 8 | <sect1 id="postlfs-config-vimrc" xreflabel="The vimrc Files">
|
---|
[1cb62b2] | 9 | <?dbhtml filename="vimrc.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info>
|
---|
| 12 | <date>$Date$</date>
|
---|
| 13 | </sect1info>
|
---|
| 14 |
|
---|
| 15 | <title>The /etc/vimrc and ~/.vimrc Files</title>
|
---|
| 16 |
|
---|
| 17 | <indexterm zone="postlfs-config-vimrc">
|
---|
| 18 | <primary sortas="e-etc-vimrc">/etc/vimrc</primary>
|
---|
| 19 | </indexterm>
|
---|
| 20 |
|
---|
| 21 | <indexterm zone="postlfs-config-vimrc">
|
---|
| 22 | <primary sortas="e-AA.vimrc">~/.vimrc</primary>
|
---|
| 23 | </indexterm>
|
---|
| 24 |
|
---|
[81a73ed8] | 25 | <para>
|
---|
| 26 | The LFS book installs <application>Vim</application> as its text editor.
|
---|
| 27 | At this point it should be noted that there are a <emphasis>lot</emphasis>
|
---|
| 28 | of different editing applications out there including
|
---|
| 29 | <application>Emacs</application>, <application>nano</application>,
|
---|
| 30 | <application>Joe</application> and many more. Anyone who has been
|
---|
| 31 | around the Internet (especially usenet) for a short time will certainly
|
---|
| 32 | have observed at least one flame war, usually involving
|
---|
| 33 | <application>Vim</application> and <application>Emacs</application> users!
|
---|
| 34 | </para>
|
---|
| 35 |
|
---|
| 36 | <para>
|
---|
| 37 | The LFS book creates a basic <filename>vimrc</filename> file. In this
|
---|
| 38 | section you'll find an attempt to enhance this file. At startup,
|
---|
| 39 | <command>vim</command> reads the global configuration file
|
---|
| 40 | (<filename>/etc/vimrc</filename>) as well as a user-specific file
|
---|
| 41 | (<filename>~/.vimrc</filename>). Either or both can be tailored to suit
|
---|
| 42 | the needs of your particular system.
|
---|
| 43 | </para>
|
---|
| 44 |
|
---|
| 45 | <para>
|
---|
| 46 | Here is a slightly expanded <filename>.vimrc</filename> that you can put
|
---|
| 47 | in <filename>~/.vimrc</filename> to provide user specific effects. Of
|
---|
| 48 | course, if you put it into <filename>/etc/skel/.vimrc</filename> instead,
|
---|
| 49 | it will be made available to users you add to the system later. You
|
---|
| 50 | can also copy the file from <filename>/etc/skel/.vimrc</filename> to
|
---|
| 51 | the home directory of users already on the system, such as <systemitem
|
---|
| 52 | class='username'>root</systemitem>. Be sure to set permissions, owner,
|
---|
| 53 | and group if you do copy anything directly from <filename
|
---|
| 54 | class="directory">/etc/skel</filename>.
|
---|
| 55 | </para>
|
---|
[1cb62b2] | 56 |
|
---|
| 57 | <screen><literal>" Begin .vimrc
|
---|
[f45b1953] | 58 |
|
---|
[36ae4612] | 59 | set columns=80
|
---|
| 60 | set wrapmargin=8
|
---|
[f45b1953] | 61 | set ruler
|
---|
| 62 |
|
---|
[1cb62b2] | 63 | " End .vimrc</literal></screen>
|
---|
| 64 |
|
---|
[81a73ed8] | 65 | <para>
|
---|
| 66 | Note that the comment tags are " instead of the more
|
---|
| 67 | usual # or //. This is correct, the syntax for
|
---|
| 68 | <filename>vimrc</filename> is slightly unusual.
|
---|
| 69 | </para>
|
---|
[1cb62b2] | 70 |
|
---|
[81a73ed8] | 71 | <para>
|
---|
| 72 | Below you'll find a quick explanation of what each of the
|
---|
| 73 | options in this example file means here:
|
---|
| 74 | </para>
|
---|
[1cb62b2] | 75 |
|
---|
| 76 | <itemizedlist>
|
---|
[e0d33ef] | 77 | <!--
|
---|
[1cb62b2] | 78 | <listitem>
|
---|
[81a73ed8] | 79 | <para>
|
---|
| 80 | <option>set nocompatible</option> : This option
|
---|
| 81 | stops <command>vim</command> from behaving in a strongly <command>vi
|
---|
| 82 | </command>-compatible way. It should be at the start of any
|
---|
| 83 | <filename>vimrc </filename> file as it can affect lots of other
|
---|
| 84 | options which you may want to override.
|
---|
| 85 | </para>
|
---|
[1cb62b2] | 86 | </listitem>
|
---|
| 87 | <listitem>
|
---|
[81a73ed8] | 88 | <para>
|
---|
| 89 | <option>set bs=2</option>: This influences the behavior of the
|
---|
| 90 | backspace option. It is fairly complex so see <command>:help 'bs'
|
---|
| 91 | </command> for more details.
|
---|
| 92 | </para>
|
---|
[d612b9f] | 93 | </listitem>
|
---|
[1cb62b2] | 94 | -->
|
---|
| 95 | <listitem>
|
---|
[81a73ed8] | 96 | <para>
|
---|
| 97 | <option>set columns=80</option>: This simply sets the
|
---|
| 98 | number of columns used on the screen.
|
---|
| 99 | </para>
|
---|
[1cb62b2] | 100 | </listitem>
|
---|
[e0d33ef] | 101 | <!--
|
---|
[1cb62b2] | 102 | <listitem>
|
---|
[81a73ed8] | 103 | <para>
|
---|
| 104 | <option>set background=dark</option>: This tells
|
---|
| 105 | <command>vim</command> to use colors which look good on a dark
|
---|
| 106 | background.
|
---|
| 107 | </para>
|
---|
[d612b9f] | 108 | </listitem>
|
---|
[1cb62b2] | 109 | -->
|
---|
| 110 | <listitem>
|
---|
[81a73ed8] | 111 | <para>
|
---|
| 112 | <option>set wrapmargin=8</option>: This is the number of
|
---|
| 113 | characters from the right window border where wrapping starts.
|
---|
| 114 | </para>
|
---|
[1cb62b2] | 115 | </listitem>
|
---|
[e0d33ef] | 116 | <!--
|
---|
[1cb62b2] | 117 | <listitem>
|
---|
[81a73ed8] | 118 | <para>
|
---|
| 119 | <option>syntax on</option>: Enables
|
---|
| 120 | <command>vim</command>'s syntax highlighting.
|
---|
| 121 | </para>
|
---|
[1cb62b2] | 122 | </listitem>
|
---|
| 123 | -->
|
---|
| 124 | <listitem>
|
---|
[81a73ed8] | 125 | <para>
|
---|
| 126 | <option>set ruler</option>: This makes <command>vim</command>
|
---|
| 127 | show the current row and column at the bottom right of the screen.
|
---|
| 128 | </para>
|
---|
[1cb62b2] | 129 | </listitem>
|
---|
| 130 | </itemizedlist>
|
---|
| 131 |
|
---|
[81a73ed8] | 132 | <para>
|
---|
| 133 | More information on the <emphasis>many</emphasis>
|
---|
| 134 | <command>vim</command> options can be found by reading the help
|
---|
| 135 | inside <command>vim</command> itself. Do this by typing
|
---|
| 136 | <command>:</command><option>help</option> in
|
---|
| 137 | <command>vim</command> to get the general help, or by typing
|
---|
| 138 | <command>:</command><option>help usr_toc.txt</option> to view
|
---|
| 139 | the User Manual Table of Contents.
|
---|
| 140 | </para>
|
---|
[f45b1953] | 141 |
|
---|
| 142 | </sect1>
|
---|