source: postlfs/config/vimrc.xml@ cfc2a54

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 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 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb v5_0 v5_0-pre1 v5_1 v5_1-pre1 xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since cfc2a54 was cfc2a54, checked in by Larry Lawrence <larry@…>, 21 years ago

Added Bill's patch to postlfs

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

  • Property mode set to 100644
File size: 3.8 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 a slightly expanded vimrc that you can put in
20<filename>/etc/vimrc</filename> to provide global effect. Of course, if
21you put it into <filename>/etc/skel/.vimrc</filename> instead, it will
22be made available to users you add to the system later. You can also copy
23the file from <filename>/etc/skel/.vimrc</filename> to
24<filename>/etc/vimrc</filename> and the home directory of users already
25on the system, like root. Be sure to set permissions, owner and group if
26you do copy anything directly from <filename>/etc/skel</filename>.</para>
27
28<para><screen>" Begin .vimrc
29
30set nocompatible
31set bs=2
32set columns=80
33set background=dark
34set tabstop=8
35set wrapmargin=8
36set nobk
37syntax on
38set ruler
39set noexpandtab
40
41" End .vimrc</screen></para>
42
43<para>A FAQ on the lfs lists regards the comment tags in vimrc. Note
44that they are " instead of the more usual # or //. This is correct, the
45syntax for vimrc is slightly unusual.</para>
46
47<para>We'll run through a quick explanation of what each of the
48options in this example file means here:</para>
49<itemizedlist>
50<listitem><para><userinput>set nocompatible</userinput> : This option stops vim from behaving in a strongly vi-compatible way. It
51should be at the start of any vimrc file as it can affect lots of other
52options which you may want to override.</para></listitem>
53
54<listitem><para><userinput>set bs=2</userinput> : This influences the behavior of the backspace option. It is fairly
55complex so see <userinput>:help 'bs'</userinput> for more
56details.</para></listitem>
57
58<listitem><para><userinput>set columns=80</userinput> : This simply sets the number of columns used on the
59screen.</para></listitem>
60
61<listitem><para><userinput>set background=dark</userinput> : This tells vim to use colors which look good on a dark
62background.</para></listitem>
63
64<listitem><para><userinput>set tabstop=8</userinput> : The number of spaces which a tabstop takes.</para></listitem>
65
66<listitem><para><userinput>set wrapmargin=8</userinput> : This is the number of characters from the right window
67border where wrapping starts.</para></listitem>
68
69<listitem><para><userinput>set nobk</userinput> : This stops vim from creating a backup before
70overwriting a file.</para></listitem>
71
72<listitem><para><userinput>syntax on</userinput> : Enables vim's syntax highlighting.</para></listitem>
73
74<listitem><para><userinput>set ruler</userinput> : This makes vim show the current row and column at the bottom right of
75the screen.</para></listitem>
76
77<listitem><para><userinput>set noexpandtab</userinput> : This makes vim insert tabs as tab characters instead of as a set of
78spaces.</para></listitem>
79
80</itemizedlist>
81
82<para>More information on the <emphasis>many</emphasis> vim options
83can be found by reading the help inside vim itself. Do this by typing
84<userinput>:help</userinput> in vim to get the general help, or by
85typing <userinput>:help usr_toc.txt</userinput> to view the User Manual
86Table of Contents.</para>
87
88</sect1>
89
Note: See TracBrowser for help on using the repository browser.