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