1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>vi Configuration</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="Vi" href="vi.html" />
<link rel="PREVIOUS" title="Quitting vi" href="vi-quitting-vi.html" />
<link rel="NEXT" title="Vi Keys" href="vi-keys.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href="vi-quitting-vi.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 16 Vi</td>
<td width="10%" align="right" valign="bottom"><a href="vi-keys.html"
accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%" />
</div>
<div class="SECT1">
<h1 class="SECT1"><a id="VI-CONFIGURATION" name="VI-CONFIGURATION">16.6 vi
Configuration</a></h1>
<p>Your <tt class="COMMAND">vi</tt> clone of choice can be configured in several
ways.</p>
<p>A variety of commands can be entered while in command mode to set up <tt
class="COMMAND">vi</tt> just how you like it. Depending on your editor, you can enable
features to make programming easier (like syntax hilighting, auto-indenting, and more),
set up macros to automake tasks, enable textual substitutions, and more.</p>
<p>Almost all of these commands can be put into a configuration file in your home
directory. <tt class="COMMAND">elvis</tt> expects a <tt class="FILENAME">.exrc</tt> file,
while <tt class="COMMAND">vim</tt> expects a <tt class="FILENAME">.vimrc</tt> file. Most
of the setup commands that can be entered in command mode can be placed in the
configuration file. This includes setup information, textual substitutions, macros, and
more.</p>
<p>Discussing all these options and the differences between the editors is quite an
involved subject. For more information, check out the man page or web site for your
preferred <tt class="COMMAND">vi</tt> editor. Some editors (like <tt
class="COMMAND">vim</tt>) have extensive help within the editor that can be accessed with
the <b class="KEYCAP">:help</b> command, or something similar. You can also check out the
O'Reilly book <i class="CITETITLE">Learning the <tt class="COMMAND">vi</tt> Editor</i> by
Lamb and Robbins.</p>
<p>Many common programs in Linux will load up a text file in <tt class="COMMAND">vi</tt>
by default. For example, editing your crontabs will start up <tt class="COMMAND">vi</tt>
by default. If you do not like <tt class="COMMAND">vi</tt> and would like another editor
to be started instead, all you need to do is set the <tt class="ENVAR">VISUAL</tt>
environment variable to the editor you prefer. For information on setting environment
variables, see the section called Environment Variables in Chapter 8. If you want to make
sure that your editor will be the default every time you login, add the VISUAL setting to
your <tt class="FILENAME">.bash_profile</tt> or <tt class="FILENAME">.bashrc</tt>
files.</p>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="vi-quitting-vi.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="vi-keys.html"
accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Quitting vi</td>
<td width="34%" align="center" valign="top"><a href="vi.html" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Vi Keys</td>
</tr>
</table>
</div>
</body>
</html>
|