annotate man/viper.texi @ 175:2d532a89d707 r20-3b14

Import from CVS: tag r20-3b14
author cvs
date Mon, 13 Aug 2007 09:50:14 +0200
parents 0132846995bd
children bfd6434d15b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 % -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 %
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 \input texinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @comment Using viper.info instead of viper in setfilename breaks DOS.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
7 @comment @setfilename viper
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @comment @setfilename viper.info
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
9 @setfilename ../info/viper
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 @iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 @finalout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 @end iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 @titlepage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 @title Viper Is a Package for Emacs Rebels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 @subtitle a Vi emulator for GNU Emacs 19 and XEmacs 19
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
18 @subtitle July 1997, Viper Version 2.95
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 @author Masahiko Sato (VIP 3.5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 @author Aamod Sane (VIP 4.4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 @author Michael Kifer (Viper)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 @page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 @vskip 0pt plus 1fill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 @end titlepage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 @unnumbered Distribution
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 @noindent
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
31 Copyright @copyright{} 1995, 1996, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 Permission is granted to make and distribute verbatim copies of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 this manual provided the copyright notice and this permission notice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 are preserved on all copies.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 Permission is granted to process this file through TeX and print the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 results, provided the printed document carries copying permission
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 notice identical to this one except for the removal of this paragraph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (this paragraph not being relevant to the printed manual).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 Permission is granted to copy and distribute modified versions of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 manual under the conditions for verbatim copying, provided that the entire
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 resulting derived work is distributed under the terms of a permission
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 notice identical to this one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 Permission is granted to copy and distribute translations of this manual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 into another language, under the same conditions as for modified versions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 @ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 @node Top, Overview,, (DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 @unnumbered Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 We believe that one or more of the following statements are adequate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 descriptions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 Viper Is a Package for Emacs Rebels;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 it is a VI Plan for Emacs Rescue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 and/or a venomous VI PERil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 Technically speaking, Viper is a Vi emulation package for GNU Emacs 19 and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 XEmacs 19. Because of its reliance on minor mode keymaps, Viper will not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 work under Emacs 18. Viper implements most Vi and Ex commands. It gives you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 the best of both worlds: Vi keystrokes for editing combined with the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 Emacs environment. Viper also fixes some common complaints with Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 commands. This manual describes Viper, concentrating on the differences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 from Vi and new features of Viper.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 Viper, formerly known as VIP-19, was written by Michael Kifer. It is based
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 on VIP version 3.5 by Masahiko Sato and VIP version 4.4 by Aamod Sane.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 Viper tries to be compatible with these packages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 Viper is intended to be usable without reading this manual --- the defaults
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 are set to make Viper as close to Vi as possible. At startup, Viper will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 try to set the most appropriate default environment for you, based on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 your familiarity with Emacs. It will also tell you the basic GNU Emacs window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 management commands to help you start immediately.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 Although this manual explains how to customize Viper, some basic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 familiarity with Emacs Lisp would be a plus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 It is recommended that you read the Overview node. The other nodes may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 be visited as needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 Comments and bug reports are welcome.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 @code{kifer@@cs.emacs.edu} is the current address for Viper bug reports.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 Please use the Ex command @kbd{:submitReport} for this purpose.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 @end ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 * Overview:: Must read to get started
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 * Improvements over Vi:: New features, Improvements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 * Customization:: How to customize Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 * Commands:: Vi and Ex Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 * Key Index:: Index of Vi and Ex Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 * Function Index:: Index of Viper Functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 * Variable Index:: Index of Viper Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 * Package Index:: Index of Packages Mentioned in this Document
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 * Concept Index:: Vi, Ex and Emacs concepts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 * Acknowledgments::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 @iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 @unnumbered Introduction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 We believe that one or more of the following statements are adequate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 descriptions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 Viper Is a Package for Emacs Rebels;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 it is a VI Plan for Emacs Rescue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 and/or a venomous VI PERil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
122 Viper is a Vi emulation package for GNU Emacs 19 and XEmacs 19. Because of
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
123 its reliance on minor mode keymaps, it will not work under Emacs 18. Viper
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
124 contains virtually all of Vi and Ex functionality and much more. It gives
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
125 you the best of both worlds: Vi keystrokes for editing combined with the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
126 GNU Emacs environment. Viper also fixes some common complaints with Vi
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
127 commands. This manual describes Viper, concentrating on the differences
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
128 from Vi and on the new features of Viper.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
129
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
130 Viper was written by Michael Kifer. It is based on VIP version 3.5 by
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
131 Masahiko Sato and VIP version 4.4 by Aamod Sane. Viper tries to be
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
132 compatible with these packages.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
133
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
134 Viper is intended to be usable out of the box, without reading this manual
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
135 --- the defaults are set to make Viper as close to Vi as possible. At
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
136 startup, Viper will attempt to set the most appropriate default environment
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
137 for you, based on your familiarity with Emacs. It will also tell you the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
138 basic GNU Emacs window management commands to help you start immediately.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 Although this manual explains how to customize Viper, some basic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 familiarity with Emacs Lisp would be a plus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 It is recommended that you read the chapter Overview. The other chapters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 will be useful for customization and advanced usage.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 You should also learn to use the Info on-line hypertext manual system that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 comes with Emacs. This manual can be read as an Info file. Try the command
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
148 @kbd{@key{ESC} x info} with vanilla Emacs sometime.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Comments and bug reports are welcome.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 @code{kifer@@cs.sunysb.edu} is the current address for Viper bug reports.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 Please use the Ex command @kbd{:submitReport} for this purpose.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 @end iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 @node Overview,Improvements over Vi,Top,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 @chapter Overview of Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 Viper is a Vi emulation on top of Emacs. At the same time, Viper provides a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 virtually unrestricted access to Emacs facilities. Perfect compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 with Vi is possible but not desirable. This chapter tells you about the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 Emacs ideas that you should know about, how to use Viper within Emacs and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 some incompatibilities.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 Viper was formerly known as VIP-19, which was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 a descendant of VIP 3.5 by Masahiko Sato and VIP 4.4 by Aamod Sane.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 * Emacs Preliminaries:: Basic concepts in Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 * Loading Viper:: Loading and Preliminary Configuration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 * States in Viper:: Viper has four states orthogonal to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 modes in Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 * The Minibuffer:: Command line in Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 * Multiple Files in Viper:: True multiple file handling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 * Unimplemented Features:: That are unlikely to be implemented.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 @node Emacs Preliminaries, Loading Viper, Overview, Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 @section Emacs Preliminaries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 @cindex buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 @cindex point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 @cindex mark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 @cindex text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 @cindex looking at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 @cindex end (of buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 @cindex end (of line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 @cindex region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 Emacs can edit several files at once. A file in Emacs is placed in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @dfn{buffer} that usually has the same name as the file. Buffers are also used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 for other purposes, such as shell interfaces, directory editing, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 @xref{Dired,,Directory Editor,emacs,The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 Gnu Emacs Manual}, for an example.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 A buffer has a distinguished position called the @dfn{point}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 A @dfn{point} is always between 2 characters, and is @dfn{looking at}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 the right hand character. The cursor is positioned on the right hand
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 character. Thus, when the @dfn{point} is looking at the end-of-line,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 the cursor is on the end-of-line character, i.e. beyond the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 character on the line. This is the default Emacs behavior.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 The default settings of Viper try to mimic the behavior of Vi,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 preventing the cursor from going beyond the last character on the line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 By using Emacs commands directly (such as those bound to arrow keys), it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 possible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 to get the cursor beyond the end-of-line. However, this won't (or shouldn't)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 happen if you restrict yourself to standard Vi keys, unless you modify the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 default editing style. @xref{Customization}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 In addition to the @dfn{point}, there is another distinguished buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 position called the @dfn{mark}. @xref{Mark,,Mark,emacs,The GNU Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 manual}, for more info on the mark. The text between the @dfn{point} and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 @dfn{mark} is called the @dfn{region} of the buffer. For the Viper user,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 this simply means that in addition to the Vi textmarkers a--z, there is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 another marker called @dfn{mark}. This is similar to the unnamed Vi marker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 used by the jump commands (`` and ''), which move the cursor to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 position of the last absolute jump.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 Viper provides access to the region in most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 text manipulation commands as @kbd{r} and @kbd{R} suffix to commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 that operate on text regions, e.g., @kbd{dr} to delete region, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 @xref{Basics}, for more info.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 @cindex window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 @cindex mode line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 @cindex buffer information
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 @cindex Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 @cindex command line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 @cindex buffer (modified)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 Emacs divides the screen into tiled @dfn{windows}. You can see the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 contents of a buffer through the window associated with the buffer. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 cursor of the screen is positioned on the character after @dfn{point}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 Every window has a @dfn{mode line} that displays information about the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 You can change the format of the mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 line, but normally if you see @samp{**} at the beginning of a mode line it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 means that the buffer is @dfn{modified}. If you write out the contents of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 a buffer to a file, then the buffer will become not modified. Also if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 you see @samp{%%} at the beginning of the mode line, it means that the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 associated with the buffer is write protected. The mode line will also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 show the buffer name and current major and minor modes (see below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 A special buffer called @dfn{Minibuffer} is displayed as the last line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 in a Minibuffer window. The Minibuffer window is used for command input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 output. Viper uses Minibuffer window for @kbd{/} and @kbd{:}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 commands.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 @cindex mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 @cindex keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 @cindex local keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 @cindex global keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 @cindex major mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 @cindex minor mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 An Emacs buffer can have a @dfn{major mode} that customizes Emacs for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 editing text of a particular sort by changing the functionality of the keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 Keys are defined using a @dfn{keymap} that records the bindings between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 keystrokes and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 functions. The @dfn{global keymap} is common to all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 buffers. Additionally, each buffer has its @dfn{local keymap} that determines the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @dfn{mode} of the buffer. If a function is bound to some key in the local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 keymap then that function will be executed when you type the key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 If no function is bound to a key in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 local map, however, the function bound to the key in the global map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 will be executed. @xref{Major Modes,Major Modes,Major Modes,emacs,The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 GNU Emacs Manual}, for more information.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 A buffer can also have a @dfn{minor mode}. Minor modes are options that you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 can use or not. A buffer in @code{text-mode} can have @code{auto-fill-mode}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 as minor mode, which can be turned off or on at any time. In Emacs 19, a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 minor mode may have it own keymap, which overrides the local keymap when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 the minor mode is turned on. For more information, @pxref{Minor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 Modes,Minor Modes,Minor Modes,emacs,The GNU Emacs Manual} @refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 @cindex Viper as minor mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @cindex Control keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 @cindex Meta key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 Viper is implemented as a collection of minor modes. Different minor modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 are involved when Viper emulates Vi command mode, Vi insert mode, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 You can also turn Viper on and off at any time while in Vi command mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 @xref{States in Viper}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 more information.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
284 Emacs uses Control and Meta modifiers. These are denoted as C and M,
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
285 e.g. @kbd{^Z} as @kbd{C-z} and @kbd{Meta-x} as @kbd{M-x}. The Meta key is
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
286 usually located on each side of the Space bar; it is used in a manner
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
287 similar to the Control key, e.g., @kbd{M-x} means typing @kbd{x} while
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
288 holding the Meta key down. For keyboards that do not have a Meta key,
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
289 @key{ESC} is used as Meta. Thus @kbd{M-x} is typed as @kbd{@key{ESC}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
290 x}. Viper uses @key{ESC} to switch from Insert state to Vi state. Therefore
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
291 Viper defines @kbd{C-\} as its Meta key in Vi state. @xref{Vi State}, for
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
292 more info.@refill
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 Emacs is structured as a lisp interpreter around a C core. Emacs keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 cause lisp functions to be called. It is possible to call these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 functions directly, by typing @kbd{M-x function-name}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 @node Loading Viper, States in Viper, Emacs Preliminaries, Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 @section Loading Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
301 The most common way to load it automatically is to include the following
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
302 lines (in the given order!):
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 @lisp
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
305 (setq viper-mode t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (require 'viper)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 @noindent
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
310 in your @file{~/.emacs} file. The @file{.emacs} file is placed in your
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
311 home directory and it is be executed every time you invoke Emacs. This is
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
312 the place where all general Emacs customization takes place. Beginning with
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
313 version 20.0, Emacsen have an interactive interface, which simplifies the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
314 job of customization significantly.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
315
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
316 Viper also uses the file @file{~/.viper} for Viper-specific customization.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
317 If you wish to be in Vi command state whenever this is deemed appropriate
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
318 by the author, you can include the following line in your @file{.viper}:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 @lisp
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
320 (setq viper-always t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 @noindent
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
323 (@xref{Vi State}, for the explanation of Vi command state.)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
325 The location of Viper customization file can be changed by setting the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
326 variable @code{vip-custom-file-name} in @file{.emacs} @emph{prior} to loading
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
327 Viper.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
328
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 Once invoked, Viper will arrange to bring up Emacs buffers in Vi state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 whenever this makes sense.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 @xref{Packages that Change Keymaps}, to find out when forcing Vi command state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 on a buffer may be counter-productive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
334 Even if your @file{.emacs} and @file{.viper} files do not contain any of the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
335 above lines, you can still load Viper and enter Vi command state by typing the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 following from within Emacs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 M-x viper-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 When Emacs first comes up, if you have not specified a file on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 command line, it will show the @samp{*scratch*} buffer, in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 @samp{Lisp Interaction} mode. After you invoke Viper, you can start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 editing files by using @kbd{:e}, @kbd{:vi}, or @kbd{v} commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (@xref{File and Buffer Handling}, for more information on @kbd{v} and other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 new commands that, in many cases, are more convenient than @kbd{:e},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 @kbd{:vi}, and similar old-style Vi commands.)@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
350 Finally, if at some point you would want to get de-Viperize your running
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
351 copy of Emacs after Viper has been loaded, the command @kbd{M-x
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
352 viper-go-away} will do it for you.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
353
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 @node States in Viper, The Minibuffer, Loading Viper,Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 @section States in Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 @kindex @kbd{C-z}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
358 @kindex @key{ESC}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 @kindex @kbd{i}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 @cindex Emacs state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 @cindex Vi state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 @cindex Insert state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 @cindex Replace state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 @cindex Ex commands
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
365 @findex @code{viper-go-away}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 Viper has four states, Emacs, Vi, Insert, and Replace.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 @item Emacs state
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
371 This is the state plain vanilla Emacs is normally in. After you have loaded
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 Viper, @kbd{C-z} will normally take you to Vi command state. Another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 @kbd{C-z} will take you back to Emacs state. This toggle key can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 changed, @pxref{Customization} You can also type @kbd{M-x viper-mode} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 change to Vi state.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
377
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 For users who chose to set their user level to 1 at Viper setup time,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 switching to Emacs state is deliberately made harder in order to not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 confuse the novice user. In this case, @kbd{C-z} will either iconify Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (if Emacs runs as an application under X Windows) or it will stop Emacs (if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 Emacs runs on a dumb terminal or in an Xterm window).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 @item Vi state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 This is the Vi command mode. Any of the Vi commands, such as @kbd{i, o, a},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 @dots{}, will take you to Insert state. All Vi commands may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 be used in this mode. Most Ex commands can also be used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 For a full list of Ex commands supported by Viper, type
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
389 @kbd{:} and then @key{TAB}. To get help on any issue, including the Ex
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 commands, type @kbd{:help}. This will invoke Viper Info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (if it is installed). Then typing @kbd{i} will prompt you for a topic to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 search in the index. Note, to search for Ex commands in the index, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 should start them with a ``@kbd{:}'', e.g., @kbd{:WW}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 @item Insert state
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
396 Insert state is the Vi insertion mode. @key{ESC} will take you back to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 Vi state. Insert state editing can be done, including auto-indentation. By
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 default, Viper disables Emacs keybindings in Insert state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 @item Replace state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 Commands like @kbd{cw} invoke the Replace state. When you cross the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 boundary of a replacement region (usually designated via a @samp{$} sign),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 it will automatically change to Insert state. You do not have to worry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 about it. The key bindings remain practically the same as in Insert
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
405 state. If you type @key{ESC}, Viper will switch to Vi command mode, terminating the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 replacement state. @refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 @cindex mode line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 The modes are indicated on the @dfn{mode line} as <E>, <I>, <V>, and <R>,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 so that the multiple modes do not confuse you. Most of your editing can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 done in Vi and Insert states. Viper will try to make all new buffers be in Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 state, but sometimes they may come up in Emacs state. @kbd{C-z}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 will take you to Vi state in such a case. In some major modes, like Dired,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 Info, Gnus, etc., you should not switch to Vi state (and Viper will not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 attempt to do so) because these modes are not intended for text editing and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 many of the Vi keys have special meaning there. If you plan to read news,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 browse directories, read mail, etc., from Emacs (which you should start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 doing soon!), you should learn about the meaning of the various keys in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 those special modes (typing @kbd{C-h m} in a buffer provides
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 help with key bindings for the major mode of that buffer).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
424 If you switch to Vi in Dired or similar modes---no harm is done. It is just
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
425 that the special keybindings provided by those modes will be temporarily
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
426 overshadowed by Viper's bindings. Switching back to Viper's Emacs state
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
427 will revive the environment provided by the current major mode.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 States in Viper are orthogonal to Emacs major modes, such as C mode or Dired
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 mode. You can turn Viper on and off for any Emacs state. When Viper is turned
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 on, Vi state can be used to move around. In Insert state, the bindings for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 these modes can be accessed. For beginners (users at Viper levels 1 and 2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 these bindings are suppressed in Insert state, so that new users are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 confused by the Emacs states. Note that unless you allow Emacs bindings in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 Insert state, you cannot do many interesting things, like language
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 sensitive editing. For the novice user (at Viper level 1), all major mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 bindings are turned off in Vi state as well. This includes the bindings for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 key sequences that start with @kbd{C-c}, which practically means that all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 major mode bindings are supported. @xref{Customization}, to find out how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 to allow Emacs keys in Insert state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 * Emacs State:: This is the state you should learn more about when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 you get up to speed with Viper.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 * Vi State:: Vi commands are executed in this state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 * Insert State:: You can enter text, and also can do sophisticated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 editing if you know enough Emacs commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 * Replace State:: Like Insert mode, but it is invoked via the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 replacement commands, such as cw, C, R, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 @node Emacs State, Vi State, States in Viper, States in Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 @subsection Emacs State
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 @kindex @kbd{C-z}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 @cindex Emacs state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 You will be in this mode only by accident (hopefully). This is the state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 Emacs is normally in (imagine!!). Now leave it as soon as possible by
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
461 typing @kbd{C-z}. Then you will be in Vi state (sigh of relief) :-).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 Emacs state is actually a Viperism to denote all the major and minor modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (@xref{Emacs Preliminaries}) other than Viper that Emacs can be in. Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 can have several modes, such as C mode for editing C programs, LaTeX mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 for editing LaTeX documents, Dired for directory editing, etc. These are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 major modes, each with a different set of key-bindings. Viper states are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 orthogonal to these Emacs major modes. The presence of these language
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 sensitive and other modes is a major win over Vi. @xref{Improvements over
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 Vi}, for more.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 The bindings for these modes can be made available in the Viper Insert state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 as well as in Emacs state. Unless you specify your user level as 1 (a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 novice), all major mode key sequences that start with @kbd{C-x} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 @kbd{C-c} are also available in Vi state. This is important because major
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 modes designed for editing files, such as cc-mode or latex-mode, use key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 sequences that begin with @kbd{C-x} and @kbd{C-c}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 There is also a key that lets you temporarily escape to Vi command state
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
480 from Emacs or Insert states: typing @kbd{C-c \} will let you execute a
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
481 single Vi command while staying in Viper's Emacs or Insert state.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
482 In Insert state, the same can also be achieved by typing @kbd{C-z}.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
483
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 @node Vi State, Insert State, Emacs State, States in Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 @subsection Vi State
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 @cindex Vi state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 This is the Vi command mode. When Viper is in Vi state, you will see the sign
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 <V> in the mode line. Most keys will work as in Vi. The notable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 exceptions are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 @item C-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 @kindex @kbd{C-x}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 @kbd{C-x} is used to invoke Emacs commands, mainly those that do window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 management. @kbd{C-x 2} will split a window, @kbd{C-x 0} will close a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 window. @kbd{C-x 1} will close all other windows. @kbd{C-xb} is used to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 switch buffers in a window, and @kbd{C-xo} to move through windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 These are about the only necessary keystrokes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 For the rest, see the GNU Emacs Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 @item C-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 @kindex @kbd{C-c}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 For user levels 2 and higher, this key serves as a prefix key for the key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 sequences used by various major modes. For users at Viper level 1, @kbd{C-c}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 simply beeps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 @item C-g and C-]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @kindex @kbd{C-g}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 @kindex @kbd{C-]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 These are the Emacs @samp{quit} keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 There will be cases where you will have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 use @kbd{C-g} to quit. Similarly, @kbd{C-]} is used to exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 @samp{Recursive Edits} in Emacs for which there is no comparable Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 functionality and no key-binding. Recursive edits are indicated by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 @samp{[]} brackets framing the modes on the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 @xref{Recursive Edit,Recursive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 Edit,Recursive Edit,emacs,The GNU Emacs Manual}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 At user level 1, @kbd{C-g} is bound to @code{vip-info-on-file}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 function instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 @refill
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
525 @item C-\
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
526 @kindex @kbd{C-\}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 @cindex Meta key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
529 Viper uses @key{ESC} as a switch between Insert and Vi states. Emacs uses
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
530 @key{ESC} for Meta. We need a Meta key to call the Meta key functions such
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
531 as @kbd{M-x function name}. This role is played by the key @kbd{C-\}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
532 Thus, to get @kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
533 Meta key). This works both in the Vi state and the Insert state.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
534 Alternatively, you can use @kbd{\ @key{ESC}} in Vi state to simulate the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
535 meta key. It is possible to use @key{ESC} as Meta, but then you cannot
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
536 press @key{ESC} multiple times in Vi state. @xref{Customization}, to find
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
537 out how to rebind @key{ESC} to be Meta.@refill
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 Other differences are mostly improvements. The ones you should know
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 about are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 @item Undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 @kindex @kbd{u}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 @kbd{u} will undo. Undo can be repeated by the @kbd{.} key. Undo itself
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 can be undone. Another @kbd{u} will change the direction. The presence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 of repeatable undo means that @kbd{U}, undoing lines, is not very
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 important. Therefore, @kbd{U} also calls @code{vip-undo}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 @cindex multiple undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 @cindex undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 @item Counts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 Most commands, @kbd{~}, @kbd{[[}, @kbd{p}, @kbd{/}, @dots{}, etc., take counts.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 @comment ]] Just to balance parens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 @item Regexps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 Viper uses Emacs Regular Expressions for searches. These are a superset of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 Vi regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 expressions, excepting the change-of-case escapes @samp{\u}, @samp{\L},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 @dots{}, etc. @xref{Regular Expressions,,Regular Expressions,emacs,The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 GNU Emacs Manual}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 Files specified to @kbd{:e} use @code{csh} regular expressions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (globbing, wildcards, what have you).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 However, the function @code{vip-toggle-search-style}, bound to @kbd{C-c /},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 lets the user switch from search with regular expressions to plain vanilla
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 search and vice versa. It also lets one switch from case-sensitive search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 to case-insensitive and back.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 @xref{Viper Specials}, for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 @cindex regular expressions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 @cindex vanilla search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 @cindex case-sensitive search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 @cindex case-insensitive search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 @kindex @kbd{C-c /}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 @item Ex commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 @cindex Ex commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 The current working directory of a buffer is automatically inserted in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 minibuffer if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 type @kbd{:e} then space.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 Absolute filenames are required less often in Viper.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 For path names,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 Emacs uses a convention that is slightly different from that of Unix.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 It is designed to minimize the need for deleting path names that Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 provides in its prompts. (This is usually convenient, but occasionally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 the prompt may suggest a wrong path name for you.) If you see a prompt
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
588 @kbd{/usr/foo/} and you wish to edit the file @kbd{~/.viper}, you don't
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 have to erase the prompt. Instead, simply continue typing what you
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
590 need. Emacs will interpret @kbd{/usr/foo/~/.viper} correctly. Similarly,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 if the prompt is @kbd{~/foo/} and you need to get to @kbd{/bar/file}, keep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 typing. Emacs interprets @kbd{~/foo//bar/} as @kbd{/bar/file}, since when it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 sees @samp{//}, it understands that @kbd{~/foo/} is to be discarded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 The command @kbd{:cd} will change the default directory for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 current buffer. The command @kbd{:e} will interpret the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 filename argument in @code{csh}. @xref{Customization}, if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 want to change the default shell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 The command @kbd{:next} takes counts from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 @kbd{:args}, so that @kbd{:rew} is obsolete. Also, @kbd{:args} will show only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 the invisible files (i.e., those that are not currently seen in Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 windows).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 When applicable, Ex commands support file completion and history. This
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
605 means that by typing a partial file name and then @key{TAB}, Emacs will try
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 to complete the name or it will offer a menu of possible completions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 This works similarly to Tcsh and extends the behavior of Csh. While Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 is waiting for a file name, you can type @kbd{M-p} to get the previous file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 name you typed. Repeatedly typing @kbd{M-p} and @kbd{M-n} will let you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 browse through the file history.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 Like file names, partially typed Ex commands can be completed by typing
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
613 @key{TAB}, and Viper keeps the history of Ex commands. After typing
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 @kbd{:}, you can browse through the previously entered Ex commands by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 typing @kbd{M-p} and @kbd{M-n}. Viper tries to rationalize when it puts Ex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 commands on the history list. For instance, if you typed @kbd{:w! foo},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 only @kbd{:w!} will be placed on the history list. This is because the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 last history element is the default that can be invoked simply by typing
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
619 @kbd{: @key{RET}}. If @kbd{:w! foo} were placed on the list, it would be all to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 easy to override valuable data in another file. Reconstructing the full
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 command, @kbd{:w! foo}, from the history is still not that hard, since Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 has a separate history for file names. By typing @kbd{: M-p}, you will get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 @kbd{:w!} in the Minibuffer. Then, repeated @kbd{M-p} will get you through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 the file history, inserting one file name after another.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 In contrast to @kbd{:w! foo}, if the command were @kbd{:r foo}, the entire
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 command will appear in the history list. This is because having @kbd{:r}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 alone as a default is meaningless, since this command requires a file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 @refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 As Vi, Viper's destructive commands can be re-executed by typing `@kbd{.}'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 However, in addition, Viper keeps track of the history of such commands. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 history can be perused by typing @kbd{C-c M-p} and @kbd{C-c M-n}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 Having found the appropriate command, it can be then executed by typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 `@kbd{.}'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 @xref{Improvements over Vi}, for more information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 @node Insert State, Replace State, Vi State, States in Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 @subsection Insert State
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 @cindex Insert state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 To avoid confusing the beginner (at Viper level 1 and 2), Viper makes only the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 standard Vi keys available in Insert state. The implication is that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 Emacs major modes cannot be used Insert state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 It is strongly recommended that as soon as you are comfortable, make the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 Emacs state bindings visible (by changing your user level to 3 or higher).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 @xref{Customization},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 to see how to do this.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 Once this is done, it is possible to do quite a bit of editing in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 Insert state. For instance, Emacs has a @dfn{yank} command, @kbd{C-y},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 which is similar to Vi's @kbd{p}. However, unlike @kbd{p}, @kbd{C-y} can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 used in Insert state of Viper. Emacs also has a kill ring where it keeps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 pieces of text you deleted while editing buffers. The command @kbd{M-y} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 used to delete the text previously put back by Emacs' @kbd{C-y} or by Vi's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 @kbd{p} command and reinsert text that was placed on the kill-ring earlier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 This works both in Vi and Insert states.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 In Vi state, @kbd{M-y} is a much better alternative to the usual Vi's way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 of recovering the 10 previously deleted chunks of text. In Insert state,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 use this as follows. Suppose you deleted a piece of text and now you need
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 to re-insert it while editing in Insert mode. The key @kbd{C-y} will put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 back the most recently deleted chunk. If this is not what you want, type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 @kbd{M-y} repeatedly and, hopefully, you will find the chunk you want.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 Finally, in Insert and Replace states, Viper provides the history of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 pieces of text inserted in previous insert or replace commands. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 strings of text can be recovered by repeatedly typing @kbd{C-c M-p} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 @kbd{C-c M-n} while in Insert or Replace state. (This feature is disabled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 in the minibuffer: the above keys are usually bound to other histories,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 which are more appropriate in the minibuffer.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 @cindex Meta key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
680 You can call Meta functions from Insert state. As in Vi state, the Meta key
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
681 is @kbd{C-\}. Thus @kbd{M-x} is typed as @kbd{C-\ x}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 Other Emacs commands that are useful in Insert state are @kbd{C-e}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 and @kbd{C-a}, which move the cursor to the end and the beginning of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 current line, respectively. You can also use @kbd{M-f} and @kbd{M-b},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 which move the cursor forward (or backward) one word.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 If your display has a Meta key, these functions are invoked by holding the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 Meta key and then typing @kbd{f} and @kbd{b}, respectively. On displays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 without the Meta key, these functions are invoked by typing
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
690 @kbd{C-\ f} and @kbd{C-\ b} (@kbd{C-\} simulates the Meta key in Insert
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 state, as explained above).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 When Viper is in Insert state, you will see <I> in the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 @node Replace State,, Insert State, States in Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 @subsection Replace State
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 @cindex Replace state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 This state is entered through Vi replacement commands, such as @kbd{C},
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
701 @kbd{cw}, etc., or by typing @kbd{R}. In Replace state, Viper puts <R> in
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
702 the mode line to let you know which state is in effect. If Replace state is
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
703 entered through @kbd{R}, Viper stays in that state until the user hits
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
704 @key{ESC}. If this state is entered via the other replacement commands,
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
705 then Replace state is in effect until you hit @key{ESC} or until you cross
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
706 the rightmost boundary of the replacement region. In the latter case, Viper
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
707 changes its state from Replace to Insert (which you will notice by the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
708 change in the mode line).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 Since Viper runs under Emacs, it is possible to switch between buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 while in Replace state. You can also move the cursor using the arrow keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (even on dumb terminals!) and the mouse. Because of this freedom (which is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 unattainable in regular Vi), it is possible to take the cursor outside the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 replacement region. (This may be necessary for several reasons, including
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 the need to enable text selection and region-setting with the mouse.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 The issue then arises as to what to do when the user
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
718 hits the @key{ESC} key. In Vi, this would cause the text between cursor and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 the end of the replacement region to be deleted. But what if, as is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 possible in Viper, the cursor is not inside the replacement region?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 To solve the problem, Viper keeps track of the last cursor position while it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 was still inside the replacement region. So, in the above situation, Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 would delete text between this position and the end of the replacement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 @node The Minibuffer,Multiple Files in Viper, States in Viper, Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 @section The Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 @cindex Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 The Minibuffer is where commands are entered in. Editing can be done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 by commands from Insert state, namely:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 @item C-h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 Backspace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 @item C-w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 Delete Word
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 @item C-u
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 Erase line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 @item C-v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 Quote the following character
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
744 @item @key{RET}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 Execute command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 @item C-g and C-]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 Emacs quit and abort keys. These may be necessary. @xref{Vi State}, for an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 explanation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 @item M-p and M-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 These keys are bound to functions that peruse minibuffer history. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 precise history to be perused depends on the context. It may be the history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 of search strings, Ex commands, file names, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 Most of the Emacs keys are functional in the Minibuffer. While in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 Minibuffer, Viper tries to make editing resemble Vi's behavior when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 latter is waiting for the user to type an Ex command. In particular, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 can use the regular Vi commands to edit the Minibuffer. You can switch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 between the Vi state and Insert state at will, and even use the replace mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 Initially, the Minibuffer comes up in Insert state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 Some users prefer plain Emacs bindings in the Minibuffer. To this end, set
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
763 @code{vip-vi-style-in-minibuffer} to @code{nil} in @file{.viper}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 @xref{Customization}, to learn how to do this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 When the Minibuffer changes Viper states, you will notice that the appearance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 of the text there changes as well. This is useful because the Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 has no mode line to tell which Vi state it is in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 The appearance of the text in the Minibuffer can be changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 @xref{Viper Specials}, for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 @node Multiple Files in Viper,Unimplemented Features,The Minibuffer,Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 @section Multiple Files in Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 @cindex multiple files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 @cindex managing multiple files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 Viper can edit multiple files. This means, for example that you never need
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 to suffer through @code{No write since last change} errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 Some Viper elements are common over all the files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 @item Textmarkers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 @cindex markers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 @cindex textmarkers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 Textmarkers remember @emph{files and positions}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 If you set marker @samp{a} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 file @file{foo}, start editing file @file{bar} and type @kbd{'a}, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 @emph{YOU WILL SWITCH TO FILE @file{foo}}. You can see the contents of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 textmarker using the Viper command @kbd{[<a-z>} where <a-z> are the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 textmarkers, e.g., @kbd{[a} to view marker @samp{a} .@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 @item Repeated Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 Command repetitions are common over files. Typing @kbd{!!} will repeat the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 last @kbd{!} command whichever file it was issued from.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 Typing @kbd{.} will repeat the last command from any file, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 searches will repeat the last search. Ex commands can be repeated by typing
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
797 @kbd{: @key{RET}}.@refill
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
798 Note: in some rare cases, that @kbd{: @key{RET}} may do something dangerous.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 However, usually its effect can be undone by typing @kbd{u}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 @item Registers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 @cindex registers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 Registers are common to files. Also, text yanked with @kbd{y} can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 put back (@kbd{p}) into any file. The Viper command @kbd{]<a-z>}, where <a-z> are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 the registers, can be used to look at the contents of a register, e.g.,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 type @kbd{]a} to view register @samp{a}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 There is one difference in text deletion that you should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 aware of. This difference comes from Emacs and was adopted in Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 because we find it very useful. In Vi, if you delete a line, say, and then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 another line, these two deletions are separated and are put back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 separately if you use the @samp{p} command. In Emacs (and Viper), successive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 series of deletions that are @emph{not interrupted} by other commands are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 lumped together, so the deleted text gets accumulated and can be put back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 as one chunk. If you want to break a sequence of deletions so that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 newly deleted text could be put back separately from the previously deleted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 text, you should perform a non-deleting action, e.g., move the cursor one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 character in any direction.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 @item Absolute Filenames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 @cindex absolute paths
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 The current directory name for a file is automatically prepended to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 file name in any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 @kbd{:e}, @kbd{:r}, @kbd{:w}, etc., command (in Emacs, each buffer has a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 current directory).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 This directory is inserted in the Minibuffer once you type space after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 @kbd{:e, r}, etc. Viper also supports completion of file names and Ex
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
826 commands (@key{TAB}), and it keeps track of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 command and file history (@kbd{M-p}, @kbd{M-n}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 Absolute filenames are required less
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 often in Viper.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 You should be aware that Emacs interprets @kbd{/foo/bar//bla} as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 @kbd{/bla} and @kbd{/foo/~/bar} as @kbd{~/bar}. This is designed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 minimize the need for erasing path names that Emacs suggests in its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 prompts, if a suggested path name is not what you wanted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 The command @kbd{:cd} will change the default directory for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 current Emacs buffer. The Ex command @kbd{:e} will interpret the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 filename argument in @samp{csh}, by default. @xref{Customization}, if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 want to change this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 Currently undisplayed files can be listed using the @kbd{:ar} command. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 command @kbd{:n} can be given counts from the @kbd{:ar} list to switch to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 other files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 @node Unimplemented Features,,Multiple Files in Viper,Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 @section Unimplemented Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 Unimplemented features include:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 @kbd{:ab} and @kbd{:una} are not implemented.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 Both @kbd{:map} and @kbd{:ab} are considered obsolete, since Emacs has much
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 more powerful facilities for defining keyboard macros and abbreviations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 @kbd{:set option?} is not implemented. The current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 @kbd{:set} can also be used to set Emacs variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 @kbd{:se list} requires modification of the display code for Emacs, so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 it is not implemented.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 A useful alternative is @code{cat -t -e file}. Unfortunately, it cannot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 be used directly inside Emacs, since Emacs will obdurately change @samp{^I}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 back to normal tabs.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 @node Improvements over Vi, Customization, Overview, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 @chapter Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 Some common problems with Vi and Ex have been solved in Viper. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 includes better implementation of existing commands, new commands, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 the facilities provided by Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 * Basics:: Basic Viper differences, Multi-file effects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 * Undo and Backups:: Multiple undo, auto-save, backups and changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 * History:: History for Ex and Vi commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 * Macros and Registers:: Keyboard Macros (extended ".") @@reg execution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 * Completion:: Filename and Command Completion for Ex.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 * Improved Search:: Incremental Search and Buffer Content Search.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 * Abbreviation Facilities:: Normal Abbrevs, Templates, and Dynamic Abbrevs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 * Movement and Markers:: Screen Editor movements, viewing textmarkers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 * New Commands:: Commands that do not exist in Vi.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 * Useful Packages:: A Sampling of some Emacs packages, and things
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 you should know about.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 @node Basics, Undo and Backups, Improvements over Vi, Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 @section Basics
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 The Vi command set is based on the idea of combining motion commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 with other commands. The motion command is used as a text region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 specifier for other commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 We classify motion commands into @dfn{point commands} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 @dfn{line commands}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 @cindex point commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 The point commands are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 @quotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 @kbd{h}, @kbd{l}, @kbd{0}, @kbd{$}, @kbd{w}, @kbd{W}, @kbd{b}, @kbd{B},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 @kbd{e}, @kbd{E}, @kbd{(}, @kbd{)}, @kbd{/}, @kbd{?}, @kbd{`}, @kbd{f},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 @kbd{F}, @kbd{t}, @kbd{T}, @kbd{%}, @kbd{;}, @kbd{,}, @kbd{^}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 @end quotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 @cindex line commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 The line commands are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 @quotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 @kbd{j}, @kbd{k}, @kbd{+}, @kbd{-}, @kbd{H}, @kbd{M}, @kbd{L}, @kbd{@{},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 @kbd{@}}, @kbd{G}, @kbd{'}, @kbd{[[}, @kbd{]]}, @kbd{[]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 @end quotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 @cindex region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 @cindex region specification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 @cindex expanding (region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 @cindex describing regions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 @cindex movement commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 If a point command is given as an argument to a modifying command, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 region determined by the point command will be affected by the modifying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 command. On the other hand, if a line command is given as an argument to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 modifying command, the region determined by the line command will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 enlarged so that it will become the smallest region properly containing the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 region and consisting of whole lines (we call this process @dfn{expanding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 the region}), and then the enlarged region will be affected by the modifying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 Text Deletion Commands (@xref{Deleting Text}), Change commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (@xref{Changing Text}), even Shell Commands (@xref{Shell Commands})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 use these commands to describe a region of text to operate on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 Thus, type @kbd{dw} to delete a word, @kbd{>@}} to shift a paragraph, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 @kbd{!'afmt} to format a region from @samp{point} to textmarker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 @samp{a}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 @cindex r and R region specifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 Viper adds the region specifiers @samp{r} and @samp{R}. Emacs has a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 special marker called @dfn{mark}. The text-area between the current cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 position @dfn{point} and the @dfn{mark} is called the @dfn{region}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 @samp{r} specifies the raw region and @samp{R} is the expanded region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (i.e., the minimal contiguous chunk of full lines that contains the raw
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 region).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 @kbd{dr} will now delete the region, @kbd{>r} will shift it, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 @kbd{r,R} are not motion commands, however. The special mark is set by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 @kbd{m.} and other commands. @xref{Marking}, for more info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 Viper also adds counts to most commands for which it would make sense.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 In the Overview chapter, some Multiple File issues were discussed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (@xref{Multiple Files in Viper}). In addition to the files, Emacs has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 buffers. These can be seen in the @kbd{:args} list and switched using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 @kbd{:next} if you type @kbd{:set ex-cycle-through-non-files t}, or
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
958 specify @code{(setq ex-cycle-through-non-files t)} in your @file{.viper}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 file. @xref{Customization}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 @node Undo and Backups, History, Basics, Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 @section Undo and Backups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 @cindex undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 Viper provides multiple undo. The number of undo's and the size is limited
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 by the machine. The Viper command @kbd{u} does an undo. Undo can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 repeated by typing @kbd{.} (a period). Another @kbd{u} will undo the undo,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 and further
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 @kbd{.} will repeat it. Typing @kbd{u} does the first undo, and changes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 direction.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 @cindex backup files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 @cindex auto save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 Since the undo size is limited, Viper can create backup files and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 auto-save files. It will normally do this automatically. It is possible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 to have numbered backups, etc. For details, @pxref{Backup,,Backup and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 Auto-Save,emacs,The GNU Emacs Manual} @refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 @comment [ balance parens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 @cindex viewing registers and markers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 @cindex registers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 @cindex markers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 @cindex textmarkers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 The results of the 9 previous changes are available in the 9 numeric
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 registers, as in Vi. The extra goody is the ability to @emph{view} these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 registers, in addition to being able to access them through @kbd{p} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 @kbd{M-y} (@xref{Insert State}, for details.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 The Viper command @kbd{] register} will display the contents of any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 register, numeric or alphabetical. The related command @kbd{[ textmarker}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 will show the text around the textmarker. @samp{register} and @samp{textmarker}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 can be any letters from a through z.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 @comment ] balance parens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 @node History, Macros and Registers, Undo and Backups,Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 @section History
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 @cindex history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 @cindex Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 History is provided for Ex commands, Vi searches, file names, pieces of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 text inserted in earlier commands that use Insert or Replace state, and for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 destructive commands in Vi state. These are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 useful for fixing those small typos that screw up searches and @kbd{:s},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 and for eliminating routine associated with repeated typing of file names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 or pieces of text that need to be inserted frequently.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 At the @kbd{:} or @kbd{/} prompts in the Minibuffer, you can do the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 @item M-p and M-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 To move to previous and next history items. This causes the history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 items to appear on the command line, where you can edit them, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 simply type Return to execute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 @item M-r and M-s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 To search backward and forward through the history.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1018 @item @key{RET}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1019 Type @key{RET} to accept a default (which is displayed in the prompt).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 The history of insertions can be perused by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 typing @kbd{C-c M-p} and @kbd{C-c M-n} while in Insert or Replace state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 The history of destructive Vi commands can be perused via the same keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 when Viper is in Vi state. @xref{Viper Specials}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 All Ex commands have a file history. For instance, typing @kbd{:e}, space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 and then @kbd{M-p} will bring up the name of the previously typed file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 name. Repeatedly typing @kbd{M-p}, @kbd{M-n}, etc., will let you browse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 through the file history.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 Similarly, commands that have to do with switching buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 have a buffer history, and commands that expect strings or regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 expressions keep a history on those items.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 @node Macros and Registers,Completion,History,Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 @section Macros and Registers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 @cindex keyboard macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 @cindex macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 @cindex registers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 @cindex register execution
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 Viper facilitates the use of Emacs-style keyboard macros. @kbd{@@#} will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 start a macro definition. As you type, the commands will be executed, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 remembered (This is called ``learn mode'' in some editors.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 @kbd{@@register} will complete the macro, putting it into @samp{register},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 where @samp{register} is any character from @samp{a} through @samp{z}. Then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 you can execute this macro using @kbd{@@register}. It is, of course,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 possible to yank some text into a register and execute it using
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1051 @kbd{@@register}. Typing @kbd{@@@@}, @kbd{@@RET}, or @kbd{@@C-j} will
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 execute the last macro that was executed using @kbd{@@register}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 Viper will automatically lowercase the register, so that pressing the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 @kbd{SHIFT} key for @kbd{@@} will not create problems. This is for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 @kbd{@@} macros and @kbd{"p} @emph{only}. In the case of @kbd{y},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 @kbd{"Ayy} will append to @emph{register a}. For @kbd{[,],',`}, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 is an error to use a Uppercase register name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 @comment [ balance parens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 @cindex viewing registers and markers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 The contents of a register can be seen by @kbd{]register}. (@kbd{[textmarker}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 will show the contents of a textmarker).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 @comment ] balance parens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 @cindex last keyboard macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 The last keyboard macro can also be executed using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 @kbd{*}, and it can be yanked into a register using @kbd{@@!register}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 This is useful for Emacs style keyboard macros defined using @kbd{C-x(}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 and @kbd{C-x)}. Emacs keyboard macros have more capabilities.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 @xref{Keyboard Macros,,Keyboard Macros,emacs, The GNU Emacs Manual}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 details.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 Keyboard Macros allow an interesting form of Query-Replace:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 @kbd{/pattern} or @kbd{n} to go to the next pattern (the query), followed by a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 Keyboard Macro execution @kbd{@@@@} (the replace).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 Viper also provides Vi-style macros. @xref{Vi Macros}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 @node Completion, Improved Search, Macros and Registers, Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 @section Completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 @cindex completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1088 Completion is done when you type @key{TAB}. The Emacs completer does not
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 grok wildcards in filenames. Once you type a wildcard, the completer will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 no longer work for that path. Remember that Emacs interprets a file name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 of the form @kbd{/foo//bar} as @kbd{/bar} and @kbd{/foo/~/bar} as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 @kbd{~/bar}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 @node Improved Search, Abbreviation Facilities, Completion, Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 @section Improved Search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 @cindex buffer search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 @cindex word search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 Viper provides buffer search, the ability to search the buffer for a region
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1101 under the cursor. You have to turn this on in @file{.viper} either by calling
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (vip-buffer-search-enable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 or by setting @code{vip-buffer-search-char} to, say, @kbd{f3}:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (setq vip-buffer-search-char [f3])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 If the user calls @code{vip-buffer-search-enable} explicitly (the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 method), then @code{vip-buffer-search-char} will be set to @kbd{g}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 Regardless of how this feature is enabled, the key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 @code{vip-buffer-search-char} will take movement commands, like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 @kbd{w,/,e}, to find a region and then search for the contents of that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 region. This command is very useful for searching for variable names, etc.,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 in a program. The search can be repeated by @kbd{n} or reversed by @kbd{N}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 @cindex incremental search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 Emacs provides incremental search. As you type the string in, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 cursor will move to the next match. You can snarf words from the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 as you go along. Incremental Search is normally bound to @kbd{C-s} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 @kbd{C-r}. @xref{Customization}, to find out how to change the bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 of @kbd{C-r or C-s}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 For details, @pxref{Incremental Search,,Incremental
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 Search,emacs,The GNU Emacs Manual} @refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 @cindex query replace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 Viper also provides a query replace function that prompts through the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 Minibuffer. It is invoked by the @kbd{Q} key in Vi state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 @cindex mouse search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 On a window display, Viper supports mouse search, i.e., you can search for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 word by clicking on it. @xref{Viper Specials}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 Finally, on a window display, Viper highlights search patterns as it finds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 them. This is done through what is known as @emph{faces} in Emacs. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 variable that controls how search patterns are highlighted is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 @code{vip-search-face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 If you don't want any highlighting at all, put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 @example
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1148 (setq vip-search-face 'default)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 @vindex @code{vip-search-face}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 @noindent
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1152 in @file{~/.viper}. If you want to change how patterns are highlighted, you
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 will have to set the variable @code{vip-search-face} to some other face,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 such as @code{highlight}. If none of the existing faces fits the bill, you
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1155 would have to create your own. Further details on faces can be found
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 in the Emacs Lisp Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 @node Abbreviation Facilities,Movement and Markers,Improved Search,Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 @section Abbreviation Facilities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 @cindex abbrevs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 It is possible in Emacs to define abbrevs based on the contents of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 Sophisticated templates can be defined using the Emacs abbreviation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 facilities. @xref{Abbrevs,,Abbreviations,emacs,The GNU Emacs Manual}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 @cindex dynamic abbrevs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 Emacs also provides Dynamic Abbreviations. Given a partial word, Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 will search the buffer to find an extension for this word. For instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 one can type @samp{Abbreviations} by typing @samp{A}, followed by a keystroke
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 that completed the @samp{A} to @samp{Abbreviations}. Repeated typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 will search further back in the buffer, so that one could get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 @samp{Abbrevs} by repeating the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 keystroke, which appears earlier in the text. Emacs binds this to
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1178 @kbd{@key{ESC} /}, so you will have to find a key and bind the function
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 @code{dabbrev-expand} to that key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 Facilities like this make Vi's @kbd{:ab} command obsolete.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 @node Movement and Markers, New Commands, Abbreviation Facilities, Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 @section Movement and Markers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 @cindex Ex style motion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 @cindex line editor motion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 Viper can be set free from the line--limited movements in Vi, such as @kbd{l}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1189 refusing to move beyond the line, @key{ESC} moving one character back,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1190 etc. These derive from Ex, which is a line editor. If your @file{.viper}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 contains
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 @code{(setq vip-ex-style-motion nil)}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 the motion will be a true screen editor motion. One thing you must then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 watch out for is that it is possible to be on the end-of-line character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 The keys @kbd{x} and @kbd{%} will still work correctly, i.e., as if they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 were on the last character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 @vindex @code{vip-syntax-preference}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 @cindex syntax table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 The word-movement commands @kbd{w}, @kbd{e}, etc., and the associated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 deletion/yanking commands, @kbd{dw}, @kbd{yw}, etc., can be made to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 understand Emacs syntax tables. If the variable
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1209 @code{vip-syntax-preference} is set to @code{strict-vi} (the default) then
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 the meaning of @emph{word} is the same as in
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1211 Vi. However, if the value is @code{reformed-vi} then the alphanumeric
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 symbols will be those specified by the current Emacs syntax table (which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 may be different for different major modes) plus the underscore symbol
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1214 @kbd{_}. The user can also specify the value @code{emacs}, which would
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 make Viper use exactly the Emacs notion of word. In particular, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 underscore may not be part of a word. Finally, if
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1217 @code{vip-syntax-preference} is set to @code{extended}, Viper words would
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 consist of characters that are classified as alphanumeric @emph{or} as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 parts of symbols. This is convenient for writing programs and in many other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 situations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 @code{vip-syntax-preference} is a local variable, so it can have different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 values for different major modes. For instance, in programming modes it can
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1224 have the value @code{extended}. In text modes where words contain special
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 characters, such as European (non-English) letters, Cyrillic letters, etc.,
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1226 the value can be @code{reformed-vi} or @code{emacs}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 Changes to @code{vip-syntax-preference} should be done in the hooks to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 various major modes. Furthermore, for these changes to take effect, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 should execute @code{(vip-update-alphanumeric-class)} right after changing
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1231 the value of @code{vip-syntax-preference}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 The above discussion of the meaning of Viper's words concerns only Viper's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 movement commands. In regular expressions, words remain the same as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 Emacs' idea of what is a word, and they don't look into the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 variable @code{vip-syntax-preference}. This is because Viper doesn't change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 syntax tables in fear of upsetting the various major modes that set these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 @cindex textmarkers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 Textmarkers in Viper remember the file and the position, so that you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 switch files by simply doing @kbd{'a}. If you set up a regimen for using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 Textmarkers, this is very useful. Contents of textmarkers can be viewed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 by @kbd{[marker}. (Contents of registers can be viewed by @kbd{]register}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 @node New Commands, Useful Packages, Movement and Markers, Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 @section New Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 These commands have no Vi analogs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 @item C-x, C-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 @kindex @kbd{C-x}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 @kindex @kbd{C-c}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 @kbd{C-x} will exit from Vi state and return to Emacs state
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1258 @emph{temporarily}. If you hit one of these keys, Emacs will believe
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 that you hit that key in Emacs state. For example, if you hit @kbd{C-x}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 followed by @kbd{2}, then the current window will be split into 2 and you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 will be in Vi state again. Except for novice users, @kbd{C-c} is also set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 to temporarily escape to Emacs and execute a command from the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 major mode.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1264 @key{ESC} will do the same, if
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 you configure @key{ESC} as Meta by setting @code{vip-no-multiple-ESC} to nil
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1266 in @file{.viper}. @xref{Customization}. @kbd{C-\}
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1267 in Insert or Vi states will make Emacs think @kbd{Meta} has been hit.@refill
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 @item \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 @kindex @kbd{\}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1270 Escape to Emacs to execute a single Emacs command. For instance,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1271 @kbd{\ @key{ESC}} will act like a Meta key.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 @item Q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 @kindex @kbd{Q}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 @cindex query replace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 @kbd{Q} is for query replace. By default,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 each string to be replaced is treated as a regular expression. You can use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 @code{(setq vip-re-query-replace nil)} in your @file{.emacs} file to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 turn this off. (For normal searches, @kbd{:se nomagic} will work. Note
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 that @kbd{:se nomagic} turns Regexps off completely, unlike Vi).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 @item v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 @itemx V
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 @itemx C-v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 @kindex @kbd{v}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 @kindex @kbd{V}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 @kindex @kbd{C-v}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 These keys are used to visit files. @kbd{v} will switch to a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 visiting file whose name can be entered in the Minibuffer. @kbd{V} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 similar, but will use a window different from the current window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 @kbd{C-v} is like @kbd{V}, except that a new frame (X window) will be used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 instead of a new Emacs window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 @item #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 @kindex @kbd{#}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 If followed by a certain character @var{ch}, it becomes an operator whose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 argument is the region determined by the motion command that follows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (indicated as <move>).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 Currently, @var{ch} can be one of @kbd{c}, @kbd{C}, @kbd{g}, @kbd{q}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 @kbd{s}. For instance, @kbd{#qr} will prompt you for a string and then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 prepend this string to each line in the buffer.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 @item # c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 @kindex @kbd{#c<move>}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 @cindex changing case
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1302 Change upper-case characters in the region to lower-case
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (@code{downcase-region}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 Emacs command @kbd{M-l} does the same for words.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 @item # C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 @kindex @kbd{#C<move>}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1307 Change lower-case characters in the region to upper-case. For instance,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 @kbd{# C 3 w} will capitalize 3 words from the current point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 (@code{upcase-region}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 Emacs command @kbd{M-u} does the same for words.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 @item # g
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 @kindex @kbd{#g<move>}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 Execute last keyboard macro for each line in the region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 (@code{vip-global-execute}).@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 @item # q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 @kindex @kbd{#q<move>}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 Insert specified string at the beginning of each line in the region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (@code{vip-quote-region}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 @item # s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 @kindex @kbd{#s<move>}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 Check spelling of words in the region (@code{spell-region}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 The function used for spelling is determined from the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 @code{vip-spell-function}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 @vindex @code{vip-spell-function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 @item *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 @kindex @kbd{*}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 Call last keyboard macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 @item m .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 Set mark at point and push old mark off the ring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 @item m<
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 @item m>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 Set mark at beginning and end of buffer, respectively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 @item m,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 Jump to mark and pop mark off the ring. @xref{Mark,,Mark,emacs,The GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 Emacs Manual}, for more info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 @item ] register
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 @kindex @kbd{]<a-z>}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 View contents of register
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 @item [ textmarker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 @kindex @kbd{[<a-z>}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 View filename and position of textmarker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 @item @@#
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 @item @@register
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 @item @@!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 @kindex @kbd{@@#}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 @kindex @kbd{@@<a-z>}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 @kindex @kbd{@@!}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 @cindex keyboard macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 @cindex register execution
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 Begin/end keyboard macro. @@register has a different meaning when used after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 a @kbd{@@#}. @xref{Macros and Registers}, for details
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 @item []
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 @kindex @kbd{[]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 Go to end of heading.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 @item g <@emph{movement command}>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 Search buffer for text delimited by movement command. The canonical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 example is @kbd{gw} to search for the word under the cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 @xref{Improved Search}, for details.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 @item C-g and C-]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 @kindex @kbd{C-g}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 @kindex @kbd{C-]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 Quit and Abort Recursive edit. These may be necessary on occasion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 @xref{Vi State}, for a reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 @item C-c g
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 @kindex @kbd{C-c g}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 Hitting @kbd{C-c} followed by @kbd{g} will display the information on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 current buffer. This is the same as hitting @kbd{C-g} in Vi, but, as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 explained above, @kbd{C-g} is needed for other purposes in Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 @item C-c /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 @kindex @kbd{C-c /}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 Without a prefix argument, this command toggles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 case-sensitive/case-insensitive search modes and plain vanilla/regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 expression search. With the prefix argument 1, i.e.,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 @kbd{1 C-c /}, this toggles case-sensitivity; with the prefix argument 2,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 toggles plain vanilla search and search using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 regular expressions. @xref{Viper Specials}, for alternative ways to invoke
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 @cindex vanilla search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 @cindex case-sensitive search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 @cindex case-insensitive search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 @item M-p and M-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 @kindex @kbd{M-p}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 @kindex @kbd{M-n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 In the Minibuffer, these commands navigate through the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 histories, such as the history of search strings, Ex commands, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 @item C-c M-p and C-c M-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 @kindex @kbd{C-c M-p}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 @kindex @kbd{C-c M-n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 @cindex Insertion history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 @cindex Insertion ring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 @cindex Command history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 @cindex Command ring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 In Insert or Replace state, these commands let the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 peruse the history of insertion strings used in previous insert or replace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 commands. Try to hit @kbd{C-c M-p} or @kbd{C-c M-n} repeatedly and see what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 happens. @xref{Viper Specials}, for more.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 In Vi state, these commands let the user peruse the history of Vi-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 destructive commands, such as @kbd{dw}, @kbd{J}, @kbd{a}, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 By repeatedly typing @kbd{C-c M-p} or @kbd{C-c M-n} you will cycle Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 through the recent history of Vi commands, displaying the commands one by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 one. Once
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 an appropriate command is found, it can be executed by typing `@kbd{.}'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 Since typing @kbd{C-c M-p} is tedious, it is more convenient to bind an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 appropriate function to a function key on the keyboard and use that key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 @xref{Viper Specials}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 @item Ex commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 @findex @kbd{:args}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 @findex @kbd{:n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 @findex @kbd{:pwd}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 @findex @kbd{:pre}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 The commands @kbd{:args}, @kbd{:next}, @kbd{:pre} behave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 differently. @kbd{:pwd} exists to get current directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 The commands @kbd{:b} and @kbd{:B} switch buffers around. @xref{File and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 Buffer Handling}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 There are also the new commands @kbd{:RelatedFile} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 @kbd{PreviousRelatedFile} (which abbreviate to @kbd{R} and @kbd{P},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 respectively. @xref{Viper Specials}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 @findex @kbd{:RelatedFile}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 @findex @kbd{:PreviousRelatedFile}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 Apart from the new commands, many old commands have been enhanced. Most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 notably, Vi style macros are much more powerful in Viper than in Vi. @xref{Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 Macros}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 @node Useful Packages, ,New Commands, Improvements over Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 @section Useful Packages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 Some Emacs packages are mentioned here as an aid to the new Viper user, to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 indicate what Viper is capable of.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 A vast number comes with the standard Emacs distribution, and many more exist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 on the net and on the archives.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 This manual also mentions some Emacs features a new user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 should know about. The details of these are found in the GNU Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 The features first. For details, look up the Emacs Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 @item Make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 @cindex make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 @cindex compiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 Makes and Compiles can be done from the editor. Error messages will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 parsed and you can move to the error lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 @item Shell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 @cindex shell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 @cindex interactive shell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 You can talk to Shells from inside the editor. Your entire shell session
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 can be treated as a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 @item Mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 @cindex email
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 @cindex mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 Mail can be read from and sent within the editor. Several sophisticated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 packages exist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 @item Language Sensitive Editing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 Editing modes are written for most computer languages in existence. By
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 controlling indentation, they catch punctuation errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 The packages, below, represents a drop in the sea of special-purpose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 packages that come with standard distribution of Emacs 19.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 @item Transparent FTP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 @cindex transparent ftp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 @pindex ange-ftp.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 @code{ange-ftp.el} can ftp from the editor to files on other machines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 transparent to the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 @item RCS Interfaces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 @cindex version maintenance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 @cindex RCS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 @pindex vc.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 @code{vc.el} for doing RCS commands from inside the editor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 @item Directory Editor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 @cindex dired
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 @pindex dired.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 @code{dired.el} for editing contents of directories and for navigating in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 the file system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 @item Syntactic Highlighting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 @cindex hilit19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 @pindex hilit19.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 @cindex font-lock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 @pindex font-lock.el
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1493 @code{font-lock.el} for automatic highlighting various parts of a buffer
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 using different fonts and colors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 @item Saving Emacs Configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 @cindex desktop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 @pindex desktop.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 @code{desktop.el} for saving/restoring configuration on Emacs exit/startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 @item Spell Checker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 @cindex ispell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 @pindex ispell.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 @code{ispell.el} for spell checking the buffer, words, regions, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 @item File and Buffer Comparison
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 @cindex ediff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 @pindex ediff.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 @code{ediff.el} for finding differences between files and for applying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 patches.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 Emacs Lisp archives exist on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 @samp{archive.cis.ohio-state.edu}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 and @samp{wuarchive.wustl.edu}@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 @node Customization,Commands,Improvements over Vi,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 @chapter Customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 @cindex customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 Customization can be done in 2 ways.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 @cindex initialization
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1526 @cindex .viper
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1527 Elisp code in a @file{.viper} file in your home directory. Viper
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1528 loads @file{.viper} just before it does the binding for mode
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 hooks. This is the recommended method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 @cindex .emacs
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1532 Elisp code in your @file{.emacs} file before and after the @code{(require
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1533 'viper)} line. This method is not recommended, unless you know what you are
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1534 doing. Only two variables, @code{viper-mode} and
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1535 @code{vip-custom-file-name} are supposed to be customized in @file{.emacs},
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1536 prior to loading Viper.@refill
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 @noindent
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1540 Most of Viper's behavior can be customized via the interactive Emacs user
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1541 interface. Choose "Customize" from the menubar, click on "Editing", then on
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1542 "Emulations". The customization widget is self-explanatory. Once you are
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1543 satisfied with your changes, save them into a file and then include the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1544 contents of that file in the Viper customization repository, @file{.viper}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1545 (except for @code{viper-mode} and @code{vip-custom-file-name}, which are
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1546 supposed to go into @code{.emacs}).
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1547
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1548 Some advanced customization cannot be accomplished this way, however, and
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1549 has to be done in Emacs Lisp. For the common cases, examples are provided
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1550 that you can use directly.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 * Rudimentary Changes:: Simple constant definitions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 * Keybindings:: Enabling Emacs Keys, Rebinding keys, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 * Packages that Change Keymaps:: How to deal with such beasts.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 * Viper Specials:: Special Viper commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 * Vi Macros:: How to do Vi style macros.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 @node Rudimentary Changes,Keybindings,Customization,Customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 @section Rudimentary Changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 @cindex setting variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 @cindex variables for customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 @findex @kbd{:set}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 An easy way to customize Viper is to change the values of constants used in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 Viper. Here is the list of the constants used in Viper and their default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 values. The corresponding :se command is also indicated. (The symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 @code{t} and @code{nil} represent ``true'' and ``false'' in Lisp).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 Viper supports both the abbreviated Vi variable names and their full
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1573 names. Variable completion is done on full names only. @key{TAB} and
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1574 @key{SPC} complete
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 variable names. Typing `=' will complete the name and then will prompt for
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1576 a value, if applicable. For instance, @kbd{:se au @key{SPC}} will complete the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1577 command to @kbd{:set autoindent}; @kbd{:se ta @key{SPC}} will complete the command
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 and prompt further like this: @kbd{:set tabstop = }.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1579 However, typing @kbd{:se ts @key{SPC}} will produce a ``No match'' message
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 because @kbd{ts} is an abbreviation for @kbd{tabstop} and Viper supports
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1581 completion on full names only. However, you can still hit @key{RET}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 or @kbd{=}, which will complete the command like this: @kbd{:set ts = } and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 Viper will be waiting for you to type a value for the tabstop variable.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1584 To get the full list of Vi variables, type @kbd{:se @key{SPC} @key{TAB}}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 @item vip-auto-indent nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 @itemx :se ai (:se autoindent)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1589 @itemx :se ai-g (:se autoindent-global)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 If @code{t}, enable auto indentation.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1591 by @key{RET}, @kbd{o} or @kbd{O} command.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 @code{vip-auto-indent} is a local variable. To change the value globally, use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 @code{setq-default}. It may be useful for certain major modes to have their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 own values of @code{vip-auto-indent}. This can be achieved by using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 @code{setq} to change the local value of this variable in the hooks to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 appropriate major modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 @kbd{:se ai} changes the value of @code{vip-auto-indent} in the current
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1600 buffer only; @kbd{:se ai-g} does the same globally.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 @item vip-electric-mode t
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1602 If not @code{nil}, auto-indentation becomes electric, which means that
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1603 @key{RET}, @kbd{O}, and @kbd{o} indent cursor according to the current
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1604 major mode. In the future, this variable may control additional electric
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1605 features.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 This is a local variable: @code{setq} changes the value of this variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 in the current buffer only. Use @code{setq-default} to change the value in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 all buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 @item vip-case-fold-search nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 @itemx :se ic (:se ignorecase)
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1612 If not @code{nil}, search ignores cases.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 This can also be toggled by quickly hitting @kbd{/} twice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 @item vip-re-search nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 @itemx :se magic
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1616 If not @code{nil}, search will use regular expressions; if @code{nil} then
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1617 use vanilla search.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 This behavior can also be toggled by quickly hitting @kbd{/} trice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 @item buffer-read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 @itemx :se ro (:se readonly)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 Set current buffer to read only. To change globally put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 @code{(setq-default buffer-read-only t)} in your @file{.emacs} file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 @item blink-matching-paren t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 @itemx :se sm (:se showmatch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 Show matching parens by blinking cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 @item tab-width t (default setting via @code{setq-default})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 @itemx :se ts=value (:se tabstop=value)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1628 @itemx :se ts-g=value (:se tabstop-global=value)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 @code{tab-width} is a local variable that controls the width of the tab stops.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 To change the value globally, use @code{setq-default}; for local settings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 use @code{setq}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 The command @kbd{:se ts}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 sets the tab width in the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 buffer only; it has no effect on other buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1637 The command @kbd{:se ts-g} sets tab width globally,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 for all buffers where the tab is not yet set locally,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 including the new buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1641 Note that typing @key{TAB} normally
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 doesn't insert the tab, since this key is usually bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 a text-formatting function, @code{indent-for-tab-command} (which facilitates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 programming and document writing). Instead, the tab is inserted via the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 command @code{vip-insert-tab}, which is bound to @kbd{S-tab} (shift + tab).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1647 On some non-windowing terminals, Shift doesn't modify the @key{TAB} key, so
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1648 @kbd{S-tab} behaves as if it were @key{TAB}. In such a case, you will have
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 to bind @code{vip-insert-tab} to some other convenient key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 @item vip-shift-width 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 @itemx :se sw=value (:se shiftwidth=value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 The number of columns shifted by @kbd{>} and @kbd{<} commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 @item vip-search-wrap-around t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 @itemx :se ws (:se wrapscan)
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1656 If not @code{nil}, search wraps around the end/beginning of buffer.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1657 @item vip-search-scroll-threshold 2
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1658 If search lands within this many lines of the window top or bottom, the
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1659 window will be scrolled up or down by about 1/7-th of its size, to reveal
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1660 the context. If the value is negative---don't scroll.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 @item vip-tags-file-name "TAGS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 The name of the file used as the tag table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 @item vip-re-query-replace nil
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1664 If not @code{nil}, use reg-exp replace in query replace.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 @item vip-want-ctl-h-help nil
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1666 If not @code{nil}, @kbd{C-h} is bound to @code{help-command};
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 if @code{nil}, it is bound to @code{delete-backward-char}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 @item vip-vi-style-in-minibuffer t
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1669 If not @code{nil}, Viper provides a high degree of compatibility with Vi
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1670 insert mode when you type text in the Minibuffer; if @code{nil}, typing in
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1671 the Minibuffer feels like plain Emacs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 @item vip-no-multiple-ESC t
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1673 If you set this to @code{nil}, you can use @key{ESC} as Meta in Vi state.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 Normally, this is not necessary, since graphical displays have separate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 Meta keys (usually on each side of the space bar). On a dumb terminal, Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 sets this variable to @code{twice}, which is almost like @code{nil}, except
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1677 that double @key{ESC} beeps. This, too, lets @key{ESC} to be used as a Meta.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1678 @item vip-ESC-keyseq-timeout 200 on tty, 0 on windowing display
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1679 Escape key sequences separated by this much delay (in miliseconds) are
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1680 interpreted as command, ignoring the special meaning of @key{ESC} in
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1681 VI. The default is suitable for most terminals. However, if your terminal
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1682 is extremely slow, you might want to increase this slightly. You will know
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1683 if your terminal is slow if the @key{ESC} key sequences emitted by the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1684 arrow keys are interpreted as separately typed characters (and thus the
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1685 arrow keys won't work). Making this value too large will slow you down, so
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1686 exercise restraint.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1687 @item vip-fast-keyseq-timeout 200
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1688 Key sequences separated by this many miliseconds are treated as Vi-style
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1689 keyboard macros. If the key sequence is defined as such a macro, it will be
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1690 executed. Otherwise, it is processed as an ordinary sequence of typed keys.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1691
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1692 Setting this variable too high may slow down your typing. Setting it too
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1693 low may make it hard to type macros quickly enough.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 @item vip-ex-style-motion t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 Set this to @code{nil}, if you want @kbd{l,h} to cross
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 lines, etc. @xref{Movement and Markers}, for more info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 @item vip-ex-style-editing-in-insert t
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1698 Set this to to @code{nil}, if you want
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1699 @kbd{C-h} and @key{DEL} to not stop
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 at the beginning of a line in Insert state.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1701 @item vip-ESC-moves-cursor-back t
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1702 It t, cursor moves back 1 character when switching from insert state to vi
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1703 state. If nil, the cursor stays where it was before the switch.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1704 @item viper-always t
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1705 @code{t} means: leave it to Viper to decide when a buffer must be brought
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1706 up in Vi state,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 Insert state, or Emacs state. This heuristics works well in virtually all
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1708 cases. @code{nil} means you either has to invoke @code{viper-mode} manually
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1709 for each buffer (or you can add @code{viper-mode} to the appropriate major mode
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1710 hooks using @code{vip-load-hook}).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1711
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1712 This option must be set in the file @file{~/.viper}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1713 @item vip-custom-file-name "~/.viper"
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1714 File used for Viper-specific customization.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1715 Change this setting, if you want. Must be set in @file{.emacs} (not @file{.viper}!)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 before Viper is loaded. Note that you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 have to set it as a string inside double quotes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 @item vip-spell-function 'ispell-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 Function used by the command @kbd{#c<move>} to spell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 @item ex-nontrivial-find-file-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 The value of this variable is the function used to find all files that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 match a wildcard. This is usually done when the user types @kbd{:e} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 specifies a wildcard in the file name (or if the file name contains unusual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 symbols (e.g., a space). Viper provides two functions for this: one for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 Unix-like systems (@code{vip-ex-nontrivial-find-file-unix}) and one for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 DOS, W95, and NT (@code{vip-ex-nontrivial-find-file-ms}). If the default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 function doesn't quite do what you expect or if you prefer to use ``fancy''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 shells, you may have to write your own version of this function and make it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 into the value of @code{ex-nontrivial-find-file-function}. Use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 @code{vip-ex-nontrivial-find-file-unix} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 @code{vip-ex-nontrivial-find-file-ms} as examples.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 @vindex @code{ex-nontrivial-find-file-function}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 @findex @code{vip-ex-nontrivial-find-file-ms}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 @findex @code{vip-ex-nontrivial-find-file-unix}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 @item ex-cycle-other-window t
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1736 If not @code{nil}, @kbd{:n} and @kbd{:b} will cycle through files in another
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 window, if one exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 @item ex-cycle-through-non-files nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 @kbd{:n} does not normally cycle through buffers. Set this to get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 buffers also.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 @item vip-automatic-iso-accents nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 If @kbd{t}, ISO accents will be turned on in insert/replace Viper states
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 and turned off in Vi state. This is useful for editing text in European
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 languages. This variable is buffer-local. If used, it should be set in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 hooks to the appropriate major modes (usually setting it in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 @code{text-mode-hook} is enough).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 @item vip-want-emacs-keys-in-insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 This is set to @code{nil} for user levels 1 and 2 and to @code{t} for user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 levels 3 and 4. Users who specify level 5 are allowed to set this variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 as they please (the default for this level is @code{t}). If set to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 @code{nil}, complete Vi compatibility is provided in Insert state. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 really not recommended, as this precludes you from using language-specific
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 features provided by the major modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 @item vip-want-emacs-keys-in-vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 This is set to @code{nil} for user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 level 1 and to @code{t} for user levels 2--4.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 At level 5, users are allowed to set this variable as they please (the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 default for this level is @code{t}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 If set to @code{nil}, complete Vi compatibility is provided
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 in Vi command state. Setting this to @code{nil} is really a bad idea,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 unless you are a novice, as this precludes the use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 of language-specific features provided by the major modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 @item vip-keep-point-on-repeat t
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1764 If not @code{nil}, point is not moved when the user repeats the previous
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1765 command by typing `.' This is very useful for doing repeated changes with
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1766 the @kbd{.} key.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 @item vip-repeat-from-history-key 'f12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 Prefix key used to invoke the macros @kbd{f12 1} and @kbd{f12 2} that repeat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 the second-last and the third-last destructive command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 Both these macros are bound (as Viper macros) to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 @code{vip-repeat-from-history},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 which checks the second key by which it is invoked to see which of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only,
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1774 but the user can bind more in @file{~/.viper}. @xref{Vi Macros}, for how to do
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 @item vip-keep-point-on-undo nil
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1777 If not @code{nil}, Viper tries to not move point when undoing commands.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 Instead, it will briefly move the cursor to the place where change has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 taken place. However, if the undone piece of text is not seen in window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 then point will be moved to the place where the change took place.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 Set it to @code{t} and see if you like it better.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 @item vip-delete-backwards-in-replace nil
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1783 If not @code{nil}, @key{DEL} key will delete characters while moving the cursor
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1784 backwards. If @code{nil}, the cursor will move backwards without deleting
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1785 anything.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 @item vip-replace-overlay-face 'vip-replace-overlay-face
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1787 @itemx vip-replace-overlay-pixmap "grey3"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 On a graphical display, Viper highlights replacement regions instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 putting a @samp{$} at the end. This variable controls the so called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 @dfn{face} used to highlight the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1792 By default, @code{vip-replace-overlay-face} underlines the replacement on
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1793 monochrome displays and also lays a pixmap over them (as specified in the
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1794 variable @code{vip-replace-overlay-pixmap}. On color displays, replacement
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1795 regions are highlighted with color.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1796
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1797 If you know something about Emacs faces and don't like how Viper highlights
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1798 replacement regions, you can change @code{vip-replace-overlay-face} by
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1799 specifying a new face. (Emacs faces are described in the Emacs Lisp
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1800 reference.) On a color display, the following customization method is
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1801 usually most effective:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 (set-face-foreground vip-replace-overlay-face "DarkSlateBlue")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (set-face-background vip-replace-overlay-face "yellow")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 @end example
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1806 For a complete list of colors available to you, evaluate the expression
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1807 @code{(x-defined-colors)}. (Type it in the buffer @code{*scratch*} and then
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1808 hit the @kbd{C-j} key.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1809
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1810 On a monochrome display, you can change the value of the variable
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1811 @code{vip-replace-overlay-pixmap} to specify the pixmap of your choice
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1812 (which should be a string denoting the file name of the pixmap). Emacs
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1813 takes pixmaps from the directory specified in the variable
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1814 @code{x-bitmap-file-path}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 @item vip-replace-overlay-cursor-color "Red"
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1816 @vindex @code{vip-replace-overlay-cursor-color}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 Cursor color when it is inside the replacement region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 This has effect only on color displays and only when Emacs runs as an X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 application.
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1820 @item vip-insert-state-cursor-color nil
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1821 @vindex @code{vip-insert-state-cursor-color}
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1822 If set to a valid color, this will be the cursor color when Viper is in
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1823 insert state.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 @item vip-replace-region-end-delimiter "$"
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1825 A string used to mark the end of replacement regions. It is used only on
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 TTYs or if @code{vip-use-replace-region-delimiters} is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 @item vip-replace-region-start-delimiter ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 A string used to mark the beginning of replacement regions. It is used
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1829 only on TTYs or if @code{vip-use-replace-region-delimiters} is non-nil.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 @item vip-use-replace-region-delimiters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 If non-nil, Viper will always use @code{vip-replace-region-end-delimiter} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 @code{vip-replace-region-start-delimiter} to delimit replacement regions,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 even on color displays (where this is unnecessary). By default, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 variable is non-nil only on TTYs or monochrome displays.
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1835 @item vip-allow-multiline-replace-regions t
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1836 If non-nil, multi-line text replacement regions, such as those produced by
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1837 commands @kbd{c55w}, @kbd{3C}, etc., will stay around until the user exits
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1838 the replacement mode. In this variable is set to @code{nil}, Viper will
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1839 emulate the standard Vi behavior, which supports only intra-line
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1840 replacement regions (and multi-line replacement regions are deleted).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 @item vip-toggle-key "\C-z"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 Specifies the key used to switch from Emacs to Vi and back.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1843 Must be set in @file{.viper}. This variable can't be
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 changed interactively after Viper is loaded.
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1845
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1846 In Insert state, this key acts as a temporary escape to Vi state, i.e., it
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1847 will set Viper up so that the very next command will be executed as if it
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1848 were typed in Vi state.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 @item vip-ESC-key "\e"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 Specifies the key used to escape from Insert/Replace states to Vi.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1851 Must be set in @file{.viper}. This variable cannot be
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 changed interactively after Viper is loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 @item vip-buffer-search-char nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 Key used for buffer search. @xref{Viper Specials}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 @item vip-surrounding-word-function 'vip-surrounding-word
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 The value of this variable is a function name that is used to determine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 what constitutes a word clicked upon by the mouse. This is used by mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 search and insert.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 @item vip-search-face 'vip-search-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 Variable that controls how search patterns are highlighted when they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 @item vip-vi-state-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 List of parameterless functions to be run just after entering the Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 command state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 @item vip-insert-state-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 Same for Insert state. This hook is also run after entering Replace state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 @item vip-replace-state-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 List of (parameterless) functions called just after entering Replace state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 (and after all @code{vip-insert-state-hook}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 @item vip-emacs-state-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 List of (parameterless) functions called just after switching from Vi state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 to Emacs state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 @item vip-load-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 List of (parameterless) functions called just after loading Viper. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 the last chance to do customization before Viper is up and running.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 You can reset some of these constants in Viper with the Ex command @kbd{:set}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 (when so indicated in the table). Or you
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1880 can include a line like this in your @file{.viper} file:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 (setq vip-case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 @vindex @code{vip-auto-indent}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 @vindex @code{vip-electric-mode}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 @vindex @code{vip-case-fold-search}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 @vindex @code{vip-re-search}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 @vindex @code{vip-shift-width}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 @vindex @code{buffer-read-only}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 @vindex @code{vip-search-wrap-around}
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1891 @vindex @code{vip-search-scroll-threshold}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 @vindex @code{vip-search-face}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 @vindex @code{vip-tags-file-name}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 @vindex @code{vip-re-query-replace}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 @vindex @code{vip-want-ctl-h-help}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 @vindex @code{vip-vi-style-in-minibuffer}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 @vindex @code{vip-no-multiple-ESC}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1898 @vindex @code{viper-always}
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1899 @vindex @code{vip-ESC-keyseq-timeout}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1900 @vindex @code{vip-fast-keyseq-timeout}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 @vindex @code{vip-ex-style-motion}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 @vindex @code{vip-ex-style-editing-in-insert}
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
1903 @vindex @code{vip-ESC-moves-cursor-back}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 @vindex @code{vip-custom-file-name}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 @vindex @code{vip-spell-function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 @vindex @code{ex-cycle-other-window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 @vindex @code{ex-cycle-through-non-files}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 @vindex @code{vip-automatic-iso-accents}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 @vindex @code{vip-want-emacs-keys-in-insert}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 @vindex @code{vip-want-emacs-keys-in-vi}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 @vindex @code{vip-keep-point-on-repeat}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 @vindex @code{vip-keep-point-on-undo}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 @vindex @code{vip-delete-backwards-in-replace}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 @vindex @code{vip-replace-overlay-face}
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1915 @vindex @code{vip-replace-overlay-pixmap}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 @vindex @code{vip-replace-region-end-symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 @vindex @code{vip-replace-region-start-symbol}
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1918 @vindex @code{vip-allow-multiline-replace-regions}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 @vindex @code{vip-toggle-key}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 @vindex @code{vip-ESC-key}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 @vindex @code{vip-buffer-search-char}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 @vindex @code{vip-surrounding-word-function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 @vindex @code{vip-vi-state-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 @vindex @code{vip-insert-state-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 @vindex @code{vip-replace-state-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 @vindex @code{vip-emacs-state-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 @node Keybindings, Packages that Change Keymaps, Rudimentary Changes,Customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 @section Keybindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 @cindex keybindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 @cindex keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 Viper lets you define hot keys, i.e., you can associate keyboard keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 such as F1, Help, PgDn, etc., with Emacs Lisp functions (that may already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 exist or that you will write). Each key has a "preferred form" in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 Emacs. For instance, the Up key's preferred form is [up], the Help key's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 preferred form is [help], and the Undo key has the preferred form [f14].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 You can find out the preferred form of a key by typing @kbd{M-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 describe-key-briefly} and then typing the key you want to know about.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 Under X Windows, every keyboard key emits its preferred form, so you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 just type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 (global-set-key [f11] 'calendar) ; L1, Stop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 (global-set-key [f14] 'undo) ; L4, Undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 to bind L1 so it will invoke the Emacs Calendar and to bind L4 so it will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 undo changes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 However, on a dumb terminal or in an Xterm window, even the standard arrow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 keys may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 not emit the right signals for Emacs to understand. To let Emacs know about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 those keys, you will have to find out which key sequences they emit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 by typing @kbd{C-q} and then the key (you should switch to Emacs state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 first). Then you can bind those sequences to their preferred forms using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 @code{function-key-map} as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 (cond ((string= (getenv "TERM") "xterm")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 (define-key function-key-map "\e[192z" [f11]) ; L1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 (define-key function-key-map "\e[195z" [f14]) ; L4, Undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 The above illustrates how to do this for Xterm. On VT100, you would have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 replace "xterm" with "vt100" and also change the key sequences (the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 key may emit different sequences on different types of terminals).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 The above keys are global, so they are overwritten by the local maps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 defined by the major modes and by Viper itself. Therefore, if you wish to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 change a binding set by a major mode or by Viper, read this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 Viper users who wish to specify their own key bindings should be concerned
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 only with the following three keymaps:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 @code{vip-vi-global-user-map} for Vi state commands,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 @code{vip-insert-global-user-map} for Insert state commands,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 and @code{vip-emacs-global-user-map} for Emacs state commands (note:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 customized bindings for Emacs state made to @code{vip-emacs-global-user-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 are @emph{not} inherited by Insert state).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 For more information on Viper keymaps, see the header of the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 @file{viper.el}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 If you wish to change a Viper binding, you can use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 @code{define-key} command, to modify @code{vip-vi-global-user-map},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 @code{vip-insert-global-user-map}, and @code{vip-emacs-global-user-map}, as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 explained below. Each of these key maps affects the corresponding Viper state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 The keymap @code{vip-vi-global-user-map} also affects Viper's Replace state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 If you want to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 bind a key, say @kbd{C-v}, to the function that scrolls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 page down and to make @kbd{0} display information on the current buffer,
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
1995 putting this in @file{.viper} will do the trick in Vi state:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 (define-key vip-vi-global-user-map "\C-v" 'scroll-down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 To set a key globally,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 (define-key vip-emacs-global-user-map "\C-c m" 'smail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 (define-key vip-vi-global-user-map "0" 'vip-info-on-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 Note, however, that this binding may be overwritten by other keymaps, since
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 the global keymap has the lowest priority.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 To make sure that nothing will override a binding in Emacs state, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 can write this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 (define-key vip-emacs-global-user-map "\C-c m" 'smail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 To customize the binding for @kbd{C-h} in Insert state:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 (define-key vip-insert-global-user-map "\C-h" 'my-del-backwards-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 Each Emacs command key calls some lisp function. If you have enabled the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 Help, (@xref{Rudimentary Changes}) @kbd{C-h k} will show you the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 for each specific key; @kbd{C-h b} will show all bindings, and @kbd{C-h m}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 will provide information on the major mode in effect. If Help is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 enabled, you can still get help in Vi state by prefixing the above commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 with @kbd{\}, e.g., @kbd{\ C-h k} (or you can use the Help menu in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 menu bar, if Emacs runs under X Windows).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 Viper users can also change bindings on a per major mode basis. As with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 global bindings, this can be done separately for each of the three main Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 states. To this end, Viper provides the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 @code{vip-modify-major-mode}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 @findex @code{vip-modify-major-mode}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 To modify keys in Emacs state for @code{my-favorite-major-mode}, the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 needs to create a sparse keymap, say, @code{my-fancy-map}, bind whatever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 keys necessary in that keymap, and put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 (vip-modify-major-mode 'dired-mode 'emacs-state my-fancy-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 @noindent
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2043 in @file{~/.viper}. To do the same in Vi and Insert states, one should use
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 @code{vi-state} and @code{insert-state}. Changes in Insert state are also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 in effect in Replace state. For instance, suppose that the user wants to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 use @kbd{dd} in Vi state under Dired mode to delete files, @kbd{u} to unmark
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2047 files, etc. The following code in @file{~/.viper} will then do the job:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 (setq my-dired-modifier-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 (define-key my-dired-modifier-map "dd" 'dired-flag-file-deletion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 (define-key my-dired-modifier-map "u" 'dired-unmark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 (vip-modify-major-mode 'dired-mode 'vi-state my-dired-modifier-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 A Vi purist may want to modify Emacs state under Dired mode so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 @kbd{k}, @kbd{l}, etc., will move around in directory buffers, as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 Vi. Although this is not recommended, as these keys are bound to useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 Dired functions, the trick can be accomplished via the following code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 (setq my-dired-vi-purist-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 (define-key my-dired-vi-purist-map "k" 'vip-previous-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 (define-key my-dired-vi-purist-map "l" 'vip-forward-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 (vip-modify-major-mode 'dired-mode 'emacs-state my-dired-vi-purist-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 Similar effect can be achieved by defining Vi keyboard macros using the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 Ex commands @kbd{:map} and @kbd{:map!}. The difference is that multi-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 Vi macros do not override the keys they are bound to, unless these keys are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 typed in quick succession. So, with macros, one can use the normal keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 alongside with the macros. If per-mode modifications are needed, the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 can try both ways and see which one is more convenient.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 @findex @kbd{:map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 @xref{Vi Macros}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 Note: in major modes that come up in @emph{Emacs state} by default, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 aforesaid modifications may not take place immediately (but only after the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 buffer switches to some other Viper state and then back to Emacs state). To
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 avoid this, one should add @code{vip-change-state-to-emacs} to an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 appropriate hook of that major mode. (Check the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 @code{vip-set-hooks} in @file{viper.el} for examples.) However, if you
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2083 have set @code{viper-always} to @code{t}, chances are that you won't need to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 perform the above procedure, because Viper will take care of most useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 defaults.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 Finally, Viper has a facility that lets the user define per-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 bindings, i.e., bindings that are in effect in some specific buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 only. Unlike per-mode bindings described above, per-buffer bindings can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 defined based on considerations other than the major mode. This is done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 via the function @code{vip-add-local-keys}, which lets one specify bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 that should be in effect in the current buffer only and for a specific Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 state. For instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 (vip-add-local-keys 'vi-state '(("ZZ" . TeX-command-master)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 ("ZQ" . vip-save-kill-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 redefines @kbd{ZZ} to invoke @code{TeX-command-master} in @code{vi-state}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 and @kbd{ZQ} to save-then-kill the current buffer. These bindings take
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 effect only in the buffer where this command is executed. The typical use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 of this function is to execute the above expression from within a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 that is included in a hook to some major mode. For instance, the above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 could be called from a function, @code{my-tex-init}, which may be added to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 @code{tex-mode-hook} as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 (add-hook 'tex-mode-hook 'my-tex-init)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 When TeX mode starts, the hook is executed and the above Lisp expression is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 evaluated. Then, the bindings for @kbd{ZZ} and @kbd{ZQ} are changed in Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 command mode for all buffers in TeX mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 Another useful application is to bind @kbd{ZZ} to @code{send-mail}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117 in the Mail mode buffers (the specifics of this depend on which mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 package you are using, @code{rmail}, @code{mh-e}, @code{vm}, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 For instance, here is how to do this for @code{mh-e}, the Emacs interface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120 to MH:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 (defun mh-add-vi-keys ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 "Set up ZZ for MH-e and XMH."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 (vip-add-local-keys 'vi-state '(("ZZ" . mh-send-letter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 (add-hook 'mh-letter-mode-hook 'mh-add-vi-keys)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 You can also use @code{vip-add-local-keys} to set per buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 bindings in Insert state and Emacs state by passing as a parameter the
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2130 symbols @code{insert-state} and @code{emacs-state}, respectively.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 As with global bindings, customized local bindings done to Emacs state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 are not inherited by Insert state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 On rare occasions, local keys may be added by mistake. Usually this is done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 indirectly, by invoking a major mode that adds local keys (e.g.,
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2136 @code{shell-mode} redefines @key{RET}). In such a case, exiting the wrong
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 major mode won't rid you from unwanted local keys, since these keys are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 local to Viper state and the current buffer, not to the major mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 In such situations, the remedy is to type @kbd{M-x vip-zap-local-keys}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 So much about Viper-specific bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 @xref{Customization,,Customization,emacs,The GNU Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 Manual}, and the Emacs quick reference card for the general info on key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 bindings in Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 @vindex @code{function-key-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 @vindex @code{vip-vi-global-user-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 @vindex @code{vip-insert-global-user-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 @vindex @code{vip-emacs-global-user-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 @findex @code{vip-add-local-keys}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 @findex @code{vip-zap-local-keys}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 @node Packages that Change Keymaps,Viper Specials,Keybindings,Customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 @subsection Packages that Change Keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 @cindex C-c and Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 @cindex Viper and C-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 Viper is designed to coexist with all major and minor modes of Emacs. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 means that bindings set by those modes are generally available with Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160 (unless you explicitly prohibit them by setting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 @code{vip-want-emacs-keys-in-vi} and @code{vip-want-emacs-keys-in-insert} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162 @code{nil}).
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2163 If @code{viper-always} is set to @code{t}, Viper will try to bring each buffer
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2164 in the Viper state that is most appropriate for that buffer.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165 Usually, this would be the Vi state, but sometimes it could be the Insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 state or the Emacs state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 Some major mode bindings will necessarily be overwritten by Viper. Indeed, in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169 Vi state, most of the 1-character keys are used for Vi-style editing. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 usually causes no problems because most packages designed for editing files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 typically do not bind such keys. Instead, they use key sequences that start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 with @kbd{C-x} and @kbd{C-c}. This is why it was so important for us to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 free up @kbd{C-x} and @kbd{C-c}.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2174 It is common for language-specific major modes to bind @key{TAB} and
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2175 @kbd{C-j} (the line feed) keys to various formatting functions. This is
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 extremely useful, but may require some getting used to for a Vi user. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177 decide that this feature is not for you, you can re-bind these keys as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 explained earlier (@xref{Customization}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2179
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2180 Binding for @key{TAB} is one of the most unusual aspects of Viper for many
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2181 novice users. In Emacs, @key{TAB} is used to format text and programs, and
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2182 is extremely useful. For instance, hitting @key{TAB} causes the current
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 line to be re-indented in accordance with the context. In programming,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184 this is very important, since improper automatic indentation would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185 immediately alert the programmer to a possible error. For instance, if a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 @kbd{)} or a @kbd{"} is missing somewhere above the current
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2187 line, @key{TAB} is likely to mis-indent the line.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 For this reason, Viper doesn't change the standard Emacs binding of
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2190 @key{TAB}, thereby sacrificing Vi compatibility
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 (except for users at level 1). Instead, in Viper, the key
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2192 @kbd{S-tab} (shift+ tab) is chosen to emulate Vi's @key{TAB}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194 We should note that on some non-windowing terminals, Shift doesn't modify
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2195 the @key{TAB} key, so @kbd{S-tab} behaves as if it were @key{TAB}. In such
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196 a case, you will have to bind @code{vip-insert-tab} to some other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 convenient key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2199 Some packages, notably Dired, Gnus, Info, etc., attach special meaning to
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2200 common keys like @key{SPC}, @kbd{x}, @kbd{d}, @kbd{v}, and others. This
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201 means that Vi command state is inappropriate for working with these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202 packages. Fortunately, these modes operate on read-only buffers and are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203 designed not for editing files, but for special-purpose browsing, reading
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 news, mail, etc., and Vi commands are meaningless in these situations. For
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 this reason, Viper doesn't force Vi state on such major modes. Rather, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206 brings them in Emacs state. You can switch to Vi state by typing @kbd{C-z}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207 if, for instance, you want to do Vi-style search in a buffer (although,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 usually, incremental search, which is bound to @kbd{C-s}, is sufficient in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 these situations). But you should then switch back to Emacs state if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210 plan to continue using these major modes productively. You can also switch
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2211 to Vi temporarily, to execute just one command. This is done by typing
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2212 @kbd{C-c \}. (In some of these modes, @kbd{/} and @kbd{:} are bound
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2213 Vi-style, unless these keys perform essential duties.)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 It is also possible to harness some major modes, even though they may bind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216 common keys to specialized commands. Harnessing can make sense for modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 that bind only a small number of common keys. For instance, if
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2218 @code{viper-always} is set to @code{t} in your @file{~/.viper} file, Viper will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2219 harness Shell mode by changing the bindings for @kbd{C-m} and @kbd{C-d}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220 using @code{vip-add-local-keys} described in section on customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 (@xref{Customization}). In general, there is no single recipe for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 harnessing modes. It can be as simple as adding the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223 @code{viper-mode} to a hook associated with the mode, or it can be more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 complex, as in the case of Shell mode and Emerge. Take a look at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 @code{vip-set-hooks} function for some examples.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 Conversely, it may be the case that most of the major modes harnessed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 by @code{vip-set-hooks} function fit your working style, except one or two
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2229 cases. In this case, you may still be able to set @code{viper-always} to
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 @code{t} and then remove a hook that forces Vi command state. For instance,
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2231 to unharness @code{lisp-interaction-mode}, you can execute the following line
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2232 in @code{vip-load-hook}:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 (remove-hook 'lisp-interaction-mode-hook 'viper-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 @end lisp
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2236 Note: this type of customization cannot be done in @code{.viper}!
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238 In some rare cases, some minor modes may override certain essential
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239 bindings in Vi command state. This is not really catastrophic because this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 may happen only in the beginning, when the minor mode kicks in. Typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241 @code{M-x viper-mode} will correct the situation. Viper knows about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242 several such minor modes and takes care of them, so that the above trick
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 is usually not necessary. If you find that some minor mode, e.g.,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 @code{nasty-mode.el} interferes with Viper, putting the following in
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2245 @file{.viper} should fix the problem:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247 (vip-harness-minor-mode "nasty-mode")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 The argument to @code{vip-harness-minor-mode} is the name of the file for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 offending minor mode with the suffixes @file{.el} and @file{.elc} removed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 It may be tricky, however, to find out which minor mode is at fault. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 only guidance here is to look into the file that defines the minor mode you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255 are suspecting, say @code{nasty-mode.el}, and see if it has a variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 called @code{nasty-mode-map}. Then check if there is a statement of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258 (define-key nasty-mode-map key function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 that binds the misbehaving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 keys. If so, use the above line to harness @code{nasty-mode}. If your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 suspicion is wrong, no harm is done if you harness a minor mode that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264 doesn't need to be harnessed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 @vindex @code{vip-want-emacs-keys-in-vi}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 @vindex @code{vip-want-emacs-keys-in-insert}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2268 @vindex @code{viper-always}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 @findex @code{vip-set-hooks}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 @findex @code{viper-mode}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 @findex @code{vip-harness-minor-mode}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 @findex @code{remove-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 @findex @code{add-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 @node Viper Specials,Vi Macros,Packages that Change Keymaps,Customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 @section Viper Specials
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278 Viper extends Vi with a number of useful features. This includes various
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279 search functions, histories of search strings, Ex commands, insertions, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280 Vi's destructive commands. In addition, Viper supports file name completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 and history, completion of Ex commands and variables, and many other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 features. Some of these features are explained in detail elsewhere in this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 document. Other features are explained here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 @item (vip-buffer-search-enable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 @item vip-buffer-search-char nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 Enable buffer search. Explicit call to @code{vip-buffer-search-enable}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 sets @code{vip-buffer-search-char} to @kbd{g}. Alternatively, the user can
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2290 set @code{vip-buffer-search-char} in @file{.viper} to a key sequence
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 to be used for buffer search. There is no need to call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 @code{vip-buffer-search-enable} in that case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 @findex @code{vip-buffer-search-enable}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 @vindex @code{vip-buffer-search-char}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 @item vip-toggle-search-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 This function, bound to @kbd{C-c /}, lets one toggle case-sensitive and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 case-insensitive search, and also switch between plain vanilla search and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 search via regular expressions. Without the prefix argument, the user is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 asked which mode to toggle. With prefix argument 1, this toggles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 case-sensitivity. With prefix argument 2, regular expression/vanilla search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 will be toggled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 However, we found that the most convenient way to toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 these options is to bind a Vi macro to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 bind @kbd{//} to toggles case sensitivity and to @kbd{///} to toggles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 vanilla search. Thus, quickly hitting @kbd{/} twice will switch Viper from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 case sensitive search to case-insensitive. Repeating this once again will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 restore the original state. Likewise, quickly hitting @kbd{/} three times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 will switch you from vanilla-style search to search via regular expressions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 If you hit something other than @kbd{/} after the first @kbd{/} or if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311 second @kbd{/} doesn't follow quickly enough, then Viper will issue the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 usual prompt @kbd{/} and will wait for input, as usual in Vi.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 If you don't like this behavior, you can ``unrecord'' these macros in your
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2314 @file{~/.viper} file. For instance, if you don't like the above feature, put
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2315 this in @file{~/.viper}:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316 @example
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2317 (vip-set-searchstyle-toggling-macros 'undefine)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318 @end example
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2319 @findex @code{vip-set-searchstyle-toggling-macros}
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2320
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2321 @item Vi-isms in Emacs state
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2322 Some people find it useful to use the Vi-style search key, `/', to invoke
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2323 search in modes which Viper leaves in emacs-state. These modes are:
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2324 @code{dired-mode}, @code{mh-folder-mode}, @code{gnus-group-mode},
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2325 @code{gnus-summary-mode}, @code{Info-mode}, and @code{Buffer-menu-mode}
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2326 (more may be added in the future). So, in the above modes, Viper binds `/'
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2327 so that it will behave Vi-style. Furthermore, in those major modes, Viper
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2328 binds `:' to invoke ex-style commands, like in vi-state. And, as described
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2329 above, `//' and `///' get bound to Vi-style macros that toggle
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2330 case-insensitivity and regexp-search.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2331
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2332 If you don't like these features---which I don't really understand---you
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2333 can unbind `/' and `:' in @code{vip-dired-modifier-map} (for Dired) or in
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2334 @code{vip-slash-and-colon-map}, for other modes.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2335 @vindex @code{vip-slash-and-colon-map}
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2336 @vindex @code{vip-dired-modifier-map}
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2337
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2338 To unbind the macros `//' and `///' for a major mode where you feel they
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2339 are undesirable, execute @code{vip-set-emacs-state-searchstyle-macros} with a
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2340 non-nil argument. This can be done either interactively, by supplying a
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2341 prefix argument, or by placing
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2342 @example
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2343 (vip-set-emacs-state-searchstyle-macros 'undefine)
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2344 @end example
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2345 @findex @code{vip-set-emacs-state-searchstyle-macros}
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2346 in the hook to the major mode (e.g., @code{dired-mode-hook}).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 @xref{Vi Macros}, for more information on Vi macros.
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2348
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349 @item vip-heading-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350 @item vip-heading-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2351 @cindex headings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 @cindex sections
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 @cindex paragraphs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 @cindex sentences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 Regular Expressions for @kbd{[[} and @kbd{]]}. Note that Emacs defines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 Regexps for paragraphs and sentences. @xref{Paragraphs,,Paragraphs and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 Sentences,emacs,The GNU Emacs Manual}, for details.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2358 @item M-x viper-set-expert-level
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2359 @findex @code{viper-set-expert-level}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 Change your user level interactively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 @item vip-smart-suffix-list '("" "tex" "c" "cc" "el" "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362 @vindex @code{vip-smart-suffix-list}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 Viper supports Emacs-style file completion when it prompts the user for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 file name. However, in many cases, the same directory may contain files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365 with identical prefix but different suffixes, e.g., prog.c, prog.o,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 paper.tex, paper.dvi. In such cases, completion will stop at the `.'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 If the above variable is a list of strings representing suffixes, Viper will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 try these suffixes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 in the order listed and will check if the corresponding file exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2371 For instance, if completion stopped at `paper.' and the user typed
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2372 @key{RET},
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373 then Viper will check if the files `paper.', `paper.tex', `paper.c', etc., exist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 It will take the first such file. If no file exists, Viper will give a chance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 to complete the file name by typing the appropriate suffix. If `paper.' was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376 the intended file name, hitting return will accept it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 To turn this feature off, set the above variable to @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 @item vip-insertion-ring-size 14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 @vindex @code{vip-insertion-ring-size}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 @cindex Insertion ring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 Viper remembers what was previously inserted in Insert and Replace states.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384 Several such recent insertions are kept in a special ring of strings of size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385 @code{vip-insertion-ring-size}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 If you enter Insert or Replace state you can reinsert strings from this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387 ring by typing @kbd{C-c M-p} or @kbd{C-c M-n}. The former will search the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388 ring in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 the direction of older insertions, and the latter will search in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 the direction of newer insertions. Hitting @kbd{C-c M-p} or @kbd{C-c M-n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391 in succession
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 will undo the previous insertion from the ring and insert the next item on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 the ring. If a larger ring size is needed, change the value of the above
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2394 variable in the @file{~/.viper} file.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 Since typing these sequences of keys may be tedious, it is suggested that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 user should bind a function key, such as @kbd{f31}, as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 (define-key vip-insert-global-user-map [f31]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 'vip-insert-prev-from-insertion-ring)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 This binds @kbd{f31} (which is usually @kbd{R11} on a Sun workstation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 to the function that inserts the previous string in the insertion history.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 To rotate the history in the opposite
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 direction, you can either bind an unused key to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406 @code{vip-insert-next-from-insertion-ring} or hit any digit (1 to 9) then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 @kbd{f31}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 this will interfere with the Minibuffer histories and, possibly, other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411 major modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 @item vip-command-ring-size 14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414 @vindex @code{vip-command-ring-size}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 @cindex Destructive command ring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 @cindex Destructive command history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 Viper keeps track of the recent history of destructive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 commands, such as @kbd{dw}, @kbd{i}, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 In Vi state,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 the most recent command can be re-executed by hitting `@kbd{.}', as in Vi.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 However, repeated typing @kbd{C-c M-p} will cause Viper to show the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 previous destructive commands in the minibuffer. Subsequent hitting `@kbd{.}'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 will execute the command that was displayed last.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424 The key @kbd{C-c M-n} will cycle through the command history in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 opposite direction.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 Since typing @kbd{C-c M-p} may be tedious, it is more convenient to bind an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427 appropriate function to an unused function key on the keyboard and use that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 key. For instance, the following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 (define-key vip-vi-global-user-map [f31]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431 'vip-prev-destructive-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 binds the key @kbd{f31} (which is usually @kbd{R11} on a Sun workstation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434 to the function that searches the command history in the direction of older
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435 commands. To search in the opposite
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 direction, you can either bind an unused key to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437 @code{vip-next-destructive-command} or hit any digit (1 to 9) then @kbd{f31}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 this will interfere with the Minibuffer histories and, possibly, other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 major modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 @item vip-minibuffer-vi-face 'vip-minibuffer-vi-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 @item vip-minibuffer-insert-face 'vip-minibuffer-insert-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 @item vip-minibuffer-emacs-face 'vip-minibuffer-emacs-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 These faces control the appearance of the minibuffer text in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447 corresponding Viper states. For heavy-duty customization, consult
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 the Lisp Reference to Emacs. You can also take a look how these faces are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449 defined in @file{viper.el}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 However, on a color workstation, the following method usually suffices:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453 (set-face-foreground vip-minibuffer-vi-face "blue")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 (set-face-background vip-minibuffer-emacs-face "orchid")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456 This will make a blue foreground in the Minibuffer when it is in Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 state; its background will turn to orchid when it switches to Emacs state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459 Note that only the text you type in is affected by the above faces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 Prompts and Minibuffer messages are not affected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462 Purists who do not like adornments in the minibuffer can always zap them by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 putting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 (copy-face 'default 'vip-minibuffer-vi-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466 (copy-face 'default 'vip-minibuffer-insert-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 (copy-face 'default 'vip-minibuffer-emacs-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 @end example
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2469 in the @file{~/.viper} file. However, in that case, the user will not have any
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 indication of the current Viper state in the minibuffer. (This is important
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2471 if the user accidentally switches to another Viper state by typing @key{ESC} or
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
2472 @kbd{C-z}).
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2473 @item M-x viper-go-away
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2474 @findex @code{viper-go-away}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2475 Make Viper disappear from the face of your running Emacs instance. If your
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
2476 fingers start aching again, @kbd{M-x viper-mode} might save your day.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 @cindex Multifile documents and programs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 Viper provides some support for multi-file documents and programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 If a document consists of several files we can designate one of them as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 master and put the following at the end of that file:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 ;;; Local Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 ;;; eval: (vip-setup-master-buffer "file1" "file2" "file3" "file5" "file5")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487 ;;; End:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490 where @code{file1} to @code{file5} are names of files related to the master
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 file. Next time, when the master file is visited, the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 @code{vip-setup-master-buffer} will be evaluated and the above files will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 be associated with the master file. Then, the new Ex command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 @kbd{:RelatedFile} (abbr. @kbd{:R}) will display files 1 to 5 one after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 another, so you can edit them. If a file is not in any Emacs buffer, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 will be visited. The command @kbd{PreviousRelatedFile} (abbr., @kbd{:P})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497 goes through the file list in the opposite direction.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 @findex @kbd{:RelatedFile}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 @findex @kbd{:PreviousRelatedFile}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501 These commands are akin to @kbd{:n} and @kbd{:N}, but they allow the user to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 focus on relevant files only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 Note that only the master file needs to have the aforementioned block of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 commands. Also, ";;;" above can be replaced by some other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506 markers. Semicolon is good for Lisp programs, since it is considered a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507 comment designator there. For LaTeX, this could be "%%%", and for C the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 above block should be commented out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 Even though these commands are sometimes useful, they are no substitute for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511 the powerful @emph{tag table} facility of Emacs. Viper's @kbd{:tag} command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2512 in a primitive interface to Emacs tags. @xref{Tags,Tags,Tags,emacs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 The Gnu Emacs Manual}, for more information on tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2515 The following two commands are normally bound to a mouse click and are part
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516 of Viper. They work only if Emacs runs as an application under X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517 Windows (or under some other window system for which a port of GNU Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518 is available). Clicking the mouse when Emacs is invoked in an Xterm window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519 (using @code{emacs -nw}) will do no good.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2521 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2522 @cindex mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2523 @item M-S-mouse-1 (Emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524 @item meta shift button1up (XEmacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525 Holding Meta and Shift while clicking mouse button 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526 will initiate search for a region under the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 mouse pointer (defined below). This command can take a prefix argument,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528 which indicates the occurrence of the pattern to search for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530 Note: Viper binds this mouse action only if it is not already bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2531 something else. If you want to use this feature and @kbd{M-S-mouse-1}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2532 is already used for something else, you can rebind mouse-search as, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 example, in the following example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2535 (global-set-key [M-mouse-1] 'vip-mouse-click-search-word)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2536 (global-set-key [M-down-mouse-1] 'vip-mouse-catch-frame-switch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538 This would bind mouse search to the action invoked by pressing the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 Meta key and clicking mouse button 1. Note: if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540 @code{vip-mouse-click-search-word} is bound to an action, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 @code{vip-mouse-catch-frame-switch} must be bound to a down-action, as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 shown in the above example.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544 In XEmacs, you can change bindings as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 (global-set-key [(meta control button1up)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547 'vip-mouse-click-search-word)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548 (global-set-key [(meta control button1)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 'vip-mouse-catch-frame-switch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 if, say, you prefer to hold both meta and control while clicking.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 Like in Emacs, there are special rules for binding these functions: the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2554 first must be bound to a button-up event while the second must be bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2555 a button-event (which is XEmacs' equivalent of a down-mouse event). Also,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556 in Emacs, the double-click and triple-click actions for the same button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557 (@code{double-S-mouse-1}, etc., if the above default binding is used)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558 should not be bound (or it should be bound to the same function,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559 @code{vip-mouse-click-search-word}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561 The region that is chosen as a pattern to search for is determined as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562 follows. If search is invoked via a single click, Viper chooses the region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563 that lies between the beginning of the ``word'' under the pointer (``word''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2564 is understood in Vi sense) and the end of that word. The only difference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2565 with Vi's words is that in Lisp major modes `-' is considered an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2566 alphanumeric symbol. This is done for the convenience of working with Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 symbols, which often have an `-' in them. Also, if you click on a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 non-alphanumeric character that is not a word separator (in Vi sense) then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569 this character will also be considered alphanumeric, provided that it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2570 adjacent (from either side) to an alphanumeric character. This useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 feature gives added control over the patterns selected by the mouse click.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573 On a double-click, the region is determined by the beginning of the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574 Vi's ``Word'' (i.e., the largest non-separator chunk of text) and the End
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 of that ``Word'' (as determined by the @kbd{E} command).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577 On a triple-click, the region consists of the entire line where the click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578 occurred with all leading and trailing spaces and tabs removed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2580 @item M-S-mouse-2 (Emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581 @item meta shift button2up (XEmacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582 Holding Meta and Shift while clicking mouse button 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583 will insert the region surrounding the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584 mouse pointer. The rules defining this region are the same as for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585 mouse-search. This command takes an optional prefix argument, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 indicates how many such regions to snarf from the buffer and insert. (In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587 case of a triple-click, the prefix argument is ignored.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 Note: Viper binds this mouse action only if it not already bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590 something else. If you want to use this feature and @kbd{S-mouse-2}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 is already used for something else, you can rebind mouse-insert as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2592 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2593 (global-set-key [M-mouse-2] 'vip-mouse-click-insert-word)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2594 (global-set-key [M-down-mouse-2] 'vip-mouse-catch-frame-switch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596 In XEmacs, you can change the bindings as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597 @lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598 (global-set-key [(meta control button2up)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2599 'vip-mouse-click-insert-word)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2600 (global-set-key [(meta control button2)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601 'vip-mouse-catch-frame-switch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 @end lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 @item vip-multiclick-timeout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605 This variable controls the rate at which double-clicking must occur for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 purpose of mouse search and mouse insert. By default, this is set to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607 @code{double-click-time} in Emacs and to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608 @code{mouse-track-multi-click-time} milliseconds in XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2610 @kindex @kbd{S-mouse-1}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611 @kindex @kbd{S-mouse-2}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612 @kindex @kbd{meta shift button1up}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2613 @kindex @kbd{meta shift button2up}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 @vindex @code{vip-multiclick-timeout}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2615 @findex @code{vip-mouse-click-insert-word}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616 @findex @code{vip-mouse-click-search-word}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618 Note: The above functions search and insert in the selected window of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619 the latest active frame. This means that you can click in another window or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 another frame and have search or insertion done in the frame and window you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621 just left. This lets one use these functions in a multi-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2622 configuration. However, this may require some getting used to. For
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2623 instance, if you are typing in a frame, A, and then move the mouse to frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 B and click to invoke mouse search, search (or insertion) will be performed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625 in frame A. To perform search/insertion in frame B, you will first have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 shift focus there, which doesn't happen until you type a character or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627 perform some other action in frame B---mouse search doesn't shift focus (in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2628 XEmacs, to shift focus to frame B, you will have to select this frame with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629 a mouse, by clicking.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631 If you decide that you don't like the above feature and always want
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 search/insertion be performed in the frame where the click occurs, don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633 bind (and unbind, if necessary) @code{vip-mouse-catch-frame-switch} from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634 the mouse event it is bound to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636 Mouse search is integrated with Vi-style search, so you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 repeat it with @kbd{n} and @kbd{N}. It should be also noted that, while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638 case-sensitivity of search in Viper is controlled by the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639 @code{vip-case-fold-search}, the case of mouse search is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 controlled by the Emacs variable @code{case-fold-search}, which may be set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641 differently from @code{vip-case-fold-search}. Therefore, case-sensitivity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642 of mouse search may be different from that of the usual Vi-style search.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644 Finally, if the way Viper determines the word to be searched for or to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 inserted is not what you want, there is a variable,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646 @code{vip-surrounding-word-function}, which can be changed to indicate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647 another function for snarfing words out of the buffer. The catch is that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 you will then have to write such a function and make it known to your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649 Emacs. The function @code{vip-surrounding-word} in @file{viper.el} can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 used as a guiding example.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652 @node Vi Macros, ,Viper Specials,Customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653 @section Vi Macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 @cindex Vi macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 Viper supports much enhanced Vi-style macros and also facilitates the use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 of Emacs-style macros. To define a temporary macro, it is generally more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659 convenient to use Emacs keyboard macro facility. Emacs keyboard macros are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2660 usually defined anonymously, and the latest macro can be executed by typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 @kbd{C-x e} (or @kbd{*}, if Viper is in Vi state). If you need to use several
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2662 temporary macros, Viper lets you save them to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 register (a lowercase letter); such macros can then be executed by typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664 @kbd{@@a} in Vi state (if a macro was previously saved in register
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 @kbd{a}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666 @xref{Macros and Registers}, for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668 If, however, you need to use a macro regularly, it must be given a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669 permanent name and saved. Emacs manual explains how to do this, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670 invocation of named Emacs macros is quite different from Vi's. First,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2671 invocation of permanent Emacs macros takes time because of the extra keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2672 Second, binding such macros to function keys, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 fast access, hogs valuable real estate on the keyboard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2675 Vi-style macros are better in that respect, since Vi lets the user overload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676 the meaning of key sequences: keys typed in fast succession are treated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 specially, if this key sequence is bound to a macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679 Viper provides keyboard macros through the usual Ex commands, @kbd{:map} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680 @kbd{:map!}. Vi-style macros are much more powerful in Viper than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 they are in the original Vi and in other emulators. This is because Viper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2682 implements an enhanced vi-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683 interface to the powerful Emacs keyboard macro facility.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685 First, any Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 command can be executed while defining a macro, not just the Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2687 commands. In particular, the user can invoke Emacs commands via @kbd{M-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2688 command-name} or by pressing various function keys on the keyboard. One
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2689 can even use the mouse, although this is usually not useful and is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2690 recommended (and macros defined with the use of the mouse cannot be saved in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2691 command history and in the startup file, for future use).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2693 Macros defined by mixing Vi and Emacs commands are represented as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2694 vectors. So, don't be confused when you see one (usually through the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2695 history of Ex commands). For instance, if @kbd{gg} is defined by typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2696 @kbd{l}, the up-arrow key and @kbd{M-x next-line}, its definition will look
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2697 as follows in Emacs (in XEmacs, it looks slightly different, see below):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2699 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2700 [l up (meta x) n e x t - l i n e return]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 Second, Viper macros are defined in a WYSIWYG style. This means that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 commands are executed as you type them, so you can see precisely what is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705 being defined. Third, macros can be bound to arbitrary sequences of keys,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 not just to printable keys. For instance, one can define a macro that will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2707 be invoked by hitting @kbd{f3} then @kbd{f2} function keys. (The keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708 @kbd{delete} and @kbd{backspace} are excluded; also, a macro invocation
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2709 sequence can't start with @key{ESC}. Some other keys, such as @kbd{f1} and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710 @kbd{help}, can't be bound to macros under Emacs (not XEmacs), since they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 are bound in @code{key-translation-map}, which overrides any other binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 the user gives to keys. In general, keys that have a binding in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 @code{key-translation-map} can't be bound to a macro.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2714
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2715 Fourth, in Viper, one can define macros that are specific to a given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2716 buffer, a given major mode, or macros that are defined for all buffers. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2717 fact, the same macro name can have several different definitions: one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2718 global, several definitions for various major modes, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719 definitions for various specific buffers. Buffer-specific definitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 override mode-specific definitions, which, in turn, override global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 definitions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2723 As if all that is not enough, Viper (through its interface to Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724 macros) lets the user define keyboard macros that ask for confirmation or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 even prompt the user for input and then continue. To do this, one should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2726 type @kbd{C-x q} (for confirmation) or @kbd{C-u C-x q} (for prompt).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 For details, @pxref{Kbd Macro Query,,Customization,emacs,The GNU Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728 Manual} @refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2730 When the user finishes defining a macro (which is done by typing @kbd{C-x)} ---
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 a departure from Vi), you will be asked whether you want this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2732 macro to be global, mode-specific, or buffer-specific. You will also be
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2733 given a chance to save the macro in your @file{~/.viper} file.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2734 This is the easiest way to save a macro and make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2735 it permanently available. If you work your startup files with bare hands,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 here is how Viper saves the above macro so that it will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2737 available in Viper's Insert state (and Replace state) in buffer @code{my-buf}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 only:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 (vip-record-kbd-macro "gg" 'insert-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2742 [l up (meta x) n e x t - l i n e return]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 "my-buf")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2744 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747 To do the same for Vi state and all buffers with the major mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2748 @code{cc-mode}, use:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2750 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751 (vip-record-kbd-macro "gg" 'vi-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752 [l up (meta x) n e x t - l i n e return]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 'cc-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2754 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2756 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2757 Both macro names and macro definitions are vectors of symbols that denote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2758 keys on the keyboard. Some keys, like @kbd{\}, @kbd{ }, or digit-keys must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759 be escaped with a backslash. Modified keys are represented as lists. For
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2760 instance, holding Meta and Control and pressing @kbd{f4} is represented as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2761 @kbd{(control meta f4)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2762 If all members of a vectors are printable characters (or sequences, such as
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2763 @kbd{\e}, @kbd{\t}, for @key{ESC} and @key{TAB}), then they can also be represented as
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2764 strings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2766 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2767 (vip-record-kbd-macro "aa" 'vi-state "aaa\e" "my-buffer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2768 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 Thus, typing @kbd{aa} fast in Vi state will switch Viper to Insert state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772 (due to the first @kbd{a}), insert @kbd{aa}, and then it will switch back to Vi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 state. All this will take effect only in the buffer named @code{my-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2775 Note that the last argument to @code{vip-record-kbd-macro} must be either a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2776 string (a buffer name), a symbol representing a major mode, or @code{t};
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2777 the latter says that the macro is to be defined for all buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2778 (which is how macros are defined in original Vi).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2779
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2780 For convenience, Viper also lets you define Vi-style macros in its Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2781 state. There is no Ex command, like @kbd{:map} and @kbd{:map!} for doing
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2782 this, but the user can include such a macro in the @file{~/.viper} file. The
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2783 only thing is that the @code{vip-record-kbd-macro} command should specify
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2784 @code{emacs-state} instead of @code{vi-state} or @code{insert-state}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2786 The user can get rid of a macro either by using the Ex commands @kbd{:unmap}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2787 and @kbd{:unmap!} or by issuing a call to @code{vip-unrecord-kbd-macro}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2788 The latter is more powerful, since it can delete macros even in
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2789 @code{emacs-state}. However, @code{vip-unrecord-kbd-macro} is usually
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2790 needed only when the user needs to get rid of the macros that are already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2791 predefined in Viper.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2792 The syntax is:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2793 @findex @code{vip-unrecord-kbd-macro}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2794 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2795 (vip-unrecord-kbd-macro macro state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2796 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2797 @noindent
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2798 The second argument must be @code{vi-state}, @code{insert-state}, or
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2799 @code{emacs-state}. The first argument is a name of a macro. To avoid
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2800 mistakes in specifying names of existing macros, type @kbd{M-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2801 vip-describe-kbd-macros} and use a name from the list displayed by this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2802 command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2804 If an error occurs during macro definition, Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2805 aborts the process, and it must be repeated. This is analogous to Vi,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2806 except that in Vi the user doesn't know there is an error until the macro is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2807 actually run. All that means that in order for a definition to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2808 successful, the user must do some simple planning of the process in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2809 advance, to avoid errors. For instance, if you want to map @kbd{gg} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2810 @kbd{llll} in Vi state, you must make sure that there is enough room on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2811 current line. Since @kbd{l} moves the cursor forward, it may signal an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2812 error on reaching the end of line, which will abort the definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2814 These precautions are necessary only when defining macros; they will help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2815 avoid the need to redo the job. When macros are actually run, an error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2816 during the execution will simply terminate the current execution
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2817 (but the macro will remain mapped).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2819 A macro name can be a string of characters or a vector of keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2820 The latter makes it possible to define macros bound to, say, double-hits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2821 on a function key, such as @kbd{up} or @kbd{f13}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2822 This is very useful if you run out of function keys on your keyboard; it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2823 makes Viper macro facility a @emph{keyboard doubler}, so to speak.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2824
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2825 Elsewhere (@xref{Keybindings}, for details), we review
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2826 the standard Emacs mechanism for binding function keys to commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2827 For instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2828
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2829 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2830 (global-set-key [f13] 'repeat-complex-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2831 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2833 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2834 binds the key f13 to the Emacs function that repeats the last minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2835 command. Under Viper, however, you may still use this key for additional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2836 purposes, if you bind, say, a double-hitting action for that key to some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2837 other function. Emacs doesn't allow the user to do that, but Viper does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2838 this through its keyboard macro facility. To do this, type @kbd{:map }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2839 first. When you are asked to enter a macro name, hit f13 twice, followed by
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2840 @key{RET} or @key{SPC}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2842 Emacs will now start the mapping process by actually executing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2843 Vi and Emacs commands, so that you could see what will happen each time the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2844 macro is executed. Suppose now we wanted to bind the key sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2845 @kbd{f13 f13} to the command @code{eval-last-sexp}. To accomplish this, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2846 can type @kbd{M-x eval-last-sexp} followed by @kbd{C-x )}.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2847 If you answer positively to Viper's offer to save this macro in @file{~/.viper}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2848 for future uses, the following will be inserted in that file:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2849
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2850 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2851 (vip-record-kbd-macro [f16 f16] 'vi-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2852 [(meta x) e v a l - l a s t - s e x p]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2853 'lisp-interaction-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2854 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2856 To illustrate the above point, Viper provides two canned macros, which, by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2857 default, are bound to @kbd{[f12 \1]} and @kbd{[f12 \2]} (invoked by typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2858 @kbd{f12} then @kbd{1} and @kbd{2}, respectively). These macros are useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2859 shortcuts to Viper's command ring history. The first macro will execute the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2860 second-last destructive command (the last one is executed by @kbd{.}, as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2861 usual). The second macro executes the third-last command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2862
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2863 If you need to go deeper into the command history, you will have to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2864 other commands, as described earlier in this section; or you can bind,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2865 say, @kbd{f12 \3} like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2866
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2867 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2868 (vip-record-kbd-macro [f12 \3] 'vi-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2869 [(meta x) r e p e a t - f r o m - h i s t o r y]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2870 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2871 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2872
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2874 Note that even though the macro uses the function key @kbd{f12}, the key is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2875 actually free and can still be bound to some Emacs function via
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2876 @code{define-key} or @code{global-set-key}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2877
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2878
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2879 Viper allows the user to define macro names that are prefixes of other macros.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2880 For instance, one can define @kbd{[[} and @kbd{[[[[} to be macros.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2881 If you type the exact sequence of such keys and then pause, Viper will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2882 execute the right macro. However, if you don't pause and, say, type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2883 @kbd{[[[[text} then the conflict is resolved as follows. If only one of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2884 key sequences, @kbd{[[} or @kbd{[[[[} has a definition applicable to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2885 current buffer, then, in fact, there is no conflict and the right macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2886 will be chosen. If both have applicable definitions, then the first one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2887 found will be executed. Usually this is the macro with a shorter name. So,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2888 in our case, @kbd{[[[[text} will cause the macro @kbd{[[} to be executed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2889 twice and then the remaining keys, @kbd{t e x t}, will be processed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2890
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2891 When defining macros using @kbd{:map} or @kbd{:map!}, the user enters the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2892 actually keys to be used to invoke the macro. For instance, you should hit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2893 the actual key @kbd{f6} if it is to be part of a macro name; you do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2894 @emph{not} write `f 6'. When entering keys, Viper displays them as strings or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2895 vectors (e.g., "abc" or [f6 f7 a]). The same holds for unmapping. Hitting
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2896 @key{TAB} while typing a macro name in the @kbd{:unmap} or @kbd{:unmap!} command
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2897 will cause name completion. Completions are displayed as strings or vectors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2898 However, as before, you don't actually type ``"'', ``['', or ``]'' that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2899 appear in the completions. These are meta-symbols that indicate whether
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2900 the corresponding macro name is a vector or a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2901
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2902 One last difference from Vi: Vi-style keyboard macros cannot be defined in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2903 terms of other Vi-style keyboard macros (but named Emacs macros are OK).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2904 More precisely, while defining or executing a macro, the special meaning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2905 of key sequences (as Vi macros) is ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2906 This is because it is all too easy to create an infinite loop in this way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2907 Since Viper macros are much more powerful than Vi's it is impossible to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2908 detect such loops. In practice, this is not really a limitation but,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2909 rather, a feature.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2911 We should also note that Vi macros are disabled in the Minibuffer, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2912 helps keep some potential troubles away.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2913
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2914 The rate at which the user must type keys in order for them to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2915 recognized as a timeout macro is controlled by the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2916 @code{vip-fast-keyseq-timeout}, which defaults to 200 milliseconds.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2917
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2918 For the most part, Viper macros defined in @file{~/.viper} can be shared
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2919 between Emacs, XEmacs, and X and TTY modes. However, macros defined via
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2920 function keys may need separate definitions when XEmacs and Emacs have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2921 different names for the same keyboard key. For instance, the `Page Up' key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2922 may be known in Emacs as @kbd{prior} and in XEmacs as @kbd{pgup}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2923 The problem with TTY may be that the function keys there generate sequences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924 of events instead of a single event (as under a window system).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 Both Emacs and XEmacs mape some of these sequences back to the logical keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 (e.g., the sequences generated by the arrow keys are mapped to @kbd{up},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927 @kbd{left}, etc.). However, not all function keys are mapped in this way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 Macros that are bound to key sequences that contain such unmapped function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929 keys have to be redefined for TTY's (and possibly for every type of TTY you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 may be using). To do this, start Emacs on an appropriate TTY device and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 define the macro using @kbd{:map}, as usual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933 @findex @code{vip-describe-kbd-macros}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 Finally, Viper provides a function that conveniently displays all macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 currently defined. To see all macros along with their definitions, type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 @kbd{M-x vip-describe-kbd-macros}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2938 @node Commands,,Customization,Top,Top
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2939 @chapter Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2940
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2941 This section is a semi-automatically bowdlerized version of the Vi
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2942 reference created by @* @samp{maart@@cs.vu.nl} and others. It can be
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2943 found on the Vi archives. This reference has been adapted for Viper.@refill
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2944
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2945 @menu
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2946 * Groundwork:: Textual Conventions and Viper basics
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2947 * Text Handling:: Moving, Editing, Undoing.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2948 * Display:: Scrolling.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2949 * File and Buffer Handling:: Editing, Writing and Quitting.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2950 * Mapping:: Mapping Keys, Keyboard Macros
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2951 * Shell Commands:: Accessing Shell Commands, Processing Text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2952 * Options:: Ex options, the @kbd{:set} commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2953 * Emacs Related Commands:: Meta Keys, Windows
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2954 * Mouse-bound Commands:: Search and insertion of text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2955 @end menu
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2956
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2957 @node Groundwork, Text Handling, Commands, Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2958 @comment node-name, next, previous, up
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2959 @section Groundwork
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2960
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2961 The VI command set is based on the idea of combining motion commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2962 with other commands. The motion command is used as a text region
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2963 specifier for other commands.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2964 We classify motion commands into @dfn{point commands} and
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2965 @dfn{line commands}.@refill
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2966
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2967 @cindex point commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2968
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2969 The point commands are:
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2970
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2971 @quotation
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2972 @kbd{h}, @kbd{l}, @kbd{0}, @kbd{$}, @kbd{w}, @kbd{W}, @kbd{b}, @kbd{B},
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2973 @kbd{e}, @kbd{E}, @kbd{(}, @kbd{)}, @kbd{/}, @kbd{?}, @kbd{`}, @kbd{f},
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2974 @kbd{F}, @kbd{t}, @kbd{T}, @kbd{%}, @kbd{;}, @kbd{,}, @kbd{^}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2975 @end quotation
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2976
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2977 @cindex line commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2978
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2979 The line commands are:
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2980
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2981 @quotation
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2982 @kbd{j}, @kbd{k}, @kbd{+}, @kbd{-}, @kbd{H}, @kbd{M}, @kbd{L}, @kbd{@{},
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2983 @kbd{@}}, @kbd{G}, @kbd{'}, @kbd{[[}, @kbd{]]}, @kbd{[]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2984 @end quotation
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2985 @noindent
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2986
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2987 Text Deletion Commands (@xref{Deleting Text}), Change commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2988 (@xref{Changing Text}), even Shell Commands (@xref{Shell Commands})
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2989 use these commands to describe a region of text to operate on.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2990
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2991 @cindex r and R region specifiers
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2992
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2993 Viper adds two region descriptors, @kbd{r} and @kbd{R}. These describe
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2994 the Emacs regions (@xref{Basics}), but they are not movement commands.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2995
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2996 The command description uses angle brackets @samp{<>} to indicate
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2997 metasyntactic variables, since the normal conventions of using simple
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2998 text can be confusing with Viper where the commands themselves are
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
2999 characters. Watch out where @kbd{<} shift commands and @kbd{<count>} are
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3000 mentioned together!!!
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3001
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3002 @kindex <move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3003 @kindex <a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3004 @kindex <address>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3005 @cindex <move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3006 @cindex <a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3007 @cindex <address>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3008 @cindex movements
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3009
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3010 @samp{<move>} refers to the above movement commands, and @samp{<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3011 refers to registers or textmarkers from @samp{a} to @samp{z}. Note
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3012 that the @samp{<move>} is described by full move commands, that is to
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3013 say they will take counts, and otherwise behave like normal move commands.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3014 @cindex Ex addresses
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3015 @samp{<address>} refers to Ex line addresses, which include
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3016
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3017 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3018 @item . <No address>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3019 Current line
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3020 @item .+n .-n
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3021 Add or subtract for current line
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3022 @item number
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3023 Actual line number, use @kbd{.=} to get the line number
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3024 @item '<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3025 Textmarker
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3026 @item $
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3027 Last line
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3028 @item x,y
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3029 Where x and y are one of the above
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3030 @item %
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3031 @cindex % (Ex address)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3032 For the whole file, same as (1,$).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3033 @item /pat/
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3034 @item ?pat?
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3035 Next or previous line with pattern pat
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3036 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3037
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3038 @cindex % (Current file)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3039 Note that @samp{%} is used in Ex commands to mean current file. If you
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3040 want a @samp{%} in your command, it must be escaped as @samp{\%}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3041 @cindex # (Previous file)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3042 Similarly, @samp{#} expands to the previous file. The previous file is
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3043 the first file in @kbd{:args} listing. This defaults to previous window
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3044 in the VI sense if you have one window only.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3045
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3046 @kindex <args>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3047 @kindex <cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3048 @cindex <args>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3049 @cindex <cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3050 @noindent
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3051 Others like @samp{<args> -- arguments}, @samp{<cmd> -- command} etc.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3052 should be fairly obvious.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3053
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3054 @noindent
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3055 Common characters referred to include:
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3056
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3057 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3058 @item <sp>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3059 Space
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3060 @item <ht>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3061 Tab
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3062 @item <lf>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3063 Linefeed
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3064 @item <esc>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3065 Escape
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3066 @item <cr>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3067 Return, Enter
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3068 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3069 @cindex <cr>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3070 @cindex <esc>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3071 @cindex <lf>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3072 @cindex <ht>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3073 @cindex <sp>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3074
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3075 @cindex words
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3076 @cindex WORDS
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3077 @cindex char
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3078 @cindex CHAR
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3079
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3080 We also use @samp{word} for alphanumeric/non-alphanumeric words, and
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3081 @samp{WORD} for whitespace delimited words. @samp{char} refers to any
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3082 ASCII character, @samp{CHAR} to non-whitespace character.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3083 Brackets @samp{[]} indicate optional parameters; @samp{<count>} also
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3084 optional, usually defaulting to 1. Brackets are elided for
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3085 @samp{<count>} to eschew obfuscation.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3086
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3087 Viper's idea of Vi's words is slightly different from Vi. First, Viper
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3088 words understand Emacs symbol tables. Therefore, all symbols declared to be
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3089 alphanumeric in a symbol table can automatically be made part of the Viper
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3090 word. This is useful when, for instance, editing text containing European,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3091 Cyrillic, etc., letters.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3092
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3093 Second, Viper lets you depart from Vi's idea of a word by changing the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3094 value of @code{vip-syntax-preference}. By default, this variable is set to
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3095 @code{strict-vi}, which means that alphanumeric symbols are exactly as
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3096 in Vi.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3097 However, if the value is @code{reformed-vi} then alphanumeric
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3098 symbols will be those specified by the current Emacs syntax table (which
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3099 may be different for different major modes) plus the underscore symbol
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3100 @kbd{_}. The user can also specify the value @code{emacs}, which would
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3101 make Viper use exactly the Emacs notion of word. In particular, the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3102 underscore may not be part of a word. Finally, if
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3103 @code{vip-syntax-preference} is set to @code{extended}, Viper words would
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3104 consist of characters that are classified as alphanumeric @emph{or} as
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3105 parts of symbols. This is convenient for writing programs and in many other
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3106 situations.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3107
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3108 @vindex @code{vip-syntax-preference}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3109 @cindex syntax table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3110
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3111 @code{vip-syntax-preference} is a local variable, so it can have different
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3112 values for different major modes. For instance, in programming modes it can
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3113 have the value @code{extended}. In text modes where words contain special
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3114 characters, such as European (non-English) letters, Cyrillic letters, etc.,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3115 the value can be @code{reformed-vi} or @code{emacs}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3116
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3117 Changes to @code{vip-syntax-preference} should be done in the hooks to
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3118 various major modes. Furthermore, for these changes to take effect, you
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3119 should execute @code{(vip-update-alphanumeric-class)} right after changing
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3120 the value of @code{vip-syntax-preference}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3121
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3122 The above discussion concerns only the movement commands. In regular
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3123 expressions, words remain the same as in Emacs. That is, the expressions
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3124 @code{\w}, @code{\>}, @code{\<}, etc., use Emacs' idea of what is a word,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3125 and they don't look into the value of variable
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3126 @code{vip-syntax-preference}. This is because Viper doesn't change syntax
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3127 tables in order to not thwart the various major modes that set these
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3128 tables.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3129
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3130 The usual Emacs convention is used to indicate Control Characters, i.e
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3131 C-h for Control-h. @emph{Do not confuse this to mean the separate
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3132 characters C - h!!!} The @kbd{^} is itself, never used to indicate a
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3133 Control character.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3134
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3135 @node Text Handling, Display, Groundwork, Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3136 @section Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3137
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3138 @menu
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3139 * Move Commands:: Moving, Searching
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3140 * Marking:: Textmarkers in Viper and the Emacs Mark.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3141 * Appending Text:: Text insertion, Shifting, Putting
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3142 * Editing in Insert State:: Autoindent, Quoting etc.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3143 * Deleting Text:: Deleting
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3144 * Changing Text:: Changing, Replacement, Joining
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3145 * Search and Replace:: Searches, Query Replace, Pattern Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3146 * Yanking:: Yanking, Viewing Registers
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3147 * Undoing:: Multiple Undo, Backups
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3148 @end menu
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3149
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3150 @node Move Commands,Marking,,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3151 @subsection Move Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3152
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3153 @cindex movement commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3154 @cindex searching
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3155 @cindex textmarkers
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3156 @cindex markers
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3157 @cindex column movement
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3158 @cindex paragraphs
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3159 @cindex headings
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3160 @cindex sections
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3161 @cindex sentences
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3162 @cindex matching parens
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3163 @cindex paren matching
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3164
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3165 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3166 @item <count> h C-h
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3167 <count> chars to the left.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3168 @item <count> j <lf> C-n
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3169 <count> lines downward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3170 @item <count> l <sp>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3171 <count> chars to the right.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3172 @item <count> k C-p
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3173 <count> lines upward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3174 @item <count> $
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3175 To the end of line <count> from the cursor.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3176 @item <count> ^
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3177 To the first CHAR <count> - 1 lines lower.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3178 @item <count> -
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3179 To the first CHAR <count> lines higher.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3180 @item <count> + <cr>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3181 To the first CHAR <count> lines lower.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3182 @item 0
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3183 To the first char of the line.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3184 @item <count> |
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3185 To column <count>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3186 @item <count> f<char>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3187 <count> <char>s to the right (find).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3188 @item <count> t<char>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3189 Till before <count> <char>s to the right.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3190 @item <count> F<char>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3191 <count> <char>s to the left.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3192 @item <count> T<char>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3193 Till after <count> <char>s to the left.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3194 @item <count> ;
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3195 Repeat latest @kbd{f t F T} <count> times.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3196 @item <count> ,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3197 Repeat latest @kbd{f t F T}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3198 <count> times in opposite direction.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3199 @item <count> w
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3200 <count> words forward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3201 @item <count> W
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3202 <count> WORDS forward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3203 @item <count> b
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3204 <count> words backward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3205 @item <count> B
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3206 <count> WORDS backward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3207 @item <count> e
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3208 To the end of word <count> forward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3209 @item <count> E
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3210 To the end of WORD <count> forward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3211 @item <count> G
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3212 Go to line <count> (default end-of-file).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3213 @item <count> H
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3214 To line <count> from top of the screen (home).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3215 @item <count> L
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3216 To line <count> from bottom of the screen (last).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3217 @item M
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3218 To the middle line of the screen.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3219 @item <count> )
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3220 <count> sentences forward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3221 @item <count> (
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3222 <count> sentences backward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3223 @item <count> @}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3224 <count> paragraphs forward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3225 @item <count> @{
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3226 <count> paragraphs backward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3227 @item <count> ]]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3228 To the <count>th heading.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3229 @item <count> [[
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3230 To the <count>th previous heading.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3231 @item <count> []
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3232 To the end of <count>th heading.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3233 @item m<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3234 Mark the cursor position with a letter.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3235 @item `<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3236 To the mark.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3237 @item '<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3238 To the first CHAR of the line with the mark.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3239 @item [<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3240 Show contents of textmarker.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3241 @item ]<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3242 Show contents of register.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3243 @item ``
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3244 To the cursor position before the latest absolute
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3245 jump (of which are examples @kbd{/} and @kbd{G}).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3246 @item ''
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3247 To the first CHAR of the line on which the cursor
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3248 was placed before the latest absolute jump.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3249 @item <count> /<string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3250 To the <count>th occurrence of <string>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3251 @item <count> /<cr>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3252 To the <count>th occurrence of <string> from previous @kbd{/ or ?}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3253 @item <count> ?<string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3254 To the <count>th previous occurrence of <string>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3255 @item <count> ?<cr>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3256 To the <count>th previous occurrence of <string> from previous @kbd{? or /}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3257 @item n
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3258 Repeat latest @kbd{/} @kbd{?} (next).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3259 @item N
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3260 Repeat latest search in opposite direction.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3261 @item C-c /
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3262 Without a prefix argument, this command toggles
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3263 case-sensitive/case-insensitive search modes and plain vanilla/regular
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3264 expression search. With the prefix argument 1, i.e.,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3265 @kbd{1 C-c /}, this toggles case-sensitivity; with the prefix argument 2,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3266 toggles plain vanilla search and search using
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3267 regular expressions. @xref{Viper Specials}, for alternative ways to invoke
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3268 this function.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3269 @cindex vanilla search
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3270 @cindex case-sensitive search
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3271 @cindex case-insensitive search
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3272 @item %
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3273 Find the next bracket/parenthesis/brace and go to its match.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3274 By default, Viper ignores brackets/parentheses/braces that occur inside
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3275 parentheses. You can change this by setting
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3276 @code{vip-parse-sexp-ignore-comments} to nil in your @file{.viper} fipe.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3277 This option can also be toggled interactively if you quickly hit @kbd{%%%}.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3278
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3279 This latter feature is implemented as a vi-style keyboard macro. If you
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3280 don't want this macro, put
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3281
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3282 @example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3283 (vip-set-parsing-style-toggling-macro 'undefine)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3284 @end example
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3285 @findex @code{vip-set-parsing-style-toggling-macro}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3286
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3287 in your @file{~/.viper} file.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3288
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3289 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3290 @kindex @kbd{%}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3291 @kindex @kbd{C-c /}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3292 @kindex @kbd{N}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3293 @kindex @kbd{n}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3294 @kindex @kbd{?<cr>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3295 @kindex @kbd{/<cr>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3296 @kindex @kbd{?<string>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3297 @kindex @kbd{/<string>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3298 @kindex @kbd{''}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3299 @kindex @kbd{``}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3300 @kindex @kbd{]<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3301 @kindex @kbd{[<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3302 @kindex @kbd{'<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3303 @kindex @kbd{`<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3304 @kindex @kbd{m<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3305 @kindex @kbd{[]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3306 @kindex @kbd{[[}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3307 @kindex @kbd{]]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3308 @kindex @kbd{@{}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3309 @kindex @kbd{@}}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3310 @kindex @kbd{(}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3311 @kindex @kbd{)}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3312 @kindex @kbd{M}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3313 @kindex @kbd{L}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3314 @kindex @kbd{H}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3315 @kindex @kbd{G}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3316 @kindex @kbd{E}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3317 @kindex @kbd{e}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3318 @kindex @kbd{B}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3319 @kindex @kbd{b}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3320 @kindex @kbd{W}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3321 @kindex @kbd{w}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3322 @kindex @kbd{,}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3323 @kindex @kbd{;}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3324 @kindex @kbd{T<char>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3325 @kindex @kbd{F<char>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3326 @kindex @kbd{t<char>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3327 @kindex @kbd{f<char>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3328 @kindex @kbd{|}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3329 @kindex @kbd{0}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3330 @kindex @kbd{<cr>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3331 @kindex @kbd{+}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3332 @kindex @kbd{-}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3333 @kindex @kbd{^}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3334 @kindex @kbd{$}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3335 @kindex @kbd{C-p}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3336 @kindex @kbd{<lf>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3337 @kindex @kbd{<sp>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3338 @kindex @kbd{C-n}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3339 @kindex @kbd{C-h}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3340 @kindex @kbd{h}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3341 @kindex @kbd{j}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3342 @kindex @kbd{k}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3343 @kindex @kbd{l}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3344 @vindex @code{vip-parse-sexp-ignore-comments}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3345
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3346 @node Marking,Appending Text,Move Commands,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3347 @subsection Marking
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3348
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3349 Emacs mark is referred to in the region specifiers @kbd{r} and @kbd{R}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3350 @xref{Emacs Preliminaries} and @pxref{Basics} for explanation. Also
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3351 see @ref{Mark,,Mark,emacs,The GNU Emacs manual}, for an explanation of
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3352 the Emacs mark ring.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3353
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3354 @cindex marking
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3355
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3356 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3357 @item m<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3358 Mark the current file and position with the specified letter.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3359 @item m .
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3360 Set the Emacs mark (@xref{Emacs Preliminaries}) at point.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3361 @item m <
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3362 Set the Emacs mark at beginning of buffer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3363 @item m >
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3364 Set the Emacs mark at end of buffer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3365 @item m ,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3366 Jump to the Emacs mark.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3367 @item :mark <char>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3368 Mark position with text marker named <char>. This is an Ex command.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3369 @item :k <char>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3370 Same as @kbd{:mark}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3371 @item ``
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3372 Exchange point and mark.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3373 @item ''
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3374 Exchange point and mark and go to the first CHAR on line.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3375 @item '<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3376 Go to specified Viper mark.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3377 @item
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3378 Go to specified Viper mark and go to the first CHAR on line.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3379 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3380 @kindex @kbd{m<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3381 @kindex @kbd{m.}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3382 @kindex @kbd{m>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3383 @kindex @kbd{m<}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3384 @kindex @kbd{m,}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3385 @findex @kbd{:mark}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3386 @findex @kbd{:k}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3387 @kindex @kbd{''}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3388 @kindex @kbd{``}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3389 @kindex @kbd{`<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3390 @kindex @kbd{'<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3391
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3392 @node Appending Text, Editing in Insert State, Marking,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3393 @subsection Appending Text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3394
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3395 @xref{Options} to see how to change tab and shiftwidth size. See the GNU
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3396 Emacs manual, or try @kbd{C-ha tabs} (If you have turned Emacs help on).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3397 Check out the variable @code{indent-tabs-mode} to put in just spaces.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3398 Also see options for word-wrap.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3399
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3400 @cindex inserting
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3401 @cindex appending
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3402 @cindex paste
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3403 @cindex put
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3404
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3405 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3406 @item <count> a
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3407 <count> times after the cursor.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3408 @item <count> A
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3409 <count> times at the end of line.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3410 @item <count> i
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3411 <count> times before the cursor (insert).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3412 @item <count> I
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3413 <count> times before the first CHAR of the line
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3414 @item <count> o
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3415 On a new line below the current (open).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3416 The count is only useful on a slow terminal.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3417 @item <count> O
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3418 On a new line above the current.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3419 The count is only useful on a slow terminal.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3420 @item <count> ><move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3421 Shift the lines described by <count><move> one
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3422 shiftwidth to the right (layout!).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3423 @item <count> >>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3424 Shift <count> lines one shiftwidth to the right.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3425 @item <count> ["<a-z1-9>]p
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3426 Put the contents of the (default undo) buffer
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3427 <count> times after the cursor. The register will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3428 be automatically downcased.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3429 @item <count> ["<a-z1-9>]P
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3430 Put the contents of the (default undo) buffer
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3431 <count> times before the cursor. The register will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3432 @item [<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3433 Show contents of textmarker.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3434 @item ]<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3435 Show contents of register.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3436 @item <count> .
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3437 Repeat previous command <count> times. For destructive
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3438 commands as well as undo.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3439 @item f1 1 and f1 2
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3440 While @kbd{.} repeats the last destructive command,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3441 these two macros repeat the second-last and the third-last destructive
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3442 commands. @xref{Vi Macros}, for more information on Vi macros.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3443 @item C-c M-p and C-c M-n
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3444 In Vi state,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3445 these commands help peruse the history of Vi's destructive commands.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3446 Successive typing of @kbd{C-c M-p} causes Viper to search the history in
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3447 the direction
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3448 of older commands, while hitting @kbd{C-c M-n} does so in reverse
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3449 order. Each command in the history is displayed in the Minibuffer. The
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3450 displayed command can
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3451 then be executed by typing `@kbd{.}'.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3452
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3453 Since typing the above sequences of keys may be tedious, the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3454 functions doing the perusing can be bound to unused keyboard keys in the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3455 @file{~/.viper} file. @xref{Viper Specials}, for details.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3456 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3457 @kindex @kbd{C-c M-p}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3458 @kindex @kbd{C-c M-n}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3459 @kindex @kbd{.}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3460 @kindex @kbd{]<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3461 @kindex @kbd{[<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3462 @kindex @kbd{P}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3463 @kindex @kbd{p}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3464 @kindex @kbd{"<a-z1-9>p}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3465 @kindex @kbd{"<a-z1-9>P}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3466 @kindex @kbd{>>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3467 @kindex @kbd{><move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3468 @kindex @kbd{O}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3469 @kindex @kbd{o}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3470 @kindex @kbd{i}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3471 @kindex @kbd{A}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3472 @kindex @kbd{a}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3473
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3474 @node Editing in Insert State, Deleting Text, Appending Text,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3475 @subsection Editing in Insert State
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3476
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3477 Minibuffer can be edited similarly to Insert state, and you can switch
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3478 between Insert/Replace/Vi states at will.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3479 Some users prefer plain Emacs feel in the Minibuffer. To this end, set
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3480 @var{vip-vi-style-in-minibuffer} to @code{nil}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3481
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3482 @cindex Insert state
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3483
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3484 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3485 @item C-v
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3486 Deprive the next char of its special meaning (quoting).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3487 @item C-h
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3488 One char back.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3489 @item C-w
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3490 One word back.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3491 @item C-u
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3492 Back to the begin of the change on the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3493 current line.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3494
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3495 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3496 @kindex @kbd{C-u}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3497 @kindex @kbd{C-w}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3498 @kindex @kbd{C-v}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3499
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3500 @node Deleting Text, Changing Text, Editing in Insert State, Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3501 @subsection Deleting Text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3502
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3503
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3504 There is one difference in text deletion that you should be
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3505 aware of. This difference comes from Emacs and was adopted in Viper
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3506 because we find it very useful. In Vi, if you delete a line, say, and then
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3507 another line, these two deletions are separated and are put back
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3508 separately if you use the @samp{p} command. In Emacs (and Viper), successive
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3509 series of deletions that are @emph{not interrupted} by other commands are
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3510 lumped together, so the deleted text gets accumulated and can be put back
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3511 as one chunk. If you want to break a sequence of deletions so that the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3512 newly deleted text could be put back separately from the previously deleted
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3513 text, you should perform a non-deleting action, e.g., move the cursor one
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3514 character in any direction.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3515
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3516 @cindex shifting text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3517
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3518 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3519 @item <count> x
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3520 Delete <count> chars under and after the cursor.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3521 @item <count> X
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3522 Delete <count> chars before the cursor.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3523 @item <count> d<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3524 Delete from point to endpoint of <count><move>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3525 @item <count> dd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3526 Delete <count> lines.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3527 @item D
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3528 The rest of the line.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3529 @item <count> <<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3530 Shift the lines described by <count><move> one
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3531 shiftwidth to the left (layout!).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3532 @item <count> <<
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3533 Shift <count> lines one shiftwidth to the left.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3534 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3535 @kindex @kbd{<<}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3536 @kindex @kbd{<<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3537 @kindex @kbd{D}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3538 @kindex @kbd{dd}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3539 @kindex @kbd{d<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3540 @kindex @kbd{X}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3541 @kindex @kbd{x}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3542
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3543 @node Changing Text, Search and Replace, Deleting Text,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3544 @subsection Changing Text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3545
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3546 @cindex joining lines
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3547 @cindex changing case
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3548 @cindex quoting regions
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3549 @cindex substitution
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3550
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3551 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3552 @item <count> r<char>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3553 Replace <count> chars by <char> - no <esc>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3554 @item <count> R
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3555 Overwrite the rest of the line,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3556 appending change @var{count - 1} times.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3557 @item <count> s
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3558 Substitute <count> chars.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3559 @item <count> S
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3560 Change <count> lines.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3561 @item <count> c<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3562 Change from begin to endpoint of <count><move>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3563 @item <count> cc
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3564 Change <count> lines.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3565 @item <count> C
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3566 The rest of the line and <count> - 1 next lines.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3567 @item <count> =<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3568 Reindent the region described by move.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3569 @item <count> ~
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3570 Switch lower and upper cases.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3571 @item <count> J
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3572 Join <count> lines (default 2).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3573 @item :[x,y]s/<p>/<r>/<f>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3574 Substitute (on lines x through y) the pattern
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3575 <p> (default the last pattern) with <r>. Useful
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3576 flags <f> are @samp{g} for @samp{global} (i.e. change every
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3577 non-overlapping occurrence of <p>) and @samp{c} for
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3578 @samp{confirm} (type @samp{y} to confirm a particular
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3579 substitution, else @samp{n} ). Instead of @kbd{/} any
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3580 punctuation CHAR unequal to <space> <tab> and <lf> can be used as
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3581 delimiter.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3582 @item :[x,y]copy [z]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3583 Copy text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3584 @item :[x,y]t [z]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3585 Same as @kbd{:copy}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3586 @item :[x,y]move [z]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3587 Move text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3588 @item &
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3589 Repeat latest Ex substitute command, e.g.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3590 @kbd{:s/wrong/good}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3591 @item C-c /
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3592 Toggle case-sensitive search. With prefix argument, toggle vanilla/regular
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3593 expression search.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3594 @item #c<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3595 Change upper-case characters in the region to lower-case.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3596 @item #C<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3597 Change lower-case characters in the region to upper-case.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3598 @item #q<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3599 Insert specified string at the beginning of each line in the region
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3600 @item C-c M-p and C-c M-n
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3601 In Insert and Replace states, these keys are bound to commands that peruse
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3602 the history of the text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3603 previously inserted in other insert or replace commands. By repeatedly typing
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3604 @kbd{C-c M-p} or @kbd{C-c M-n}, you will cause Viper to
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3605 insert these previously used strings one by one.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3606 When a new string is inserted, the previous one is deleted.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3607
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3608 In Vi state, these keys are bound to functions that peruse the history of
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3609 destructive Vi commands.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3610 @xref{Viper Specials}, for details.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3611 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3612 @kindex @kbd{C-c M-p}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3613 @kindex @kbd{C-c M-n}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3614 @kindex @kbd{#q<move> }
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3615 @kindex @kbd{#C<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3616 @kindex @kbd{#c<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3617 @kindex @kbd{&}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3618 @findex @kbd{:substitute/<p>/<r>/<f>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3619 @findex @kbd{:s/<p>/<r>/<f>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3620 @findex @kbd{:copy [z]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3621 @findex @kbd{:t [z]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3622 @findex @kbd{:move [z]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3623 @kindex @kbd{J}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3624 @kindex @kbd{~}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3625 @kindex @kbd{=<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3626 @kindex @kbd{C}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3627 @kindex @kbd{cc}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3628 @kindex @kbd{c<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3629 @kindex @kbd{S}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3630 @kindex @kbd{s}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3631 @kindex @kbd{R}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3632 @kindex @kbd{r<char>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3633
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3634 @node Search and Replace, Yanking, Changing Text,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3635 @subsection Search and Replace
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3636
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3637 @xref{Groundwork}, for Ex address syntax. @xref{Options} to see how to
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3638 get literal (non-regular-expression) search and how to stop search from
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3639 wrapping around.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3640
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3641 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3642 @item <count> /<string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3643 To the <count>th occurrence of <string>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3644 @item <count> ?<string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3645 To the <count>th previous occurrence of <string>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3646 @item <count> g<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3647 Search for the text described by move. (off by default)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3648 @item n
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3649 Repeat latest @kbd{/} @kbd{?} (next).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3650 @item N
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3651 Idem in opposite direction.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3652 @item %
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3653 Find the next bracket and go to its match
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3654 @item :[x,y]g/<string>/<cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3655 @cindex text processing
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3656 Search globally [from line x to y] for <string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3657 and execute the Ex <cmd> on each occurrence.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3658 @item :[x,y]v/<string>/<cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3659 Execute <cmd> on the lines that don't match.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3660 @item #g<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3661 Execute the last keyboard macro for each line in the region.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3662 @xref{Macros and Registers}, for more info.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3663 @item Q
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3664 Query Replace.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3665 @item :ta <name>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3666 Search in the tags file where <name> is defined (file, line), and go to it.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3667 @item :[x,y]s/<p>/<r>/<f>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3668 Substitute (on lines x through y) the pattern <p> (default the last
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3669 pattern) with <r>. Useful
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3670 flags <f> are @samp{g} for @samp{global} (i.e. change every
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3671 non-overlapping occurrence of <p>) and @samp{c} for
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3672 @samp{confirm} (type @samp{y} to confirm a particular
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3673 substitution, else @samp{n}). Instead of @kbd{/} any
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3674 punctuation character other than <space> <tab> and <lf> can be used as
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3675 delimiter.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3676 @item &
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3677 Repeat latest Ex substitute command, e.g. @kbd{:s/wrong/good}.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3678 @item :global /<pattern>/<ex-command>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3679 @itemx :g /<pattern>/<ex-command>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3680 Execute <ex-command> on all lines that match <pattern>.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3681 @item :vglobal /<pattern>/<ex-command>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3682 @itemx :v /<pattern>/<ex-command>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3683 Execute <ex-command> on all lines that do not match <pattern>.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3684 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3685 @kindex @kbd{&}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3686 @findex @kbd{:substitute/<p>/<r>/<f>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3687 @kindex @kbd{Q}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3688 @kindex @kbd{#g<move>}
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3689 @findex @kbd{:v}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3690 @findex @kbd{:g}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3691 @findex @kbd{:global}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3692 @findex @kbd{:vglobal}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3693 @findex @kbd{:tag <name>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3694 @kindex @kbd{%}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3695 @kindex @kbd{N}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3696 @kindex @kbd{n}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3697 @kindex @kbd{g<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3698 @kindex @kbd{?<string>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3699 @kindex @kbd{/<string>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3700
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3701 @node Yanking,Undoing,Search and Replace,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3702 @subsection Yanking
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3703
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3704 @cindex cut and paste
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3705 @cindex paste
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3706
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3707 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3708 @item <count> y<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3709 Yank from begin to endpoint of <count><move>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3710 @item <count> "<a-z>y<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3711 Yank from begin to endpoint of <count><move> to register.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3712 @item <count> "<A-Z>y<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3713 Yank from begin to endpoint of <count><move> and append
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3714 to register.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3715 @item <count> yy
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3716 <count> lines.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3717 @item <count> Y
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3718 Idem (should be equivalent to @kbd{y$} though).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3719 @item m<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3720 Mark the cursor position with a letter.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3721 @item [<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3722 Show contents of textmarker.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3723 @item ]<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3724 Show contents of register.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3725 @item <count> ["<a-z1-9>]p
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3726 Put the contents of the (default undo) buffer
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3727 <count> times after the cursor. The register will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3728 be automatically downcased.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3729 @item <count> ["<a-z1-9>]P
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3730 Put the contents of the (default undo) buffer
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3731 <count> times before the cursor. The register will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3732 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3733 @kindex @kbd{P}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3734 @kindex @kbd{p}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3735 @kindex @kbd{"<a-z1-9>p}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3736 @kindex @kbd{"<a-z1-9>P}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3737 @kindex @kbd{]<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3738 @kindex @kbd{[<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3739 @kindex @kbd{m<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3740 @kindex @kbd{Y}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3741 @kindex @kbd{yy}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3742 @kindex @kbd{"<A-Z>y<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3743 @kindex @kbd{"<a-z>y<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3744 @kindex @kbd{y<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3745 @kindex @kbd{yank}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3746 @findex @kbd{:yank}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3747
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3748 @node Undoing,, Yanking,Text Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3749 @subsection Undoing
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3750
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3751 @cindex undo
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3752 @cindex backup files
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3753
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3754 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3755 @item u U
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3756 Undo the latest change.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3757 @item .
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3758 Repeat undo.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3759 @item :q!
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3760 Quit Vi without writing.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3761 @item :e!
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3762 Re-edit a messed-up file.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3763 @item :rec
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3764 Recover file from autosave. Viper also creates backup files
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3765 that have a @samp{~} appended to them.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3766 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3767 @findex @kbd{:rec}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3768 @findex @kbd{:e!}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3769 @findex @kbd{:q!}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3770 @kindex @kbd{.}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3771 @kindex @kbd{U}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3772 @kindex @kbd{u}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3773
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3774 @node Display, File and Buffer Handling, Text Handling, Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3775 @section Display
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3776
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3777 @cindex scrolling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3778
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3779 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3780 @item C-g
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3781 At user level 1,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3782 give file name, status, current line number
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3783 and relative position. @*
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3784 At user levels 2 and higher, abort the current command.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3785 @item C-c g
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3786 Give file name, status, current line number and relative position -- all
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3787 user levels.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3788 @item C-l
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3789 Refresh the screen.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3790 @item <count> C-e
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3791 Expose <count> more lines at bottom, cursor stays put (if possible).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3792 @item <count> C-y
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3793 Expose <count> more lines at top, cursor stays put (if possible).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3794 @item <count> C-d
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3795 Scroll <count> lines downward (default the number of the previous scroll;
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3796 initialization: half a page).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3797 @item <count> C-u
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3798 Scroll <count> lines upward (default the number of the previous scroll;
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3799 initialization: half a page).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3800 @item <count> C-f
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3801 <count> pages forward.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3802 @item <count> C-b
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3803 <count> pages backward (in older versions @kbd{C-b} only works without count).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3804 @item <count> z<cr>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3805 @item zH
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3806 Put line <count> at the top of the window (default the current line).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3807 @item <count> z-
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3808 @item zL
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3809 Put line <count> at the bottom of the window
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3810 (default the current line).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3811 @item <count> z.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3812 @item zM
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3813 Put line <count> in the center of the window
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3814 (default the current line).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3815 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3816 @kindex @kbd{zM}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3817 @kindex @kbd{zL}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3818 @kindex @kbd{zH}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3819 @kindex @kbd{z<cr>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3820 @kindex @kbd{z.}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3821 @kindex @kbd{z-}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3822 @kindex @kbd{z<cr>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3823 @kindex @kbd{C-b}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3824 @kindex @kbd{C-f}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3825 @kindex @kbd{C-u}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3826 @kindex @kbd{C-d}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3827 @kindex @kbd{C-y}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3828 @kindex @kbd{C-e}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3829 @kindex @kbd{C-l}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3830 @kindex @kbd{C-g}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3831
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3832
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3833 @node File and Buffer Handling, Mapping, Display,Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3834 @section File and Buffer Handling
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3835
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3836 @cindex multiple files
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3837
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3838 In all file handling commands, space should be typed before entering the file
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3839 name. If you need to type a modifier, such as @kbd{>>} or @kbd{!}, don't
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3840 put any space between the command and the modifier.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3841
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3842 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3843 @item :q
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3844 Quit buffer except if modified.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3845 @item :q!
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3846 Quit buffer without checking. In Viper, these two commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3847 are identical. Confirmation is required if exiting modified buffers that
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3848 visit files.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3849 @item :suspend
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3850 @item :stop
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3851 Suspend Viper
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3852 @item :[x,y] w
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3853 Write the file. Viper nakes sure that a final newline is always added to
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3854 any file where this newline is missing. This is done by setting Emacs
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3855 variable @code{require-final-newline} to @code{t}. If you don't like this
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3856 feature, use @code{setq-default} to set @code{require-final-newline} to
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3857 @code{nil}. This must be done in @file{.viper} file.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3858 @item :[x,y] w <name>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3859 Write to the file <name>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3860 @item :[x,y] w>> <name>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3861 Append the buffer to the file <name>. There should be no space between
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3862 @kbd{w} and @kbd{>>}. Type space after the @kbd{>>} and see what happens.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3863 @item :w! <name>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3864 Overwrite the file <name>. In Viper, @kbd{:w} and @kbd{:w!} are identical.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3865 Confirmation is required for writing to an existing file (if this is not
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3866 the file the buffer is visiting) or to a read-only file.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3867 @item :x,y w <name>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3868 Write lines x through y to the file <name>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3869 @item :wq
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3870 Write the file and kill buffer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3871 @item :r <file> [<file> ...]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3872 Read file into a buffer, inserting its contents after the current line.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3873 @item :xit
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3874 Same as @kbd{:wq}.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3875 @item :Write
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3876 @itemx :W
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3877 Save all unsaved buffers, asking for confirmation.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3878 @item :WWrite
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3879 @itemx :WW
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3880 Like @kbd{W}, but without asking for confirmation.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3881 @item ZZ
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3882 Save current buffer and kill it. If user level is 1, then save all files
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3883 and kill Emacs. Killing Emacs is the wrong way to use it, so you should
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3884 switch to higher user levels as soon as possible.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3885 @item :x [<file>]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3886 Save and kill buffer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3887 @item :x! [<file>]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3888 @kbd{:w![<file>]} and @kbd{:q}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3889 @item :pre
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3890 Preserve the file -- autosave buffers.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3891 @item :rec
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3892 Recover file from autosave.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3893 @item :f
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3894 Print file name and lines.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3895 @item :cd [<dir>]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3896 Set the working directory to <dir> (default home directory).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3897 @item :pwd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3898 Print present working directory.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3899 @item :e [+<cmd>] <files>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3900 Edit files. If no filename is given, edit the file visited by the current
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3901 buffer. If buffer was modified or the file changed on disk, ask for
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3902 confirmation. Unlike Vi, Viper allows @kbd{:e} to take multiple arguments.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3903 The first file is edited the same way as in Vi. The rest are visited
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3904 in the usual Emacs way.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3905 @item :e! [+<cmd>] <files>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3906 Re-edit file. If no filename, reedit current file.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3907 In Viper, unlike Vi, @kbd{e!} is identical to @kbd{:e}. In both cases, the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3908 user is asked to confirm if there is a danger of discarding changes to a
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3909 buffer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3910 @item :q!
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3911 Quit Vi without writing.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3912 @item C-^
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3913 Edit the alternate (normally the previous) file.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3914 @item :rew
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3915 Obsolete
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3916 @item :args
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3917 List files not shown anywhere with counts for next
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3918 @item :n [count] [+<cmd>] [<files>]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3919 Edit <count> file, or edit files. The count comes from :args.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3920 @item :N [count] [+<cmd>] [<files>]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3921 Like @kbd{:n}, but the meaning of the variable
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3922 @var{ex-cycle-other-window} is reversed.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3923 @item :b
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3924 Switch to another buffer. If @var{ex-cycle-other-window} is @code{t},
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3925 switch in another window. Buffer completion is supported.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3926 @item :B
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3927 Like @kbd{:b}, but the meaning of @var{ex-cycle-other-window} is reversed.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3928 @item :<address>r <name>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3929 Read the file <name> into the buffer after the line <address>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3930 @item v, V, C-v
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3931 Edit a file in current or another window, or in another frame. File name
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3932 is typed in Minibuffer. File completion and history are supported.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3933 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3934 @kindex @kbd{v}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3935 @kindex @kbd{V}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3936 @findex @kbd{:args}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3937 @findex @kbd{:rew}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3938 @kindex @kbd{C-^}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3939 @findex @kbd{:e! [<files>]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3940 @findex @kbd{:e [<files>]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3941 @findex @kbd{:edit [<files>]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3942 @findex @kbd{:edit! [<files>]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3943 @findex @kbd{:q!}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3944 @findex @kbd{:q}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3945 @findex @kbd{:quit}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3946 @findex @kbd{:quit!}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3947 @findex @kbd{:f}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3948 @findex @kbd{:rec}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3949 @findex @kbd{:r}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3950 @findex @kbd{:read}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3951 @findex @kbd{:pre}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3952 @kindex @kbd{ZZ}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3953 @findex @kbd{:wq}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3954 @findex @kbd{:w <file>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3955 @findex @kbd{:w! <file>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3956 @findex @kbd{:w >> <file>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3957 @findex @kbd{:write <file>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3958 @findex @kbd{:write! <file>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3959 @findex @kbd{:write >> <file>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3960 @findex @kbd{:W}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3961 @findex @kbd{:WW}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3962 @findex @kbd{:Write}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3963 @findex @kbd{:WWrite}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3964 @findex @kbd{:WWrite}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3965 @findex @kbd{:x}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3966 @findex @kbd{:x!}
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
3967 @findex @kbd{:suspend}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3968 @findex @kbd{:stop}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3969 @findex @kbd{:n [<count> | <file>]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3970 @findex @kbd{:cd [<dir>]}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3971 @findex @kbd{:pwd}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3972
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3973 @node Mapping, Shell Commands, File and Buffer Handling, Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3974 @section Mapping
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3975
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3976 @cindex keybindings
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3977 @cindex keymapping
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3978
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3979 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3980 @item :map <string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3981 Start defining a Vi-style keyboard macro.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3982 For instance, typing
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3983 @kbd{:map www} followed by @kbd{:!wc %} and then typing @kbd{C-x )}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3984 will cause @kbd{www} to run wc on
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3985 current file (Vi replaces @samp{%} with the current file name).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3986 @item C-x )
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3987 Finish defining a keyboard macro.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3988 In Viper, this command completes the process of defining all keyboard
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3989 macros, whether they are Emacs-style or Vi-style.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3990 This is a departure from Vi, needed to allow WYSIWYG mapping of
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3991 keyboard macros and to permit the use of function keys and arbitrary Emacs
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3992 functions in the macros.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3993 @item :unmap <string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3994 Deprive <string> of its mappings in Vi state.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3995 @item :map! <string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3996 Map a macro for Insert state.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3997 @item :unmap! <string>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3998 Deprive <string> of its mapping in Insert state (see @kbd{:unmap}).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
3999 @item @@<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4000 In Vi state,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4001 execute the contents of register as a command.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4002 @item @@@@
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4003 In Vi state,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4004 repeat last register command.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4005 @item @@#
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4006 In Vi state,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4007 begin keyboard macro. End with @@<a-z>. This will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4008 put the macro in the proper register. Register will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4009 be automatically downcased.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4010 @xref{Macros and Registers}, for more info.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4011 @item @@!<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4012 In Vi state,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4013 yank anonymous macro to register
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4014 @item *
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4015 In Vi state,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4016 execute anonymous macro (defined by C-x( and C-x )).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4017 @item C-x e
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4018 Like @kbd{*}, but works in all Viper states.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4019 @item #g<move>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4020 Execute the last keyboard macro for each line in the region.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4021 @xref{Macros and Registers}, for more info.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4022 @item [<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4023 Show contents of textmarker.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4024 @item ]<a-z>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4025 Show contents of register.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4026 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4027 @kindex @kbd{]<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4028 @kindex @kbd{[<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4029 @kindex @kbd{#g<move>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4030 @kindex @kbd{*}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4031 @kindex @kbd{@@!<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4032 @kindex @kbd{@@#}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4033 @kindex @kbd{@@@@}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4034 @kindex @kbd{@@<a-z>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4035 @findex @kbd{:unmap <char>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4036 @findex @kbd{:map <char> <seq>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4037 @findex @kbd{:unmap! <char>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4038 @findex @kbd{:map! <char> <seq>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4039
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4040 @node Shell Commands, Options, Mapping, Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4041 @section Shell Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4042
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4043 @cindex % (Current file)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4044
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4045 Note that % is used in Ex commands to mean current file. If you want a %
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4046 in your command, it must be escaped as @samp{\%}.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4047 @cindex % (Ex address)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4048 However if % is the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4049 first character, it stands as the address for the whole file.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4050 @cindex # (Previous file)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4051 Similarly, @samp{#} expands to the previous file. The previous file is
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4052 the first file in @kbd{:args} listing. This defaults
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4053 to the previous file in the VI sense if you have one window.@refill
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4054
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4055 @cindex shell commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4056
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4057 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4058 @item :sh
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4059 Execute a subshell in another window
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4060 @item :[x,y]!<cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4061 Execute a shell <cmd> [on lines x through y;
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4062 % is replace by current file, \% is changed to %
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4063 @item :[x,y]!! [<args>]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4064 Repeat last shell command [and append <args>].
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4065 @item :!<cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4066 Just execute command and display result in a buffer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4067 @item :!! <args>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4068 Repeat last shell command and append <args>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4069 @item <count> !<move><cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4070 The shell executes <cmd>, with standard
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4071 input the lines described by <count><move>,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4072 next the standard output replaces those lines
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4073 (think of @samp{cb}, @samp{sort}, @samp{nroff}, etc.).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4074 @item <count> !!<cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4075 Give <count> lines as standard input to the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4076 shell <cmd>, next let the standard output
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4077 replace those lines.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4078 @item :[x,y] w !<cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4079 Let lines x to y be standard input for <cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4080 (notice the <sp> between @kbd{w} and @kbd{!}).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4081 @item :<address>r !<cmd>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4082 Put the output of <cmd> after the line <address> (default current).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4083 @item :<address>r <name>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4084 Read the file <name> into the buffer after the line <address> (default
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4085 current).
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4086 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4087 @findex @kbd{:<address>r <name>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4088 @findex @kbd{:<address>r !<cmd>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4089 @findex @kbd{!<cmd>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4090 @findex @kbd{!!<cmd>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4091 @findex @kbd{!<move><cmd>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4092 @findex @kbd{:w !<cmd>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4093 @findex @kbd{:x,y w !<cmd>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4094 @findex @kbd{:!! <args>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4095 @findex @kbd{:!<cmd>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4096 @findex @kbd{:sh}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4097
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4098 @node Options,Emacs Related Commands,Shell Commands,Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4099 @section Options
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4100
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4101 @cindex Vi options
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4102
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4103 @table @kbd
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4104 @item autoindent
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4105 @itemx ai
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4106 @cindex autoindent
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4107 autoindent -- In append mode after a <cr> the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4108 cursor will move directly below the first
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4109 character on the previous line.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4110 This setting affects the current buffer only.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4111 @item autoindent-global
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4112 @itemx ai-global
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4113 Same as `autoindent', but affects all buffers.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4114 @item noautoindent
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4115 @itemx noai
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4116 Cancel autoindent.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4117 @item noautoindent-global
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4118 @itemx noai-g
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4119 Cancel autoindent-global.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4120 @item ignorecase
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4121 @itemx ic
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4122 @cindex case and searching
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4123 ignorecase -- No distinction between upper and lower cases when searching.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4124 @item noignorecase
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4125 @itemx noic
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4126 Cancel ignorecase.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4127 @item magic
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4128 @itemx ma
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4129 @cindex literal searching
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4130 Regular expressions used in searches; nomagic means no regexps.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4131 @item nomagic
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4132 @item noma
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4133 Cancel magic.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4134 @item readonly
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4135 @itemx ro
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4136 @cindex readonly files
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4137 readonly -- The file is not to be changed.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4138 If the user attempts to write to this file, confirmation will be requested.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4139 @item noreadonly
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4140 @itemx noro
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4141 Cancel readonly.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4142 @item shell=<string>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4143 @itemx sh=<string>
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4144 @cindex shell
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4145 shell -- The program to be used for shell escapes
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4146 (default @samp{$SHELL} (default @file{/bin/sh})).
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4147 @item shiftwidth=<count>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4148 @itemx sw=<count>
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4149 @cindex layout
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4150 @cindex shifting text
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4151 shiftwidth -- Gives the shiftwidth (default 8 positions).
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4152 @item showmatch
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4153 @itemx sm
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4154 @cindex paren matching
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4155 @cindex matching parens
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4156 showmatch -- Whenever you append a @kbd{)}, Vi shows
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4157 its match if it's on the same page; also with
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4158 @kbd{@{} and @kbd{@}}. If there's no match, Vi will beep.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4159 @item noshowmatch
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4160 @itemx nosm
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4161 Cancel showmatch.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4162 @item tabstop=<count>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4163 @itemx ts=<count>
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4164 @cindex changing tab width
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4165 @cindex tabbing
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4166 tabstop -- The length of a <ht>; warning: this is
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4167 only IN the editor, outside of it <ht>s have
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4168 their normal length (default 8 positions).
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4169 This setting affects the current buffer only.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4170 @item tabstop-global
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4171 @itemx ts-g
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4172 Same as `tabstop', but affects all buffers.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4173 @item wrapmargin=<count>
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4174 @itemx wm=<count>
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4175 @cindex auto fill
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4176 @cindex word wrap
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4177 wrapmargin -- In append mode Vi automatically
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4178 puts a <lf> whenever there is a <sp> or <ht>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4179 within <wm> columns from the right margin.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4180 @item wrapscan
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4181 @itemx ws
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4182 @cindex searching
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4183 wrapscan -- When searching, the end is
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4184 considered @samp{stuck} to the begin of the file.
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4185 @item nowrapscan
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4186 @itemx nows
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4187 Cancel wrapscan.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4188 @item :set <option>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4189 Turn <option> on.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4190 @item :set no<option>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4191 Turn <option> off.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4192 @item :set <option>=<value>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4193 Set <option> to <value>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4194 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4195 @findex @kbd{:set <option>=<value>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4196 @findex @kbd{:set no<option>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4197 @findex @kbd{:set <option>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4198 @findex @kbd{:set ws}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4199 @findex @kbd{:set wrapscan}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4200 @findex @kbd{:set wm=<count>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4201 @findex @kbd{:set wrapmargin=<count>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4202 @findex @kbd{:set ts=<count>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4203 @findex @kbd{:set tabstop=<count>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4204 @findex @kbd{:set tab-stop-local=<count>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4205 @findex @kbd{:set sm}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4206 @findex @kbd{:set showmatch}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4207 @findex @kbd{:set sw=<count>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4208 @findex @kbd{:set shiftwidth=<count>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4209 @findex @kbd{:set sh=<string>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4210 @findex @kbd{:set shell=<string>}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4211 @findex @kbd{:set ro}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4212 @findex @kbd{:set readonly}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4213 @findex @kbd{:set magic}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4214 @findex @kbd{:set ic}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4215 @findex @kbd{:set ignorecase}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4216 @findex @kbd{:set ai}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4217 @findex @kbd{:set autoindent}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4218
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4219 @node Emacs Related Commands,,Options,Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4220 @section Emacs Related Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4221
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4222 @table @kbd
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4223 @item C-\
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4224 Begin Meta command in Vi or Insert states. Most often used as C-\ x (M-x).
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4225 @item C-z
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4226 In Insert and Replace states, prepare Viper to accept the next command and
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4227 execute it as if Viper was in Vi state. Then return to Insert state.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4228
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4229 In Vi state, switch to Emacs state; in Emacs state, switch to Vi state.
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4230 @item C-c \
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4231 Switches to Vi state for the duration of a single command. Then goes back
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4232 to the original Viper state. Works from Vi, Insert, Replace, and Emacs states.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4233 @item C-x0
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4234 Close Window
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4235 @item C-x1
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4236 Close Other Windows
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4237 @item C-x2
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4238 Split Window
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4239 @item C-xo
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4240 Move among windows
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4241 @item C-xC-f
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4242 Emacs find-file, useful in Insert state
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4243 @item C-y
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4244 Put back the last killed text. Similar to Vi's @kbd{p}, but also works in
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4245 Insert and Replace state. This command doesn't work in Vi command state,
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4246 since this binding is taken for something else.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4247 @item M-y
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4248 Undoes the last @kbd{C-y} and puts another kill from the kill ring.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4249 Using this command, you can try may different kills until you find the one
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4250 you need.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4251 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4252 @kindex @kbd{M-y}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4253 @kindex @kbd{C-y}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4254 @kindex @kbd{C-xC-f}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4255 @kindex @kbd{C-xo}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4256 @kindex @kbd{C-x2}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4257 @kindex @kbd{C-x1}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4258 @kindex @kbd{C-x0}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4259 @kindex @kbd{C-z}
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4260 @kindex @kbd{C-\}
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4261 @kindex @kbd{C-c\}
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4262
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4263 @node Mouse-bound Commands,,,Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4264 @section Mouse-bound Commands
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4265
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4266 The following two mouse actions are normally bound to to special search and
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4267 insert commands in of Viper:
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4268
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4269 @table @kbd
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4270 @item S-mouse-1 (Emacs)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4271 @item meta button1up (XEmacs)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4272 Holding Shift (or Meta, if XEmacs) and clicking mouse button 1 will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4273 initiate search for
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4274 a region under the mouse pointer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4275 This command can take a prefix argument. Note: Viper sets this
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4276 binding only if this mouse action is not
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4277 already bound to something else.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4278 @xref{Viper Specials}, for more information.@refill
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4279
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4280 @item S-mouse-2 (Emacs)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4281 @item meta button2up (XEmacs)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4282 Holding Shift (or Meta, if XEmacs) and clicking button 2 of the mouse will
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4283 insert a region surrounding the mouse pointer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4284 This command can also take a prefix argument.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4285 Note: Viper sets this binding only if this mouse action is not
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4286 already bound to something else.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4287 @xref{Viper Specials}, for more details.@refill
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4288 @end table
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4289 @kindex @kbd{S-mouse-1}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4290 @kindex @kbd{S-mouse-2}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4291 @kindex @kbd{meta button1up}
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 155
diff changeset
4292 @kindex @kbd{meta button2up}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4294 @node Acknowledgments,,,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4295 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4296 @unnumbered Acknowledgments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4298 Viper, formerly known as VIP-19, was written by Michael Kifer. Viper is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4299 based on the original VIP package by Masahiko Sato and on its enhancement,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4300 VIP 4.4, by Aamod Sane. This manual is an adaptation of the manual for VIP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4301 4.4, which, in turn, was based on Sato's manual for VIP 3.5.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4303 Many contributors on the net pointed out bugs and suggested a number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4304 useful features. Here is a (hopefully) complete list of contributors:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4306 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4307 jjm@@hplb.hpl.hp.com (Jean-Jacques Moreau), jl@@cse.ogi.edu (John
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4308 Launchbury), rxga@@ulysses.att.com, jamesm@@bga.com (D.J. Miller II),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4309 ascott@@fws214.intel.com (Andy Scott), toma@@convex.convex.com,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4310 dave@@hellgate.utah.edu, cook@@biostat.wisc.edu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4311 (Tom Cook), lindstro@@biostat.wisc.edu (Mary Lindstrom),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4312 edmonds@@edmonds.home.cs.ubc.ca (Brian Edmonds), mveiga@@dit.upm.es
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4313 (Marcelino Veiga Tuimil), dwight@@toolucky.llnl.gov (Dwight Shih),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4314 phil_brooks@@MENTORG.COM (Phil Brooks), kin@@isi.com (Kin Cho),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4315 ahg@@panix.com (Al Gelders), dwallach@@cs.princeton.edu (Dan Wallach),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4316 hpz@@ibmhpz.aug.ipp-garching.mpg.de (Hans-Peter Zehrfeld),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4317 simonb@@prl.philips.co.uk (Simon Blanchard), Mark.Bordas@@East.Sun.COM
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4318 (Mark Bordas), gviswana@@cs.wisc.edu (Guhan Viswanathan),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4319 meyering@@comco.com (Jim Meyering), pfister@@cs.sunysb.edu (Hanspeter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4320 Pfister), amade@@diagram.fr (Paul-Bernard Amade),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4321 jackr@@dblues.engr.sgi.com (Jack Repenning),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4322 pogrell@@informatik.hu-berlin.de (Lutz Pogrell),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4323 csdayton@@midway.uchicago.edu (Soren Dayton),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4324 pradyut@@cs.uchicago.edu (Pradyut Shah),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4325 vrenjak@@sun1.racal.com (Milan Vrenjak),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4326 gvr@@halcyon.com (George V. Reilly),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4327 whicken@@dragon.parasoft.com (Wendell Hicken),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4328 terra@@diku.dk (Morten Welinder),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4329 kanze@@gabi-soft.fr (James Kanze),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4330 hatazaki@@bach.convex.com (Takao Hatazaki),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4331 sawdey@@lcse.umn.edu (Aaron Sawdey),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4332 jobrien@@hchp.org (John O'Brien),
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
4333 mrb@@Eng.Sun.COM (Martin Buchholz),
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
4334 kwzh@@gnu.ai.mit.edu (Karl Heuer),
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
4335 sudish@@MindSpring.COM (Sudish Joseph),
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 100
diff changeset
4336 paulk@@summit.esg.apertus.com (Paul Keusemann),
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4337 roderick@@argon.org (Roderick Schertler),
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 163
diff changeset
4338 johnw@@borland.com (John Wiegley)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4339 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4342 @node Key Index,Function Index,,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4343 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4344 @unnumbered Key Index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4346 @printindex ky
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4348 @node Function Index,Variable Index,Key Index,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4349 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4350 @unnumbered Function Index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4352 @printindex fn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4354 @node Variable Index,Package Index,Function Index,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4355 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4356 @unnumbered Variable Index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4358 @printindex vr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4360 @node Package Index,Concept Index,Variable Index,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4361 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4362 @unnumbered Package Index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4364 @printindex pg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4366 @node Concept Index,,Package Index,Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4367 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4368 @unnumbered Concept Index
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4370 @printindex cp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4372 @contents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4373 @bye