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 |
|
---|
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 |
|
---|
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>
|
---|
53 |
|
---|
54 | <screen><literal>" Begin .vimrc
|
---|
55 |
|
---|
56 | set columns=80
|
---|
57 | set wrapmargin=8
|
---|
58 | set ruler
|
---|
59 |
|
---|
60 | " End .vimrc</literal></screen>
|
---|
61 |
|
---|
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>
|
---|
67 |
|
---|
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>
|
---|
72 |
|
---|
73 | <itemizedlist>
|
---|
74 | <!--
|
---|
75 | <listitem>
|
---|
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>
|
---|
83 | </listitem>
|
---|
84 | <listitem>
|
---|
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>
|
---|
90 | </listitem>
|
---|
91 | -->
|
---|
92 | <listitem>
|
---|
93 | <para>
|
---|
94 | <option>set columns=80</option>: This simply sets the
|
---|
95 | number of columns used on the screen.
|
---|
96 | </para>
|
---|
97 | </listitem>
|
---|
98 | <!--
|
---|
99 | <listitem>
|
---|
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>
|
---|
105 | </listitem>
|
---|
106 | -->
|
---|
107 | <listitem>
|
---|
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>
|
---|
112 | </listitem>
|
---|
113 | <!--
|
---|
114 | <listitem>
|
---|
115 | <para>
|
---|
116 | <option>syntax on</option>: Enables
|
---|
117 | <command>vim</command>'s syntax highlighting.
|
---|
118 | </para>
|
---|
119 | </listitem>
|
---|
120 | -->
|
---|
121 | <listitem>
|
---|
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>
|
---|
126 | </listitem>
|
---|
127 | </itemizedlist>
|
---|
128 |
|
---|
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>
|
---|
138 |
|
---|
139 | </sect1>
|
---|