1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="postlfs-config-vimrc" xreflabel="The vimrc Files">
|
---|
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 |
|
---|
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>
|
---|
56 |
|
---|
57 | <screen><literal>" Begin .vimrc
|
---|
58 |
|
---|
59 | set columns=80
|
---|
60 | set wrapmargin=8
|
---|
61 | set ruler
|
---|
62 |
|
---|
63 | " End .vimrc</literal></screen>
|
---|
64 |
|
---|
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>
|
---|
70 |
|
---|
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>
|
---|
75 |
|
---|
76 | <itemizedlist>
|
---|
77 | <!--
|
---|
78 | <listitem>
|
---|
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>
|
---|
86 | </listitem>
|
---|
87 | <listitem>
|
---|
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>
|
---|
93 | </listitem>
|
---|
94 | -->
|
---|
95 | <listitem>
|
---|
96 | <para>
|
---|
97 | <option>set columns=80</option>: This simply sets the
|
---|
98 | number of columns used on the screen.
|
---|
99 | </para>
|
---|
100 | </listitem>
|
---|
101 | <!--
|
---|
102 | <listitem>
|
---|
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>
|
---|
108 | </listitem>
|
---|
109 | -->
|
---|
110 | <listitem>
|
---|
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>
|
---|
115 | </listitem>
|
---|
116 | <!--
|
---|
117 | <listitem>
|
---|
118 | <para>
|
---|
119 | <option>syntax on</option>: Enables
|
---|
120 | <command>vim</command>'s syntax highlighting.
|
---|
121 | </para>
|
---|
122 | </listitem>
|
---|
123 | -->
|
---|
124 | <listitem>
|
---|
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>
|
---|
129 | </listitem>
|
---|
130 | </itemizedlist>
|
---|
131 |
|
---|
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>
|
---|
141 |
|
---|
142 | </sect1>
|
---|