source: postlfs/config/vimrc.xml@ 9a639a3

v5_1-pre1
Last change on this file since 9a639a3 was bae6e15, checked in by Larry Lawrence <larry@…>, 20 years ago

fix xsl chunk error in PostLFS section

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@2105 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 3.9 KB
Line 
1<sect1 id="postlfs-config-vimrc" xreflabel="/etc/vimrc, ~/.vimrc">
2<?dbhtml filename="vimrc.html"?>
3<title>/etc/vimrc, ~/.vimrc</title>
4
5<para>The <acronym>LFS</acronym> book installs
6<application>vim</application> as its editor. At this point we should
7state that there are a <emphasis>lot</emphasis> of different editors out
8there including <application>emacs</application>,
9<application>nano</application>, <application>joe</application> and many
10more. Anyone who has been around the Internet (especially usenet) for a
11short time will certainly have observed at least one flame war, usually
12involving <application>vim</application> and
13<application>emacs</application> users!</para>
14
15<para>The <acronym>LFS</acronym> book gives a basic <filename>vimrc
16</filename> file. Here, we attempt to enhance this file. At startup,
17<command>vim</command> reads <filename>/etc/vimrc</filename> and
18<filename>~/.vimrc</filename> (i.e., the global
19<filename>vimrc</filename> and the user-specific one.). Note that this is
20only true if you compiled <application>vim</application> using
21<acronym>LFS</acronym>-3.1 onwards. Prior to this,
22the global <filename>vimrc</filename> was <filename>/usr/share/vim/vimrc
23</filename>.</para>
24
25<para>Here is a slightly expanded <filename>vimrc</filename> that you can
26put in <filename>/etc/vimrc</filename> to provide global effect. Of course, if
27you put it into <filename>/etc/skel/.vimrc</filename> instead, it will
28be made available to users you add to the system later. You can also copy
29the file from <filename>/etc/skel/.vimrc</filename> to
30<filename>/etc/vimrc</filename> and the home directory of users already
31on the system, like root. Be sure to set permissions, owner and group if
32you do copy anything directly from <filename>/etc/skel</filename>.</para>
33
34<screen>" Begin .vimrc
35
36set nocompatible
37set bs=2
38set columns=80
39set background=dark
40set wrapmargin=8
41syntax on
42set ruler
43
44" End .vimrc</screen>
45
46<para>A <acronym>FAQ</acronym> on the lfs mailing lists regards the
47comment tags in <filename>vimrc</filename>. Note that they are " instead
48of the more usual # or //. This is correct, the syntax for <filename>vimrc
49</filename> is slightly unusual.</para>
50
51<para>We'll run through a quick explanation of what each of the
52options in this example file means here:</para>
53<itemizedlist>
54
55<listitem><para><option>set nocompatible</option> : This option
56stops <command>vim</command> from behaving in a strongly <command>vi
57</command>-compatible way. It should be at the start of any <filename>vimrc
58</filename> file as it can affect lots of other options which you may want to
59override.</para></listitem>
60
61<listitem><para><option>set bs=2</option>: This influences the behavior
62of the backspace option. It is fairly complex so see <command>:help 'bs'
63</command> for more details.</para></listitem>
64
65<listitem><para><option>set columns=80</option>: This simply sets the
66number of columns used on the screen.</para></listitem>
67
68<listitem><para><option>set background=dark</option>: This tells
69<command>vim</command> to use colors which look good on a dark
70background.</para></listitem>
71
72<listitem><para><option>set wrapmargin=8</option>: This is the number of
73characters from the right window border where wrapping starts.</para>
74</listitem>
75
76<listitem><para><option>syntax on</option>: Enables
77<command>vim</command>'s syntax highlighting.</para></listitem>
78
79<listitem><para><option>set ruler</option>: This makes <command>vim
80</command> show the current row and column at the bottom right of
81the screen.</para></listitem>
82
83
84</itemizedlist>
85
86<para>More information on the <emphasis>many</emphasis> <command>vim</command>
87options can be found by reading the help inside <command>vim</command> itself.
88Do this by typing <command>:</command><option>help</option> in
89<command>vim</command> to get the general help, or by typing <command>:
90</command><option>help usr_toc.txt</option> to view
91the User Manual Table of Contents.</para>
92
93</sect1>
94
Note: See TracBrowser for help on using the repository browser.