source: postlfs/config/vimrc.xml@ 64d97b7c

10.0 10.1 11.0 6.0 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 ken/refactor-virt krejzi/svn lazarus nosym perl-modules qt5new systemd-11177 systemd-13485 trunk v1_0 v5_0 v5_0-pre1 v5_1 v5_1-pre1 xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since 64d97b7c was 64d97b7c, checked in by Larry Lawrence <larry@…>, 19 years ago

update to sawfish-1.3, librep-0.16.2 and first round spell check

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

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