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