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