source: postlfs/config/vimrc.xml@ f8d632a

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 xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since f8d632a was f8d632a, checked in by Bruce Dubbs <bdubbs@…>, 20 years ago

New XML Chapter 3

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

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