0
|
1 % -*-texinfo-*-
|
|
2
|
|
3 %
|
|
4 \input texinfo
|
|
5
|
|
6 @comment Using viper.info instead of viper in setfilename breaks DOS.
|
78
|
7 @setfilename viper
|
|
8 @comment @setfilename ../info/viper
|
0
|
9 @comment @setfilename viper.info
|
|
10
|
|
11 @iftex
|
|
12 @finalout
|
|
13 @end iftex
|
|
14
|
|
15 @titlepage
|
|
16 @title Viper Is a Package for Emacs Rebels
|
|
17 @subtitle a Vi emulator for GNU Emacs 19 and XEmacs 19
|
|
18 @subtitle June 1996, Viper Version 2.90
|
|
19
|
|
20 @author Masahiko Sato (VIP 3.5)
|
|
21 @author Aamod Sane (VIP 4.4)
|
|
22 @author Michael Kifer (Viper)
|
|
23
|
|
24 @page
|
|
25 @vskip 0pt plus 1fill
|
|
26 @end titlepage
|
|
27
|
|
28 @unnumbered Distribution
|
|
29
|
|
30 @noindent
|
|
31 Copyright @copyright{} 1995, 1996 Free Software Foundation, Inc.
|
|
32
|
|
33 Permission is granted to make and distribute verbatim copies of
|
|
34 this manual provided the copyright notice and this permission notice
|
|
35 are preserved on all copies.
|
|
36
|
|
37 @ignore
|
|
38 Permission is granted to process this file through TeX and print the
|
|
39 results, provided the printed document carries copying permission
|
|
40 notice identical to this one except for the removal of this paragraph
|
|
41 (this paragraph not being relevant to the printed manual).
|
|
42
|
|
43 @end ignore
|
|
44 Permission is granted to copy and distribute modified versions of this
|
|
45 manual under the conditions for verbatim copying, provided that the entire
|
|
46 resulting derived work is distributed under the terms of a permission
|
|
47 notice identical to this one.
|
|
48
|
|
49 Permission is granted to copy and distribute translations of this manual
|
|
50 into another language, under the same conditions as for modified versions.
|
|
51
|
|
52 @ifinfo
|
|
53 @node Top, Overview,, (DIR)
|
|
54
|
|
55 @unnumbered Viper
|
|
56
|
|
57 We believe that one or more of the following statements are adequate
|
|
58 descriptions:
|
|
59
|
|
60 @example
|
|
61 Viper Is a Package for Emacs Rebels;
|
|
62 it is a VI Plan for Emacs Rescue
|
|
63 and/or a venomous VI PERil.
|
|
64 @end example
|
|
65
|
|
66 Technically speaking, Viper is a Vi emulation package for GNU Emacs 19 and
|
|
67 XEmacs 19. Because of its reliance on minor mode keymaps, Viper will not
|
|
68 work under Emacs 18. Viper implements most Vi and Ex commands. It gives you
|
|
69 the best of both worlds: Vi keystrokes for editing combined with the GNU
|
|
70 Emacs environment. Viper also fixes some common complaints with Vi
|
|
71 commands. This manual describes Viper, concentrating on the differences
|
|
72 from Vi and new features of Viper.
|
|
73
|
|
74 Viper, formerly known as VIP-19, was written by Michael Kifer. It is based
|
|
75 on VIP version 3.5 by Masahiko Sato and VIP version 4.4 by Aamod Sane.
|
|
76 Viper tries to be compatible with these packages.
|
|
77
|
|
78 Viper is intended to be usable without reading this manual --- the defaults
|
|
79 are set to make Viper as close to Vi as possible. At startup, Viper will
|
|
80 try to set the most appropriate default environment for you, based on
|
|
81 your familiarity with Emacs. It will also tell you the basic GNU Emacs window
|
|
82 management commands to help you start immediately.
|
|
83
|
|
84 Although this manual explains how to customize Viper, some basic
|
|
85 familiarity with Emacs Lisp would be a plus.
|
|
86
|
|
87 It is recommended that you read the Overview node. The other nodes may
|
|
88 be visited as needed.
|
|
89
|
|
90 Comments and bug reports are welcome.
|
|
91 @code{kifer@@cs.emacs.edu} is the current address for Viper bug reports.
|
|
92 Please use the Ex command @kbd{:submitReport} for this purpose.@refill
|
|
93
|
|
94 @end ifinfo
|
|
95
|
|
96 @menu
|
|
97 * Overview:: Must read to get started
|
|
98 * Improvements over Vi:: New features, Improvements
|
|
99 * Customization:: How to customize Viper
|
|
100 * Commands:: Vi and Ex Commands
|
|
101
|
|
102 * Key Index:: Index of Vi and Ex Commands
|
|
103 * Function Index:: Index of Viper Functions
|
|
104 * Variable Index:: Index of Viper Variables
|
|
105 * Package Index:: Index of Packages Mentioned in this Document
|
|
106 * Concept Index:: Vi, Ex and Emacs concepts
|
|
107
|
|
108 * Acknowledgments::
|
|
109 @end menu
|
|
110 @iftex
|
|
111 @unnumbered Introduction
|
|
112
|
|
113 We believe that one or more of the following statements are adequate
|
|
114 descriptions:
|
|
115
|
|
116 @example
|
|
117 Viper Is a Package for Emacs Rebels;
|
|
118 it is a VI Plan for Emacs Rescue
|
|
119 and/or a venomous VI PERil.
|
|
120 @end example
|
|
121
|
|
122 Technically speaking, Viper is a Vi emulation package for GNU Emacs 19 and
|
|
123 XEmacs 19. Because of its reliance on minor mode keymaps,
|
|
124 it will not work under Emacs 18. Viper contains virtually all of
|
|
125 Vi and Ex functionality and much more. It gives you the best of both
|
|
126 worlds: Vi keystrokes for editing combined with the GNU Emacs
|
|
127 environment. Viper also fixes some common complaints with Vi commands.
|
|
128 This manual describes Viper, concentrating on the differences from Vi and
|
|
129 on the new features of Viper.
|
|
130
|
|
131 Viper, formerly known as VIP-19, was written by Michael Kifer. It is based
|
|
132 on VIP version 3.5 by Masahiko Sato and VIP version 4.4 by Aamod Sane.
|
|
133 Viper tries to be compatible with these packages.
|
|
134
|
|
135 Viper is intended to be usable without reading this manual --- the defaults
|
|
136 are set to make Viper as close to Vi as possible. At startup, Viper will
|
|
137 attempt to set the most appropriate default environment for you, based on
|
|
138 your familiarity with Emacs. It will also tell you the basic GNU Emacs window
|
|
139 management commands to help you start immediately.
|
|
140
|
|
141 Although this manual explains how to customize Viper, some basic
|
|
142 familiarity with Emacs Lisp would be a plus.
|
|
143
|
|
144 It is recommended that you read the chapter Overview. The other chapters
|
|
145 will be useful for customization and advanced usage.
|
|
146
|
|
147 You should also learn to use the Info on-line hypertext manual system that
|
|
148 comes with Emacs. This manual can be read as an Info file. Try the command
|
|
149 @kbd{ESC x info} with vanilla Emacs sometime.
|
|
150
|
|
151 Comments and bug reports are welcome.
|
|
152 @code{kifer@@cs.sunysb.edu} is the current address for Viper bug reports.
|
|
153 Please use the Ex command @kbd{:submitReport} for this purpose.@refill
|
|
154
|
|
155 @end iftex
|
|
156
|
|
157 @node Overview,Improvements over Vi,Top,Top
|
|
158 @chapter Overview of Viper
|
|
159
|
|
160 Viper is a Vi emulation on top of Emacs. At the same time, Viper provides a
|
|
161 virtually unrestricted access to Emacs facilities. Perfect compatibility
|
|
162 with Vi is possible but not desirable. This chapter tells you about the
|
|
163 Emacs ideas that you should know about, how to use Viper within Emacs and
|
|
164 some incompatibilities.
|
|
165
|
|
166 Viper was formerly known as VIP-19, which was
|
|
167 a descendant of VIP 3.5 by Masahiko Sato and VIP 4.4 by Aamod Sane.
|
|
168
|
|
169 @menu
|
|
170 * Emacs Preliminaries:: Basic concepts in Emacs.
|
|
171 * Loading Viper:: Loading and Preliminary Configuration.
|
|
172 * States in Viper:: Viper has four states orthogonal to
|
|
173 modes in Emacs.
|
|
174 * The Minibuffer:: Command line in Emacs.
|
|
175 * Multiple Files in Viper:: True multiple file handling.
|
|
176 * Unimplemented Features:: That are unlikely to be implemented.
|
|
177 @end menu
|
|
178
|
|
179 @node Emacs Preliminaries, Loading Viper, Overview, Overview
|
|
180 @section Emacs Preliminaries
|
|
181
|
|
182 @cindex buffer
|
|
183 @cindex point
|
|
184 @cindex mark
|
|
185 @cindex text
|
|
186 @cindex looking at
|
|
187 @cindex end (of buffer)
|
|
188 @cindex end (of line)
|
|
189 @cindex region
|
|
190
|
|
191 Emacs can edit several files at once. A file in Emacs is placed in a
|
|
192 @dfn{buffer} that usually has the same name as the file. Buffers are also used
|
|
193 for other purposes, such as shell interfaces, directory editing, etc.
|
|
194 @xref{Dired,,Directory Editor,emacs,The
|
|
195 Gnu Emacs Manual}, for an example.@refill
|
|
196
|
|
197 A buffer has a distinguished position called the @dfn{point}.
|
|
198 A @dfn{point} is always between 2 characters, and is @dfn{looking at}
|
|
199 the right hand character. The cursor is positioned on the right hand
|
|
200 character. Thus, when the @dfn{point} is looking at the end-of-line,
|
|
201 the cursor is on the end-of-line character, i.e. beyond the last
|
|
202 character on the line. This is the default Emacs behavior.@refill
|
|
203
|
|
204 The default settings of Viper try to mimic the behavior of Vi,
|
|
205 preventing the cursor from going beyond the last character on the line.
|
|
206 By using Emacs commands directly (such as those bound to arrow keys), it is
|
|
207 possible
|
|
208 to get the cursor beyond the end-of-line. However, this won't (or shouldn't)
|
|
209 happen if you restrict yourself to standard Vi keys, unless you modify the
|
|
210 default editing style. @xref{Customization}.@refill
|
|
211
|
|
212 In addition to the @dfn{point}, there is another distinguished buffer
|
|
213 position called the @dfn{mark}. @xref{Mark,,Mark,emacs,The GNU Emacs
|
|
214 manual}, for more info on the mark. The text between the @dfn{point} and the
|
|
215 @dfn{mark} is called the @dfn{region} of the buffer. For the Viper user,
|
|
216 this simply means that in addition to the Vi textmarkers a--z, there is
|
|
217 another marker called @dfn{mark}. This is similar to the unnamed Vi marker
|
|
218 used by the jump commands (`` and ''), which move the cursor to the
|
|
219 position of the last absolute jump.
|
|
220 Viper provides access to the region in most
|
|
221 text manipulation commands as @kbd{r} and @kbd{R} suffix to commands
|
|
222 that operate on text regions, e.g., @kbd{dr} to delete region, etc.
|
|
223 @xref{Basics}, for more info.@refill
|
|
224
|
|
225 @cindex window
|
|
226 @cindex mode line
|
|
227 @cindex buffer information
|
|
228 @cindex Minibuffer
|
|
229 @cindex command line
|
|
230 @cindex buffer (modified)
|
|
231
|
|
232 Emacs divides the screen into tiled @dfn{windows}. You can see the
|
|
233 contents of a buffer through the window associated with the buffer. The
|
|
234 cursor of the screen is positioned on the character after @dfn{point}.
|
|
235 Every window has a @dfn{mode line} that displays information about the buffer.
|
|
236 You can change the format of the mode
|
|
237 line, but normally if you see @samp{**} at the beginning of a mode line it
|
|
238 means that the buffer is @dfn{modified}. If you write out the contents of
|
|
239 a buffer to a file, then the buffer will become not modified. Also if
|
|
240 you see @samp{%%} at the beginning of the mode line, it means that the file
|
|
241 associated with the buffer is write protected. The mode line will also
|
|
242 show the buffer name and current major and minor modes (see below).
|
|
243 A special buffer called @dfn{Minibuffer} is displayed as the last line
|
|
244 in a Minibuffer window. The Minibuffer window is used for command input
|
|
245 output. Viper uses Minibuffer window for @kbd{/} and @kbd{:}
|
|
246 commands.@refill
|
|
247
|
|
248 @cindex mode
|
|
249 @cindex keymap
|
|
250 @cindex local keymap
|
|
251 @cindex global keymap
|
|
252 @cindex major mode
|
|
253 @cindex minor mode
|
|
254
|
|
255 An Emacs buffer can have a @dfn{major mode} that customizes Emacs for
|
|
256 editing text of a particular sort by changing the functionality of the keys.
|
|
257 Keys are defined using a @dfn{keymap} that records the bindings between
|
|
258 keystrokes and
|
|
259 functions. The @dfn{global keymap} is common to all the
|
|
260 buffers. Additionally, each buffer has its @dfn{local keymap} that determines the
|
|
261 @dfn{mode} of the buffer. If a function is bound to some key in the local
|
|
262 keymap then that function will be executed when you type the key.
|
|
263 If no function is bound to a key in the
|
|
264 local map, however, the function bound to the key in the global map
|
|
265 will be executed. @xref{Major Modes,Major Modes,Major Modes,emacs,The
|
|
266 GNU Emacs Manual}, for more information.@refill
|
|
267
|
|
268 A buffer can also have a @dfn{minor mode}. Minor modes are options that you
|
|
269 can use or not. A buffer in @code{text-mode} can have @code{auto-fill-mode}
|
|
270 as minor mode, which can be turned off or on at any time. In Emacs 19, a
|
|
271 minor mode may have it own keymap, which overrides the local keymap when
|
|
272 the minor mode is turned on. For more information, @pxref{Minor
|
|
273 Modes,Minor Modes,Minor Modes,emacs,The GNU Emacs Manual} @refill
|
|
274
|
|
275 @cindex Viper as minor mode
|
|
276 @cindex Control keys
|
|
277 @cindex Meta key
|
|
278
|
|
279 Viper is implemented as a collection of minor modes. Different minor modes
|
|
280 are involved when Viper emulates Vi command mode, Vi insert mode, etc.
|
|
281 You can also turn Viper on and off at any time while in Vi command mode.
|
|
282 @xref{States in Viper}, for
|
|
283 more information.@refill
|
|
284
|
|
285 Emacs uses Control and Meta modifiers. These are denoted as C
|
|
286 and M, e.g. @kbd{^Z} as @kbd{C-z} and @kbd{Meta-x} as @kbd{M-x}.
|
|
287 The Meta key is usually located on each side of the Space bar; it is used
|
|
288 in a manner similar to the Control key, e.g., @kbd{M-x} means typing
|
|
289 @kbd{x} while holding the Meta key down.
|
|
290 For keyboards that do not have a Meta key, @key{ESC} is used as Meta.
|
|
291 Thus @kbd{M-x} is typed as @kbd{ESC x}. Viper uses @key{ESC} to switch
|
78
|
292 from Insert state to Vi state. Therefore Viper defines @kbd{C-\} as its Meta
|
0
|
293 key in Vi state. @xref{Vi State}, for more info.@refill
|
|
294
|
|
295 Emacs is structured as a lisp interpreter around a C core. Emacs keys
|
|
296 cause lisp functions to be called. It is possible to call these
|
|
297 functions directly, by typing @kbd{M-x function-name}.
|
|
298
|
|
299 @node Loading Viper, States in Viper, Emacs Preliminaries, Overview
|
|
300 @section Loading Viper
|
|
301
|
|
302 First, make sure that all six Viper files @file{viper*.el} are somewhere on
|
|
303 Emacs @dfn{load path}. The load path is a list of directories where Emacs
|
|
304 looks for its Lisp code; it is similar to Unix environment variable
|
|
305 @var{PATH}. The load path is determined by the Lisp variable
|
|
306 @code{load-path}.
|
|
307
|
|
308 Type @code{C-h v load-path RET} to check the current load path of your
|
|
309 Emacs. (Here and later, @kbd{RET} stands for carriage return.) If the files
|
|
310 @file{viper*.el} are not in any directory on the load path, you should
|
|
311 create your own directory and put it on the load path; then put
|
|
312 @file{viper*.el} in that directory. To put a new directory, say
|
|
313 @file{~/emacslib}, on your load path, add the following line at the
|
|
314 beginning of your @file{~/.emacs} file:
|
|
315 @lisp
|
|
316 (setq load-path (cons "~/emacslib" load-path))
|
|
317 @end lisp
|
|
318 It is recommended that you compile @file{viper.el} by running
|
|
319 @example
|
|
320 make all
|
|
321 @end example
|
|
322 in the directory where Viper was unpacked. The best way to ensure that
|
|
323 Viper is installed properly is to run
|
|
324 @example
|
|
325 make install
|
|
326 @end example
|
|
327 in the directory where Viper was unpacked. See README in the Viper
|
|
328 distribution for the details on which modifications to the make file may be
|
|
329 necessary.
|
|
330
|
|
331 Once Viper is settled on the load path,
|
|
332 the most common way to load it automatically is to include the line:
|
|
333
|
|
334 @lisp
|
|
335 (require 'viper)
|
|
336 @end lisp
|
|
337
|
|
338 @noindent
|
|
339 in your @file{~/.emacs} file. The @file{.emacs} file is placed in your home
|
|
340 directory and it will be executed every time you invoke Emacs.
|
|
341 Viper also uses the file @file{~/.vip} for Viper-specific customization.
|
|
342 If you wish
|
|
343 to be in Vi command state whenever this is appropriate, you can include the
|
|
344 following
|
|
345 line in your @file{.vip}:
|
|
346 @lisp
|
|
347 (setq vip-always t)
|
|
348 @end lisp
|
|
349 @noindent
|
|
350 (@xref{Vi State}, for the explanation of Vi mode.)
|
|
351
|
|
352 Once invoked, Viper will arrange to bring up Emacs buffers in Vi state
|
|
353 whenever this makes sense.
|
|
354 @xref{Packages that Change Keymaps}, to find out when forcing Vi command state
|
|
355 on a buffer may be counter-productive.
|
|
356
|
|
357 Even if your @file{.emacs} and @file{.vip} files do not contain any of the
|
|
358 above lines, you can still load Viper and enter Vi state by typing the
|
|
359 following from within Emacs:
|
|
360
|
|
361 @lisp
|
|
362 M-x load-library RET viper RET
|
|
363 M-x viper-mode
|
|
364 @end lisp
|
|
365
|
|
366 @noindent
|
|
367 Ask your local Emacs administrator if this fails to work.
|
|
368
|
|
369 When Emacs first comes up, if you have not specified a file on the
|
|
370 command line, it will show the @samp{*scratch*} buffer, in the
|
|
371 @samp{Lisp Interaction} mode. After you invoke Viper, you can start
|
|
372 editing files by using @kbd{:e}, @kbd{:vi}, or @kbd{v} commands.
|
|
373 (@xref{File and Buffer Handling}, for more information on @kbd{v} and other
|
|
374 new commands that, in many cases, are more convenient than @kbd{:e},
|
|
375 @kbd{:vi}, and similar old-style Vi commands.)@refill
|
|
376
|
|
377 @node States in Viper, The Minibuffer, Loading Viper,Overview
|
|
378 @section States in Viper
|
|
379
|
|
380 @kindex @kbd{C-z}
|
|
381 @kindex @kbd{ESC}
|
|
382 @kindex @kbd{i}
|
|
383 @cindex Emacs state
|
|
384 @cindex Vi state
|
|
385 @cindex Insert state
|
|
386 @cindex Replace state
|
|
387 @cindex Ex commands
|
|
388
|
|
389 Viper has four states, Emacs, Vi, Insert, and Replace.
|
|
390
|
|
391 @table @samp
|
|
392 @item Emacs state
|
|
393 This is the mode plain vanilla Emacs is normally in. After you have loaded
|
|
394 Viper, @kbd{C-z} will normally take you to Vi command state. Another
|
|
395 @kbd{C-z} will take you back to Emacs state. This toggle key can be
|
|
396 changed, @pxref{Customization} You can also type @kbd{M-x viper-mode} to
|
|
397 change to Vi state.@refill
|
|
398
|
|
399 For users who chose to set their user level to 1 at Viper setup time,
|
|
400 switching to Emacs state is deliberately made harder in order to not
|
|
401 confuse the novice user. In this case, @kbd{C-z} will either iconify Emacs
|
|
402 (if Emacs runs as an application under X Windows) or it will stop Emacs (if
|
|
403 Emacs runs on a dumb terminal or in an Xterm window).
|
|
404
|
|
405 @item Vi state
|
|
406 This is the Vi command mode. Any of the Vi commands, such as @kbd{i, o, a},
|
|
407 @dots{}, will take you to Insert state. All Vi commands may
|
|
408 be used in this mode. Most Ex commands can also be used.
|
|
409 For a full list of Ex commands supported by Viper, type
|
|
410 @kbd{:} and then @kbd{TAB}. To get help on any issue, including the Ex
|
|
411 commands, type @kbd{:help}. This will invoke Viper Info
|
|
412 (if it is installed). Then typing @kbd{i} will prompt you for a topic to
|
|
413 search in the index. Note, to search for Ex commands in the index, you
|
|
414 should start them with a ``@kbd{:}'', e.g., @kbd{:WW}.
|
|
415
|
|
416 @item Insert state
|
|
417 Insert state is the Vi insertion mode. @kbd{ESC} will take you back to
|
|
418 Vi state. Insert state editing can be done, including auto-indentation. By
|
|
419 default, Viper disables Emacs keybindings in Insert state.
|
|
420
|
|
421 @item Replace state
|
|
422 Commands like @kbd{cw} invoke the Replace state. When you cross the
|
|
423 boundary of a replacement region (usually designated via a @samp{$} sign),
|
|
424 it will automatically change to Insert state. You do not have to worry
|
|
425 about it. The key bindings remain practically the same as in Insert
|
|
426 state. If you type ESC, Viper will switch to Vi command mode, terminating the
|
|
427 replacement state. @refill
|
|
428 @end table
|
|
429
|
|
430 @cindex mode line
|
|
431
|
|
432 The modes are indicated on the @dfn{mode line} as <E>, <I>, <V>, and <R>,
|
|
433 so that the multiple modes do not confuse you. Most of your editing can be
|
|
434 done in Vi and Insert states. Viper will try to make all new buffers be in Vi
|
|
435 state, but sometimes they may come up in Emacs state. @kbd{C-z}
|
|
436 will take you to Vi state in such a case. In some major modes, like Dired,
|
|
437 Info, Gnus, etc., you should not switch to Vi state (and Viper will not
|
|
438 attempt to do so) because these modes are not intended for text editing and
|
|
439 many of the Vi keys have special meaning there. If you plan to read news,
|
|
440 browse directories, read mail, etc., from Emacs (which you should start
|
|
441 doing soon!), you should learn about the meaning of the various keys in
|
|
442 those special modes (typing @kbd{C-h m} in a buffer provides
|
|
443 help with key bindings for the major mode of that buffer).
|
|
444
|
78
|
445 If you switch to Vi in Dired or similar modes---no harm is done. It is just
|
|
446 that the special keybindings provided by those modes will be temporarily
|
|
447 overshadowed by Viper's bindings. Switching back to Viper's Emacs state
|
|
448 will revive the environment provided by the current major mode.
|
0
|
449
|
|
450 States in Viper are orthogonal to Emacs major modes, such as C mode or Dired
|
|
451 mode. You can turn Viper on and off for any Emacs state. When Viper is turned
|
|
452 on, Vi state can be used to move around. In Insert state, the bindings for
|
|
453 these modes can be accessed. For beginners (users at Viper levels 1 and 2),
|
|
454 these bindings are suppressed in Insert state, so that new users are not
|
|
455 confused by the Emacs states. Note that unless you allow Emacs bindings in
|
|
456 Insert state, you cannot do many interesting things, like language
|
|
457 sensitive editing. For the novice user (at Viper level 1), all major mode
|
|
458 bindings are turned off in Vi state as well. This includes the bindings for
|
|
459 key sequences that start with @kbd{C-c}, which practically means that all
|
|
460 major mode bindings are supported. @xref{Customization}, to find out how
|
|
461 to allow Emacs keys in Insert state.
|
|
462
|
|
463 @menu
|
|
464 * Emacs State:: This is the state you should learn more about when
|
|
465 you get up to speed with Viper.
|
|
466 * Vi State:: Vi commands are executed in this state.
|
|
467 * Insert State:: You can enter text, and also can do sophisticated
|
|
468 editing if you know enough Emacs commands.
|
|
469 * Replace State:: Like Insert mode, but it is invoked via the
|
|
470 replacement commands, such as cw, C, R, etc.
|
|
471 @end menu
|
|
472
|
|
473 @node Emacs State, Vi State, States in Viper, States in Viper
|
|
474 @subsection Emacs State
|
|
475
|
|
476 @kindex @kbd{C-z}
|
|
477 @cindex Emacs state
|
|
478
|
|
479
|
|
480 You will be in this mode only by accident (hopefully). This is the state
|
|
481 Emacs is normally in (imagine!!). Now leave it as soon as possible by
|
78
|
482 typing @kbd{C-z}. Then you will be in Vi state (sigh of relief) :-).
|
0
|
483
|
|
484 Emacs state is actually a Viperism to denote all the major and minor modes
|
|
485 (@xref{Emacs Preliminaries}) other than Viper that Emacs can be in. Emacs
|
|
486 can have several modes, such as C mode for editing C programs, LaTeX mode
|
|
487 for editing LaTeX documents, Dired for directory editing, etc. These are
|
|
488 major modes, each with a different set of key-bindings. Viper states are
|
|
489 orthogonal to these Emacs major modes. The presence of these language
|
|
490 sensitive and other modes is a major win over Vi. @xref{Improvements over
|
|
491 Vi}, for more.@refill
|
|
492
|
|
493 The bindings for these modes can be made available in the Viper Insert state
|
|
494 as well as in Emacs state. Unless you specify your user level as 1 (a
|
|
495 novice), all major mode key sequences that start with @kbd{C-x} and
|
|
496 @kbd{C-c} are also available in Vi state. This is important because major
|
|
497 modes designed for editing files, such as cc-mode or latex-mode, use key
|
|
498 sequences that begin with @kbd{C-x} and @kbd{C-c}.
|
|
499
|
|
500 There is also a key that lets you temporarily escape to Vi command state
|
78
|
501 from Emacs or Insert states: typing @kbd{C-c \} will let you execute a
|
|
502 single Vi command while staying in Viper's Emacs or Insert state.
|
|
503 In Insert state, the same can also be achieved by typing @kbd{C-z}.
|
|
504
|
0
|
505
|
|
506 @node Vi State, Insert State, Emacs State, States in Viper
|
|
507 @subsection Vi State
|
|
508
|
|
509 @cindex Vi state
|
|
510
|
|
511 This is the Vi command mode. When Viper is in Vi state, you will see the sign
|
|
512 <V> in the mode line. Most keys will work as in Vi. The notable
|
|
513 exceptions are:
|
|
514
|
|
515 @table @kbd
|
|
516 @item C-x
|
|
517 @kindex @kbd{C-x}
|
|
518 @kbd{C-x} is used to invoke Emacs commands, mainly those that do window
|
|
519 management. @kbd{C-x 2} will split a window, @kbd{C-x 0} will close a
|
|
520 window. @kbd{C-x 1} will close all other windows. @kbd{C-xb} is used to
|
|
521 switch buffers in a window, and @kbd{C-xo} to move through windows.
|
|
522 These are about the only necessary keystrokes.
|
|
523 For the rest, see the GNU Emacs Manual.
|
|
524
|
|
525 @item C-c
|
|
526 @kindex @kbd{C-c}
|
|
527 For user levels 2 and higher, this key serves as a prefix key for the key
|
|
528 sequences used by various major modes. For users at Viper level 1, @kbd{C-c}
|
|
529 simply beeps.
|
|
530
|
|
531 @item C-g and C-]
|
|
532 @kindex @kbd{C-g}
|
|
533 @kindex @kbd{C-]}
|
|
534
|
|
535 These are the Emacs @samp{quit} keys.
|
|
536 There will be cases where you will have to
|
|
537 use @kbd{C-g} to quit. Similarly, @kbd{C-]} is used to exit
|
|
538 @samp{Recursive Edits} in Emacs for which there is no comparable Vi
|
|
539 functionality and no key-binding. Recursive edits are indicated by
|
|
540 @samp{[]} brackets framing the modes on the mode line.
|
|
541 @xref{Recursive Edit,Recursive
|
|
542 Edit,Recursive Edit,emacs,The GNU Emacs Manual}.
|
|
543 At user level 1, @kbd{C-g} is bound to @code{vip-info-on-file}
|
|
544 function instead.
|
|
545 @refill
|
78
|
546 @item C-\
|
|
547 @kindex @kbd{C-\}
|
0
|
548 @cindex Meta key
|
|
549
|
|
550 Viper uses @kbd{ESC} as a switch between Insert and Vi states. Emacs uses
|
|
551 @kbd{ESC} for Meta. We need a Meta key to call the Meta key functions
|
78
|
552 such as @kbd{M-x function name}. This role is played by the key @kbd{C-\}.
|
|
553 Thus, to
|
|
554 get @kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no Meta key).
|
|
555 This works both in the Vi state and the Insert state.
|
|
556 Alternatively, you can use @kbd{\ ESC} in Vi state to simulate the meta
|
|
557 key.
|
0
|
558 It is possible to use @kbd{ESC} as Meta, but then you cannot
|
|
559 press @kbd{ESC} multiple times in Vi state. @xref{Customization}, to find
|
|
560 out how to rebind ESC to be Meta.@refill
|
|
561 @end table
|
|
562 @noindent
|
|
563 Other differences are mostly improvements. The ones you should know
|
|
564 about are:
|
|
565
|
|
566 @table @samp
|
|
567 @item Undo
|
|
568 @kindex @kbd{u}
|
|
569 @kbd{u} will undo. Undo can be repeated by the @kbd{.} key. Undo itself
|
|
570 can be undone. Another @kbd{u} will change the direction. The presence
|
|
571 of repeatable undo means that @kbd{U}, undoing lines, is not very
|
|
572 important. Therefore, @kbd{U} also calls @code{vip-undo}.
|
|
573 @cindex multiple undo
|
|
574 @cindex undo
|
|
575
|
|
576
|
|
577 @item Counts
|
|
578 Most commands, @kbd{~}, @kbd{[[}, @kbd{p}, @kbd{/}, @dots{}, etc., take counts.
|
|
579
|
|
580 @comment ]] Just to balance parens
|
|
581 @item Regexps
|
|
582 Viper uses Emacs Regular Expressions for searches. These are a superset of
|
|
583 Vi regular
|
|
584 expressions, excepting the change-of-case escapes @samp{\u}, @samp{\L},
|
|
585 @dots{}, etc. @xref{Regular Expressions,,Regular Expressions,emacs,The
|
|
586 GNU Emacs Manual}, for details.
|
|
587 Files specified to @kbd{:e} use @code{csh} regular expressions
|
|
588 (globbing, wildcards, what have you).
|
|
589 However, the function @code{vip-toggle-search-style}, bound to @kbd{C-c /},
|
|
590 lets the user switch from search with regular expressions to plain vanilla
|
|
591 search and vice versa. It also lets one switch from case-sensitive search
|
|
592 to case-insensitive and back.
|
|
593 @xref{Viper Specials}, for more details.
|
|
594 @cindex regular expressions
|
|
595 @cindex vanilla search
|
|
596 @cindex case-sensitive search
|
|
597 @cindex case-insensitive search
|
|
598 @kindex @kbd{C-c /}
|
|
599
|
|
600 @item Ex commands
|
|
601 @cindex Ex commands
|
|
602 The current working directory of a buffer is automatically inserted in the
|
|
603 minibuffer if you
|
|
604 type @kbd{:e} then space.
|
|
605 Absolute filenames are required less often in Viper.
|
|
606 For path names,
|
|
607 Emacs uses a convention that is slightly different from that of Unix.
|
|
608 It is designed to minimize the need for deleting path names that Emacs
|
|
609 provides in its prompts. (This is usually convenient, but occasionally
|
|
610 the prompt may suggest a wrong path name for you.) If you see a prompt
|
|
611 @kbd{/usr/foo/} and you wish to edit the file @kbd{~/.vip}, you don't
|
|
612 have to erase the prompt. Instead, simply continue typing what you
|
|
613 need. Emacs will interpret @kbd{/usr/foo/~/.vip} correctly. Similarly,
|
|
614 if the prompt is @kbd{~/foo/} and you need to get to @kbd{/bar/file}, keep
|
|
615 typing. Emacs interprets @kbd{~/foo//bar/} as @kbd{/bar/file}, since when it
|
|
616 sees @samp{//}, it understands that @kbd{~/foo/} is to be discarded.
|
|
617
|
|
618 The command @kbd{:cd} will change the default directory for the
|
|
619 current buffer. The command @kbd{:e} will interpret the
|
|
620 filename argument in @code{csh}. @xref{Customization}, if you
|
|
621 want to change the default shell.
|
|
622 The command @kbd{:next} takes counts from
|
|
623 @kbd{:args}, so that @kbd{:rew} is obsolete. Also, @kbd{:args} will show only
|
|
624 the invisible files (i.e., those that are not currently seen in Emacs
|
|
625 windows).
|
|
626
|
|
627 When applicable, Ex commands support file completion and history. This
|
|
628 means that by typing a partial file name and then @kbd{TAB}, Emacs will try
|
|
629 to complete the name or it will offer a menu of possible completions.
|
|
630 This works similarly to Tcsh and extends the behavior of Csh. While Emacs
|
|
631 is waiting for a file name, you can type @kbd{M-p} to get the previous file
|
|
632 name you typed. Repeatedly typing @kbd{M-p} and @kbd{M-n} will let you
|
|
633 browse through the file history.
|
|
634
|
|
635 Like file names, partially typed Ex commands can be completed by typing
|
|
636 @kbd{TAB}, and Viper keeps the history of Ex commands. After typing
|
|
637 @kbd{:}, you can browse through the previously entered Ex commands by
|
|
638 typing @kbd{M-p} and @kbd{M-n}. Viper tries to rationalize when it puts Ex
|
|
639 commands on the history list. For instance, if you typed @kbd{:w! foo},
|
|
640 only @kbd{:w!} will be placed on the history list. This is because the
|
|
641 last history element is the default that can be invoked simply by typing
|
|
642 @kbd{: RET}. If @kbd{:w! foo} were placed on the list, it would be all to
|
|
643 easy to override valuable data in another file. Reconstructing the full
|
|
644 command, @kbd{:w! foo}, from the history is still not that hard, since Viper
|
|
645 has a separate history for file names. By typing @kbd{: M-p}, you will get
|
|
646 @kbd{:w!} in the Minibuffer. Then, repeated @kbd{M-p} will get you through
|
|
647 the file history, inserting one file name after another.
|
|
648
|
|
649 In contrast to @kbd{:w! foo}, if the command were @kbd{:r foo}, the entire
|
|
650 command will appear in the history list. This is because having @kbd{:r}
|
|
651 alone as a default is meaningless, since this command requires a file
|
|
652 argument.
|
|
653 @refill
|
|
654 @end table
|
|
655 @noindent
|
|
656 As Vi, Viper's destructive commands can be re-executed by typing `@kbd{.}'.
|
|
657 However, in addition, Viper keeps track of the history of such commands. This
|
|
658 history can be perused by typing @kbd{C-c M-p} and @kbd{C-c M-n}.
|
|
659 Having found the appropriate command, it can be then executed by typing
|
|
660 `@kbd{.}'.
|
|
661 @xref{Improvements over Vi}, for more information.
|
|
662
|
|
663 @node Insert State, Replace State, Vi State, States in Viper
|
|
664 @subsection Insert State
|
|
665
|
|
666 @cindex Insert state
|
|
667
|
|
668 To avoid confusing the beginner (at Viper level 1 and 2), Viper makes only the
|
|
669 standard Vi keys available in Insert state. The implication is that
|
|
670 Emacs major modes cannot be used Insert state.
|
|
671 It is strongly recommended that as soon as you are comfortable, make the
|
|
672 Emacs state bindings visible (by changing your user level to 3 or higher).
|
|
673 @xref{Customization},
|
|
674 to see how to do this.@refill
|
|
675
|
|
676 Once this is done, it is possible to do quite a bit of editing in
|
|
677 Insert state. For instance, Emacs has a @dfn{yank} command, @kbd{C-y},
|
|
678 which is similar to Vi's @kbd{p}. However, unlike @kbd{p}, @kbd{C-y} can be
|
|
679 used in Insert state of Viper. Emacs also has a kill ring where it keeps
|
|
680 pieces of text you deleted while editing buffers. The command @kbd{M-y} is
|
|
681 used to delete the text previously put back by Emacs' @kbd{C-y} or by Vi's
|
|
682 @kbd{p} command and reinsert text that was placed on the kill-ring earlier.
|
|
683
|
|
684 This works both in Vi and Insert states.
|
|
685 In Vi state, @kbd{M-y} is a much better alternative to the usual Vi's way
|
|
686 of recovering the 10 previously deleted chunks of text. In Insert state,
|
|
687 you can
|
|
688 use this as follows. Suppose you deleted a piece of text and now you need
|
|
689 to re-insert it while editing in Insert mode. The key @kbd{C-y} will put
|
|
690 back the most recently deleted chunk. If this is not what you want, type
|
|
691 @kbd{M-y} repeatedly and, hopefully, you will find the chunk you want.
|
|
692
|
|
693 Finally, in Insert and Replace states, Viper provides the history of
|
|
694 pieces of text inserted in previous insert or replace commands. These
|
|
695 strings of text can be recovered by repeatedly typing @kbd{C-c M-p} or
|
|
696 @kbd{C-c M-n} while in Insert or Replace state. (This feature is disabled
|
|
697 in the minibuffer: the above keys are usually bound to other histories,
|
|
698 which are more appropriate in the minibuffer.)
|
|
699
|
|
700
|
|
701 @cindex Meta key
|
|
702
|
78
|
703 You can call Meta functions from Insert state. As in Vi state, the Meta key
|
|
704 is @kbd{C-\}. Thus @kbd{M-x} is typed as @kbd{C-\ x}.
|
0
|
705
|
|
706 Other Emacs commands that are useful in Insert state are @kbd{C-e}
|
|
707 and @kbd{C-a}, which move the cursor to the end and the beginning of the
|
|
708 current line, respectively. You can also use @kbd{M-f} and @kbd{M-b},
|
|
709 which move the cursor forward (or backward) one word.
|
|
710 If your display has a Meta key, these functions are invoked by holding the
|
|
711 Meta key and then typing @kbd{f} and @kbd{b}, respectively. On displays
|
|
712 without the Meta key, these functions are invoked by typing
|
78
|
713 @kbd{C-\ f} and @kbd{C-\ b} (@kbd{C-\} simulates the Meta key in Insert
|
0
|
714 state, as explained above).
|
|
715
|
|
716 When Viper is in Insert state, you will see <I> in the mode line.
|
|
717
|
|
718 @node Replace State,, Insert State, States in Viper
|
|
719 @subsection Replace State
|
|
720
|
|
721 @cindex Replace state
|
|
722
|
|
723 This state is entered through Vi replacement commands, such as @kbd{C},
|
|
724 @kbd{cw}, etc., or by typing @kbd{R}. In Replace state, Viper puts <R> in the
|
|
725 mode line to let you know which state is in effect. If Replace state is
|
|
726 entered through @kbd{R}, Viper stays in that state until the user hits ESC.
|
|
727 If this state is entered via the other replacement commands, then Replace
|
|
728 state is in effect until you hit @kbd{ESC} or until you cross the rightmost
|
|
729 boundary of the replacement region. In the latter case, Viper changes its
|
|
730 state from Replace to Insert (which you will notice by the change in the
|
|
731 mode line).
|
|
732
|
|
733 Since Viper runs under Emacs, it is possible to switch between buffers
|
|
734 while in Replace state. You can also move the cursor using the arrow keys
|
|
735 (even on dumb terminals!) and the mouse. Because of this freedom (which is
|
|
736 unattainable in regular Vi), it is possible to take the cursor outside the
|
|
737 replacement region. (This may be necessary for several reasons, including
|
|
738 the need to enable text selection and region-setting with the mouse.)
|
|
739
|
|
740 The issue then arises as to what to do when the user
|
|
741 hits the ESC key. In Vi, this would cause the text between cursor and
|
|
742 the end of the replacement region to be deleted. But what if, as is
|
|
743 possible in Viper, the cursor is not inside the replacement region?
|
|
744
|
|
745 To solve the problem, Viper keeps track of the last cursor position while it
|
|
746 was still inside the replacement region. So, in the above situation, Viper
|
|
747 would delete text between this position and the end of the replacement
|
|
748 region.
|
|
749
|
|
750 @node The Minibuffer,Multiple Files in Viper, States in Viper, Overview
|
|
751 @section The Minibuffer
|
|
752
|
|
753 @cindex Minibuffer
|
|
754
|
|
755 The Minibuffer is where commands are entered in. Editing can be done
|
|
756 by commands from Insert state, namely:
|
|
757
|
|
758 @table @kbd
|
|
759 @item C-h
|
|
760 Backspace
|
|
761 @item C-w
|
|
762 Delete Word
|
|
763 @item C-u
|
|
764 Erase line
|
|
765 @item C-v
|
|
766 Quote the following character
|
|
767 @item RET
|
|
768 Execute command
|
|
769 @item C-g and C-]
|
|
770 Emacs quit and abort keys. These may be necessary. @xref{Vi State}, for an
|
|
771 explanation.
|
|
772 @item M-p and M-n
|
|
773 These keys are bound to functions that peruse minibuffer history. The
|
|
774 precise history to be perused depends on the context. It may be the history
|
|
775 of search strings, Ex commands, file names, etc.
|
|
776 @end table
|
|
777
|
|
778 Most of the Emacs keys are functional in the Minibuffer. While in the
|
|
779 Minibuffer, Viper tries to make editing resemble Vi's behavior when the
|
|
780 latter is waiting for the user to type an Ex command. In particular, you
|
|
781 can use the regular Vi commands to edit the Minibuffer. You can switch
|
|
782 between the Vi state and Insert state at will, and even use the replace mode.
|
|
783 Initially, the Minibuffer comes up in Insert state.
|
|
784
|
|
785 Some users prefer plain Emacs bindings in the Minibuffer. To this end, set
|
|
786 @code{vip-vi-style-in-minibuffer} to @code{nil} in @file{.vip}.
|
|
787 @xref{Customization}, to learn how to do this.
|
|
788
|
|
789 When the Minibuffer changes Viper states, you will notice that the appearance
|
|
790 of the text there changes as well. This is useful because the Minibuffer
|
|
791 has no mode line to tell which Vi state it is in.
|
|
792 The appearance of the text in the Minibuffer can be changed.
|
|
793 @xref{Viper Specials}, for more details.
|
|
794
|
|
795 @node Multiple Files in Viper,Unimplemented Features,The Minibuffer,Overview
|
|
796 @section Multiple Files in Viper
|
|
797
|
|
798 @cindex multiple files
|
|
799 @cindex managing multiple files
|
|
800
|
|
801 Viper can edit multiple files. This means, for example that you never need
|
|
802 to suffer through @code{No write since last change} errors.
|
|
803 Some Viper elements are common over all the files.
|
|
804
|
|
805 @table @samp
|
|
806 @item Textmarkers
|
|
807 @cindex markers
|
|
808 @cindex textmarkers
|
|
809 Textmarkers remember @emph{files and positions}.
|
|
810 If you set marker @samp{a} in
|
|
811 file @file{foo}, start editing file @file{bar} and type @kbd{'a}, then
|
|
812 @emph{YOU WILL SWITCH TO FILE @file{foo}}. You can see the contents of a
|
|
813 textmarker using the Viper command @kbd{[<a-z>} where <a-z> are the
|
|
814 textmarkers, e.g., @kbd{[a} to view marker @samp{a} .@refill
|
|
815 @item Repeated Commands
|
|
816 Command repetitions are common over files. Typing @kbd{!!} will repeat the
|
|
817 last @kbd{!} command whichever file it was issued from.
|
|
818 Typing @kbd{.} will repeat the last command from any file, and
|
|
819 searches will repeat the last search. Ex commands can be repeated by typing
|
|
820 @kbd{:RET}.@refill
|
|
821 Note: in some rare cases, that @kbd{:RET} may do something dangerous.
|
|
822 However, usually its effect can be undone by typing @kbd{u}.
|
|
823 @item Registers
|
|
824 @cindex registers
|
|
825 Registers are common to files. Also, text yanked with @kbd{y} can be
|
|
826 put back (@kbd{p}) into any file. The Viper command @kbd{]<a-z>}, where <a-z> are
|
|
827 the registers, can be used to look at the contents of a register, e.g.,
|
|
828 type @kbd{]a} to view register @samp{a}.
|
|
829
|
|
830 There is one difference in text deletion that you should be
|
|
831 aware of. This difference comes from Emacs and was adopted in Viper
|
|
832 because we find it very useful. In Vi, if you delete a line, say, and then
|
|
833 another line, these two deletions are separated and are put back
|
|
834 separately if you use the @samp{p} command. In Emacs (and Viper), successive
|
|
835 series of deletions that are @emph{not interrupted} by other commands are
|
|
836 lumped together, so the deleted text gets accumulated and can be put back
|
|
837 as one chunk. If you want to break a sequence of deletions so that the
|
|
838 newly deleted text could be put back separately from the previously deleted
|
|
839 text, you should perform a non-deleting action, e.g., move the cursor one
|
|
840 character in any direction.
|
|
841 @item Absolute Filenames
|
|
842 @cindex absolute paths
|
|
843 The current directory name for a file is automatically prepended to the
|
|
844 file name in any
|
|
845 @kbd{:e}, @kbd{:r}, @kbd{:w}, etc., command (in Emacs, each buffer has a
|
|
846 current directory).
|
|
847 This directory is inserted in the Minibuffer once you type space after
|
|
848 @kbd{:e, r}, etc. Viper also supports completion of file names and Ex
|
|
849 commands (@kbd{TAB}), and it keeps track of
|
|
850 command and file history (@kbd{M-p}, @kbd{M-n}).
|
|
851 Absolute filenames are required less
|
|
852 often in Viper.
|
|
853
|
|
854 You should be aware that Emacs interprets @kbd{/foo/bar//bla} as
|
|
855 @kbd{/bla} and @kbd{/foo/~/bar} as @kbd{~/bar}. This is designed to
|
|
856 minimize the need for erasing path names that Emacs suggests in its
|
|
857 prompts, if a suggested path name is not what you wanted.
|
|
858
|
|
859 The command @kbd{:cd} will change the default directory for the
|
|
860 current Emacs buffer. The Ex command @kbd{:e} will interpret the
|
|
861 filename argument in @samp{csh}, by default. @xref{Customization}, if you
|
|
862 want to change this.
|
|
863 @end table
|
|
864
|
|
865 @noindent
|
|
866 Currently undisplayed files can be listed using the @kbd{:ar} command. The
|
|
867 command @kbd{:n} can be given counts from the @kbd{:ar} list to switch to
|
|
868 other files.
|
|
869
|
|
870 @node Unimplemented Features,,Multiple Files in Viper,Overview
|
|
871 @section Unimplemented Features
|
|
872
|
|
873 Unimplemented features include:
|
|
874
|
|
875 @itemize @bullet
|
|
876 @item
|
|
877 @kbd{:ab} and @kbd{:una} are not implemented.
|
|
878 Both @kbd{:map} and @kbd{:ab} are considered obsolete, since Emacs has much
|
|
879 more powerful facilities for defining keyboard macros and abbreviations.
|
|
880 @item
|
|
881 @kbd{:set option?} is not implemented. The current
|
|
882 @kbd{:set} can also be used to set Emacs variables.
|
|
883 @item
|
|
884 @kbd{:se list} requires modification of the display code for Emacs, so
|
|
885 it is not implemented.
|
|
886 A useful alternative is @code{cat -t -e file}. Unfortunately, it cannot
|
|
887 be used directly inside Emacs, since Emacs will obdurately change @samp{^I}
|
|
888 back to normal tabs.@refill
|
|
889 @end itemize
|
|
890
|
|
891 @comment node-name, next, previous, up
|
|
892 @node Improvements over Vi, Customization, Overview, Top
|
|
893 @chapter Improvements over Vi
|
|
894
|
|
895 Some common problems with Vi and Ex have been solved in Viper. This
|
|
896 includes better implementation of existing commands, new commands, and
|
|
897 the facilities provided by Emacs.
|
|
898
|
|
899 @menu
|
|
900 * Basics:: Basic Viper differences, Multi-file effects.
|
|
901 * Undo and Backups:: Multiple undo, auto-save, backups and changes
|
|
902 * History:: History for Ex and Vi commands.
|
|
903 * Macros and Registers:: Keyboard Macros (extended ".") @@reg execution.
|
|
904 * Completion:: Filename and Command Completion for Ex.
|
|
905 * Improved Search:: Incremental Search and Buffer Content Search.
|
|
906 * Abbreviation Facilities:: Normal Abbrevs, Templates, and Dynamic Abbrevs.
|
|
907 * Movement and Markers:: Screen Editor movements, viewing textmarkers.
|
|
908 * New Commands:: Commands that do not exist in Vi.
|
|
909 * Useful Packages:: A Sampling of some Emacs packages, and things
|
|
910 you should know about.
|
|
911 @end menu
|
|
912
|
|
913 @node Basics, Undo and Backups, Improvements over Vi, Improvements over Vi
|
|
914 @section Basics
|
|
915
|
|
916 The Vi command set is based on the idea of combining motion commands
|
|
917 with other commands. The motion command is used as a text region
|
|
918 specifier for other commands.
|
|
919 We classify motion commands into @dfn{point commands} and
|
|
920 @dfn{line commands}.@refill
|
|
921
|
|
922 @cindex point commands
|
|
923
|
|
924 The point commands are:
|
|
925
|
|
926 @quotation
|
|
927 @kbd{h}, @kbd{l}, @kbd{0}, @kbd{$}, @kbd{w}, @kbd{W}, @kbd{b}, @kbd{B},
|
|
928 @kbd{e}, @kbd{E}, @kbd{(}, @kbd{)}, @kbd{/}, @kbd{?}, @kbd{`}, @kbd{f},
|
|
929 @kbd{F}, @kbd{t}, @kbd{T}, @kbd{%}, @kbd{;}, @kbd{,}, @kbd{^}
|
|
930 @end quotation
|
|
931
|
|
932 @cindex line commands
|
|
933
|
|
934 The line commands are:
|
|
935
|
|
936 @quotation
|
|
937 @kbd{j}, @kbd{k}, @kbd{+}, @kbd{-}, @kbd{H}, @kbd{M}, @kbd{L}, @kbd{@{},
|
|
938 @kbd{@}}, @kbd{G}, @kbd{'}, @kbd{[[}, @kbd{]]}, @kbd{[]}
|
|
939 @end quotation
|
|
940
|
|
941 @cindex region
|
|
942 @cindex region specification
|
|
943 @cindex expanding (region)
|
|
944 @cindex describing regions
|
|
945 @cindex movement commands
|
|
946
|
|
947 @noindent
|
|
948 If a point command is given as an argument to a modifying command, the
|
|
949 region determined by the point command will be affected by the modifying
|
|
950 command. On the other hand, if a line command is given as an argument to a
|
|
951 modifying command, the region determined by the line command will be
|
|
952 enlarged so that it will become the smallest region properly containing the
|
|
953 region and consisting of whole lines (we call this process @dfn{expanding
|
|
954 the region}), and then the enlarged region will be affected by the modifying
|
|
955 command.
|
|
956 Text Deletion Commands (@xref{Deleting Text}), Change commands
|
|
957 (@xref{Changing Text}), even Shell Commands (@xref{Shell Commands})
|
|
958 use these commands to describe a region of text to operate on.
|
|
959 Thus, type @kbd{dw} to delete a word, @kbd{>@}} to shift a paragraph, or
|
|
960 @kbd{!'afmt} to format a region from @samp{point} to textmarker
|
|
961 @samp{a}.
|
|
962
|
|
963 @cindex r and R region specifiers
|
|
964
|
|
965 Viper adds the region specifiers @samp{r} and @samp{R}. Emacs has a
|
|
966 special marker called @dfn{mark}. The text-area between the current cursor
|
|
967 position @dfn{point} and the @dfn{mark} is called the @dfn{region}.
|
|
968 @samp{r} specifies the raw region and @samp{R} is the expanded region
|
|
969 (i.e., the minimal contiguous chunk of full lines that contains the raw
|
|
970 region).
|
|
971 @kbd{dr} will now delete the region, @kbd{>r} will shift it, etc.
|
|
972 @kbd{r,R} are not motion commands, however. The special mark is set by
|
|
973 @kbd{m.} and other commands. @xref{Marking}, for more info.
|
|
974
|
|
975 Viper also adds counts to most commands for which it would make sense.
|
|
976
|
|
977 In the Overview chapter, some Multiple File issues were discussed
|
|
978 (@xref{Multiple Files in Viper}). In addition to the files, Emacs has
|
|
979 buffers. These can be seen in the @kbd{:args} list and switched using
|
|
980 @kbd{:next} if you type @kbd{:set ex-cycle-through-non-files t}, or
|
|
981 specify @code{(setq ex-cycle-through-non-files t)} in your @file{.vip}
|
|
982 file. @xref{Customization}, for details.
|
|
983
|
|
984 @node Undo and Backups, History, Basics, Improvements over Vi
|
|
985 @section Undo and Backups
|
|
986
|
|
987 @cindex undo
|
|
988
|
|
989 Viper provides multiple undo. The number of undo's and the size is limited
|
|
990 by the machine. The Viper command @kbd{u} does an undo. Undo can be
|
|
991 repeated by typing @kbd{.} (a period). Another @kbd{u} will undo the undo,
|
|
992 and further
|
|
993 @kbd{.} will repeat it. Typing @kbd{u} does the first undo, and changes the
|
|
994 direction.
|
|
995
|
|
996 @cindex backup files
|
|
997 @cindex auto save
|
|
998
|
|
999 Since the undo size is limited, Viper can create backup files and
|
|
1000 auto-save files. It will normally do this automatically. It is possible
|
|
1001 to have numbered backups, etc. For details, @pxref{Backup,,Backup and
|
|
1002 Auto-Save,emacs,The GNU Emacs Manual} @refill
|
|
1003
|
|
1004 @comment [ balance parens
|
|
1005 @cindex viewing registers and markers
|
|
1006 @cindex registers
|
|
1007 @cindex markers
|
|
1008 @cindex textmarkers
|
|
1009
|
|
1010 The results of the 9 previous changes are available in the 9 numeric
|
|
1011 registers, as in Vi. The extra goody is the ability to @emph{view} these
|
|
1012 registers, in addition to being able to access them through @kbd{p} and
|
|
1013 @kbd{M-y} (@xref{Insert State}, for details.)
|
|
1014 The Viper command @kbd{] register} will display the contents of any
|
|
1015 register, numeric or alphabetical. The related command @kbd{[ textmarker}
|
|
1016 will show the text around the textmarker. @samp{register} and @samp{textmarker}
|
|
1017 can be any letters from a through z.
|
|
1018 @comment ] balance parens
|
|
1019
|
|
1020 @node History, Macros and Registers, Undo and Backups,Improvements over Vi
|
|
1021 @section History
|
|
1022
|
|
1023 @cindex history
|
|
1024 @cindex Minibuffer
|
|
1025
|
|
1026 History is provided for Ex commands, Vi searches, file names, pieces of
|
|
1027 text inserted in earlier commands that use Insert or Replace state, and for
|
|
1028 destructive commands in Vi state. These are
|
|
1029 useful for fixing those small typos that screw up searches and @kbd{:s},
|
|
1030 and for eliminating routine associated with repeated typing of file names
|
|
1031 or pieces of text that need to be inserted frequently.
|
|
1032 At the @kbd{:} or @kbd{/} prompts in the Minibuffer, you can do the following:
|
|
1033
|
|
1034 @table @kbd
|
|
1035 @item M-p and M-n
|
|
1036 To move to previous and next history items. This causes the history
|
|
1037 items to appear on the command line, where you can edit them, or
|
|
1038 simply type Return to execute.
|
|
1039 @item M-r and M-s
|
|
1040 To search backward and forward through the history.
|
|
1041 @item RET
|
|
1042 Type RET to accept a default (which is displayed in the prompt).
|
|
1043 @end table
|
|
1044
|
|
1045 The history of insertions can be perused by
|
|
1046 typing @kbd{C-c M-p} and @kbd{C-c M-n} while in Insert or Replace state.
|
|
1047 The history of destructive Vi commands can be perused via the same keys
|
|
1048 when Viper is in Vi state. @xref{Viper Specials}, for details.
|
|
1049
|
|
1050 All Ex commands have a file history. For instance, typing @kbd{:e}, space
|
|
1051 and then @kbd{M-p} will bring up the name of the previously typed file
|
|
1052 name. Repeatedly typing @kbd{M-p}, @kbd{M-n}, etc., will let you browse
|
|
1053 through the file history.
|
|
1054
|
|
1055 Similarly, commands that have to do with switching buffers
|
|
1056 have a buffer history, and commands that expect strings or regular
|
|
1057 expressions keep a history on those items.
|
|
1058
|
|
1059 @node Macros and Registers,Completion,History,Improvements over Vi
|
|
1060 @section Macros and Registers
|
|
1061
|
|
1062 @cindex keyboard macros
|
|
1063 @cindex macros
|
|
1064 @cindex registers
|
|
1065 @cindex register execution
|
|
1066
|
|
1067 Viper facilitates the use of Emacs-style keyboard macros. @kbd{@@#} will
|
|
1068 start a macro definition. As you type, the commands will be executed, and
|
|
1069 remembered (This is called ``learn mode'' in some editors.)
|
|
1070 @kbd{@@register} will complete the macro, putting it into @samp{register},
|
|
1071 where @samp{register} is any character from @samp{a} through @samp{z}. Then
|
|
1072 you can execute this macro using @kbd{@@register}. It is, of course,
|
|
1073 possible to yank some text into a register and execute it using
|
|
1074 @kbd{@@register}. Typing @kbd{@@@@}, @kbd{@@RET}, or @kbd{@@LF} will
|
|
1075 execute the last macro that was executed using @kbd{@@register}.@refill
|
|
1076
|
|
1077 Viper will automatically lowercase the register, so that pressing the
|
|
1078 @kbd{SHIFT} key for @kbd{@@} will not create problems. This is for
|
|
1079 @kbd{@@} macros and @kbd{"p} @emph{only}. In the case of @kbd{y},
|
|
1080 @kbd{"Ayy} will append to @emph{register a}. For @kbd{[,],',`}, it
|
|
1081 is an error to use a Uppercase register name.
|
|
1082
|
|
1083 @comment [ balance parens
|
|
1084 @cindex viewing registers and markers
|
|
1085
|
|
1086 The contents of a register can be seen by @kbd{]register}. (@kbd{[textmarker}
|
|
1087 will show the contents of a textmarker).
|
|
1088 @comment ] balance parens
|
|
1089
|
|
1090 @cindex last keyboard macro
|
|
1091
|
|
1092 The last keyboard macro can also be executed using
|
|
1093 @kbd{*}, and it can be yanked into a register using @kbd{@@!register}.
|
|
1094 This is useful for Emacs style keyboard macros defined using @kbd{C-x(}
|
|
1095 and @kbd{C-x)}. Emacs keyboard macros have more capabilities.
|
|
1096 @xref{Keyboard Macros,,Keyboard Macros,emacs, The GNU Emacs Manual}, for
|
|
1097 details.@refill
|
|
1098
|
|
1099 Keyboard Macros allow an interesting form of Query-Replace:
|
|
1100 @kbd{/pattern} or @kbd{n} to go to the next pattern (the query), followed by a
|
|
1101 Keyboard Macro execution @kbd{@@@@} (the replace).
|
|
1102
|
|
1103 Viper also provides Vi-style macros. @xref{Vi Macros}, for details.
|
|
1104
|
|
1105
|
|
1106 @node Completion, Improved Search, Macros and Registers, Improvements over Vi
|
|
1107 @section Completion
|
|
1108
|
|
1109 @cindex completion
|
|
1110
|
|
1111 Completion is done when you type @kbd{TAB}. The Emacs completer does not
|
|
1112 grok wildcards in filenames. Once you type a wildcard, the completer will
|
|
1113 no longer work for that path. Remember that Emacs interprets a file name
|
|
1114 of the form @kbd{/foo//bar} as @kbd{/bar} and @kbd{/foo/~/bar} as
|
|
1115 @kbd{~/bar}.
|
|
1116
|
|
1117 @node Improved Search, Abbreviation Facilities, Completion, Improvements over Vi
|
|
1118 @section Improved Search
|
|
1119
|
|
1120 @cindex buffer search
|
|
1121 @cindex word search
|
|
1122
|
|
1123 Viper provides buffer search, the ability to search the buffer for a region
|
|
1124 under the cursor. You have to turn this on in @file{.vip} either by calling
|
|
1125
|
|
1126 @example
|
|
1127 (vip-buffer-search-enable)
|
|
1128 @end example
|
|
1129
|
|
1130 @noindent
|
|
1131 or by setting @code{vip-buffer-search-char} to, say, @kbd{f3}:
|
|
1132 @example
|
|
1133 (setq vip-buffer-search-char [f3])
|
|
1134 @end example
|
|
1135
|
|
1136 @noindent
|
|
1137 If the user calls @code{vip-buffer-search-enable} explicitly (the first
|
|
1138 method), then @code{vip-buffer-search-char} will be set to @kbd{g}.
|
|
1139 Regardless of how this feature is enabled, the key
|
|
1140 @code{vip-buffer-search-char} will take movement commands, like
|
|
1141 @kbd{w,/,e}, to find a region and then search for the contents of that
|
|
1142 region. This command is very useful for searching for variable names, etc.,
|
|
1143 in a program. The search can be repeated by @kbd{n} or reversed by @kbd{N}.
|
|
1144
|
|
1145 @cindex incremental search
|
|
1146
|
|
1147 Emacs provides incremental search. As you type the string in, the
|
|
1148 cursor will move to the next match. You can snarf words from the buffer
|
|
1149 as you go along. Incremental Search is normally bound to @kbd{C-s} and
|
|
1150 @kbd{C-r}. @xref{Customization}, to find out how to change the bindings
|
|
1151 of @kbd{C-r or C-s}.
|
|
1152 For details, @pxref{Incremental Search,,Incremental
|
|
1153 Search,emacs,The GNU Emacs Manual} @refill
|
|
1154
|
|
1155 @cindex query replace
|
|
1156
|
|
1157 Viper also provides a query replace function that prompts through the
|
|
1158 Minibuffer. It is invoked by the @kbd{Q} key in Vi state.
|
|
1159
|
|
1160 @cindex mouse search
|
|
1161
|
|
1162 On a window display, Viper supports mouse search, i.e., you can search for a
|
|
1163 word by clicking on it. @xref{Viper Specials}, for details.
|
|
1164
|
|
1165 Finally, on a window display, Viper highlights search patterns as it finds
|
|
1166 them. This is done through what is known as @emph{faces} in Emacs. The
|
|
1167 variable that controls how search patterns are highlighted is
|
|
1168 @code{vip-search-face}.
|
|
1169 If you don't want any highlighting at all, put
|
|
1170 @example
|
78
|
1171 (setq vip-search-face 'default)
|
0
|
1172 @end example
|
|
1173 @vindex @code{vip-search-face}
|
|
1174 @noindent
|
|
1175 in @file{~/.vip}. If you want to change how patterns are highlighted, you
|
|
1176 will have to set the variable @code{vip-search-face} to some other face,
|
|
1177 such as @code{highlight}. If none of the existing faces fits the bill, you
|
78
|
1178 would have to create your own. Further details on faces can be found
|
0
|
1179 in the Emacs Lisp Manual.
|
|
1180
|
|
1181 @node Abbreviation Facilities,Movement and Markers,Improved Search,Improvements over Vi
|
|
1182 @section Abbreviation Facilities
|
|
1183
|
|
1184 @cindex abbrevs
|
|
1185
|
|
1186 It is possible in Emacs to define abbrevs based on the contents of the
|
|
1187 buffer.
|
|
1188 Sophisticated templates can be defined using the Emacs abbreviation
|
|
1189 facilities. @xref{Abbrevs,,Abbreviations,emacs,The GNU Emacs Manual}, for
|
|
1190 details.
|
|
1191
|
|
1192 @cindex dynamic abbrevs
|
|
1193
|
|
1194 Emacs also provides Dynamic Abbreviations. Given a partial word, Emacs
|
|
1195 will search the buffer to find an extension for this word. For instance,
|
|
1196 one can type @samp{Abbreviations} by typing @samp{A}, followed by a keystroke
|
|
1197 that completed the @samp{A} to @samp{Abbreviations}. Repeated typing
|
|
1198 will search further back in the buffer, so that one could get
|
|
1199 @samp{Abbrevs} by repeating the
|
|
1200 keystroke, which appears earlier in the text. Emacs binds this to
|
|
1201 @kbd{ESC /}, so you will have to find a key and bind the function
|
|
1202 @code{dabbrev-expand} to that key.
|
|
1203 Facilities like this make Vi's @kbd{:ab} command obsolete.
|
|
1204
|
|
1205 @node Movement and Markers, New Commands, Abbreviation Facilities, Improvements over Vi
|
|
1206 @section Movement and Markers
|
|
1207
|
|
1208 @cindex Ex style motion
|
|
1209 @cindex line editor motion
|
|
1210
|
|
1211 Viper can be set free from the line--limited movements in Vi, such as @kbd{l}
|
|
1212 refusing to move beyond the line, @kbd{ESC} moving one character back,
|
|
1213 etc. These derive from Ex, which is a line editor. If your @file{.vip}
|
|
1214 contains
|
|
1215
|
|
1216 @example
|
|
1217 @code{(setq vip-ex-style-motion nil)}
|
|
1218 @end example
|
|
1219
|
|
1220 @noindent
|
|
1221 the motion will be a true screen editor motion. One thing you must then
|
|
1222 watch out for is that it is possible to be on the end-of-line character.
|
|
1223 The keys @kbd{x} and @kbd{%} will still work correctly, i.e., as if they
|
|
1224 were on the last character.
|
|
1225
|
|
1226 @vindex @code{vip-syntax-preference}
|
|
1227 @cindex syntax table
|
|
1228
|
|
1229 The word-movement commands @kbd{w}, @kbd{e}, etc., and the associated
|
|
1230 deletion/yanking commands, @kbd{dw}, @kbd{yw}, etc., can be made to
|
|
1231 understand Emacs syntax tables. If the variable
|
|
1232 @code{vip-syntax-preference} is set to @code{'strict-vi} (the default) then
|
|
1233 the meaning of @emph{word} is the same as in
|
|
1234 Vi. However, if the value is @code{'reformed-vi} then the alphanumeric
|
|
1235 symbols will be those specified by the current Emacs syntax table (which
|
|
1236 may be different for different major modes) plus the underscore symbol
|
|
1237 @code{_}. The user can also specify the value @code{'emacs}, which would
|
|
1238 make Viper use exactly the Emacs notion of word. In particular, the
|
|
1239 underscore may not be part of a word. Finally, if
|
|
1240 @code{vip-syntax-preference} is set to @code{'extended}, Viper words would
|
|
1241 consist of characters that are classified as alphanumeric @emph{or} as
|
|
1242 parts of symbols. This is convenient for writing programs and in many other
|
|
1243 situations.
|
|
1244
|
|
1245 @code{vip-syntax-preference} is a local variable, so it can have different
|
|
1246 values for different major modes. For instance, in programming modes it can
|
|
1247 have the value @code{'extended}. In text modes where words contain special
|
|
1248 characters, such as European (non-English) letters, Cyrillic letters, etc.,
|
|
1249 the value can be @code{'reformed-vi} or @code{'emacs}.
|
|
1250
|
|
1251 Changes to @code{vip-syntax-preference} should be done in the hooks to
|
|
1252 various major modes. Furthermore, for these changes to take effect, you
|
|
1253 should execute @code{(vip-update-alphanumeric-class)} right after changing
|
78
|
1254 the value of @code{vip-syntax-preference}.
|
0
|
1255
|
|
1256 The above discussion of the meaning of Viper's words concerns only Viper's
|
|
1257 movement commands. In regular expressions, words remain the same as in
|
|
1258 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use
|
|
1259 Emacs' idea of what is a word, and they don't look into the value of
|
|
1260 variable @code{vip-syntax-preference}. This is because Viper doesn't change
|
|
1261 syntax tables in fear of upsetting the various major modes that set these
|
|
1262 tables.
|
|
1263
|
|
1264 @cindex textmarkers
|
|
1265
|
|
1266 Textmarkers in Viper remember the file and the position, so that you can
|
|
1267 switch files by simply doing @kbd{'a}. If you set up a regimen for using
|
|
1268 Textmarkers, this is very useful. Contents of textmarkers can be viewed
|
|
1269 by @kbd{[marker}. (Contents of registers can be viewed by @kbd{]register}).
|
|
1270
|
|
1271 @node New Commands, Useful Packages, Movement and Markers, Improvements over Vi
|
|
1272 @section New Commands
|
|
1273
|
|
1274 These commands have no Vi analogs.
|
|
1275
|
|
1276 @table @kbd
|
|
1277 @item C-x, C-c
|
|
1278 @kindex @kbd{C-x}
|
|
1279 @kindex @kbd{C-c}
|
|
1280 @kbd{C-x} will exit from Vi state and return to Emacs state
|
78
|
1281 @emph{temporarily}. If you hit one of these keys, Emacs will believe
|
0
|
1282 that you hit that key in Emacs state. For example, if you hit @kbd{C-x}
|
|
1283 followed by @kbd{2}, then the current window will be split into 2 and you
|
|
1284 will be in Vi state again. Except for novice users, @kbd{C-c} is also set
|
|
1285 to temporarily escape to Emacs and execute a command from the current
|
|
1286 major mode.
|
|
1287 @kbd{ESC} will do the same, if
|
|
1288 you configure @key{ESC} as Meta by setting @code{vip-no-multiple-ESC} to nil
|
78
|
1289 in @file{.vip}. @xref{Customization}. @kbd{C-\}
|
|
1290 in Insert or Vi states will make Emacs think @kbd{Meta} has been hit.@refill
|
0
|
1291 @item \
|
|
1292 @kindex @kbd{\}
|
|
1293 Escape to Emacs to execute a single Emacs command. For instance, @kbd{\
|
|
1294 ESC} will act like a Meta key.
|
|
1295 @item Q
|
|
1296 @kindex @kbd{Q}
|
|
1297 @cindex query replace
|
|
1298 @kbd{Q} is for query replace. By default,
|
|
1299 each string to be replaced is treated as a regular expression. You can use
|
|
1300 @code{(setq vip-re-query-replace nil)} in your @file{.emacs} file to
|
|
1301 turn this off. (For normal searches, @kbd{:se nomagic} will work. Note
|
|
1302 that @kbd{:se nomagic} turns Regexps off completely, unlike Vi).
|
|
1303 @item v
|
|
1304 @itemx V
|
|
1305 @itemx C-v
|
|
1306 @kindex @kbd{v}
|
|
1307 @kindex @kbd{V}
|
|
1308 @kindex @kbd{C-v}
|
|
1309 These keys are used to visit files. @kbd{v} will switch to a buffer
|
|
1310 visiting file whose name can be entered in the Minibuffer. @kbd{V} is
|
|
1311 similar, but will use a window different from the current window.
|
|
1312 @kbd{C-v} is like @kbd{V}, except that a new frame (X window) will be used
|
|
1313 instead of a new Emacs window.
|
|
1314 @item #
|
|
1315 @kindex @kbd{#}
|
|
1316 If followed by a certain character @var{ch}, it becomes an operator whose
|
|
1317 argument is the region determined by the motion command that follows
|
|
1318 (indicated as <move>).
|
|
1319 Currently, @var{ch} can be one of @kbd{c}, @kbd{C}, @kbd{g}, @kbd{q}, and
|
|
1320 @kbd{s}. For instance, @kbd{#qr} will prompt you for a string and then
|
|
1321 prepend this string to each line in the buffer.@refill
|
|
1322 @item # c
|
|
1323 @kindex @kbd{#c<move>}
|
|
1324 @cindex changing case
|
|
1325 Change upper case characters in the region to lower case
|
|
1326 (@code{downcase-region}).
|
|
1327 Emacs command @kbd{M-l} does the same for words.
|
|
1328 @item # C
|
|
1329 @kindex @kbd{#C<move>}
|
|
1330 Change lower case characters in the region to upper case. For instance,
|
|
1331 @kbd{# C 3 w} will capitalize 3 words from the current point
|
|
1332 (@code{upcase-region}).
|
|
1333 Emacs command @kbd{M-u} does the same for words.
|
|
1334 @item # g
|
|
1335 @kindex @kbd{#g<move>}
|
|
1336 Execute last keyboard macro for each line in the region
|
|
1337 (@code{vip-global-execute}).@refill
|
|
1338 @item # q
|
|
1339 @kindex @kbd{#q<move>}
|
|
1340 Insert specified string at the beginning of each line in the region
|
|
1341 (@code{vip-quote-region}).
|
|
1342 @item # s
|
|
1343 @kindex @kbd{#s<move>}
|
|
1344 Check spelling of words in the region (@code{spell-region}).
|
|
1345 The function used for spelling is determined from the variable
|
|
1346 @code{vip-spell-function}.
|
|
1347 @vindex @code{vip-spell-function}
|
|
1348 @item *
|
|
1349 @kindex @kbd{*}
|
|
1350 Call last keyboard macro.
|
|
1351 @item m .
|
|
1352 Set mark at point and push old mark off the ring
|
|
1353 @item m<
|
|
1354 @item m>
|
|
1355 Set mark at beginning and end of buffer, respectively.
|
|
1356 @item m,
|
|
1357 Jump to mark and pop mark off the ring. @xref{Mark,,Mark,emacs,The GNU
|
|
1358 Emacs Manual}, for more info.
|
|
1359 @item ] register
|
|
1360 @kindex @kbd{]<a-z>}
|
|
1361 View contents of register
|
|
1362 @item [ textmarker
|
|
1363 @kindex @kbd{[<a-z>}
|
|
1364 View filename and position of textmarker
|
|
1365 @item @@#
|
|
1366 @item @@register
|
|
1367 @item @@!
|
|
1368 @kindex @kbd{@@#}
|
|
1369 @kindex @kbd{@@<a-z>}
|
|
1370 @kindex @kbd{@@!}
|
|
1371 @cindex keyboard macros
|
|
1372 @cindex register execution
|
|
1373
|
|
1374 Begin/end keyboard macro. @@register has a different meaning when used after
|
|
1375 a @kbd{@@#}. @xref{Macros and Registers}, for details
|
|
1376 @item []
|
|
1377 @kindex @kbd{[]}
|
|
1378 Go to end of heading.
|
|
1379 @item g <@emph{movement command}>
|
|
1380 Search buffer for text delimited by movement command. The canonical
|
|
1381 example is @kbd{gw} to search for the word under the cursor.
|
|
1382 @xref{Improved Search}, for details.@refill
|
|
1383 @item C-g and C-]
|
|
1384 @kindex @kbd{C-g}
|
|
1385 @kindex @kbd{C-]}
|
|
1386 Quit and Abort Recursive edit. These may be necessary on occasion.
|
|
1387 @xref{Vi State}, for a reason.
|
|
1388 @item C-c g
|
|
1389 @kindex @kbd{C-c g}
|
|
1390 Hitting @kbd{C-c} followed by @kbd{g} will display the information on the
|
|
1391 current buffer. This is the same as hitting @kbd{C-g} in Vi, but, as
|
|
1392 explained above, @kbd{C-g} is needed for other purposes in Emacs.
|
|
1393 @item C-c /
|
|
1394 @kindex @kbd{C-c /}
|
|
1395 Without a prefix argument, this command toggles
|
|
1396 case-sensitive/case-insensitive search modes and plain vanilla/regular
|
|
1397 expression search. With the prefix argument 1, i.e.,
|
|
1398 @kbd{1 C-c /}, this toggles case-sensitivity; with the prefix argument 2,
|
|
1399 toggles plain vanilla search and search using
|
|
1400 regular expressions. @xref{Viper Specials}, for alternative ways to invoke
|
|
1401 this function.
|
|
1402 @cindex vanilla search
|
|
1403 @cindex case-sensitive search
|
|
1404 @cindex case-insensitive search
|
|
1405
|
|
1406 @item M-p and M-n
|
|
1407 @kindex @kbd{M-p}
|
|
1408 @kindex @kbd{M-n}
|
|
1409 In the Minibuffer, these commands navigate through the minibuffer
|
|
1410 histories, such as the history of search strings, Ex commands, etc.
|
|
1411
|
|
1412 @item C-c M-p and C-c M-n
|
|
1413 @kindex @kbd{C-c M-p}
|
|
1414 @kindex @kbd{C-c M-n}
|
|
1415 @cindex Insertion history
|
|
1416 @cindex Insertion ring
|
|
1417 @cindex Command history
|
|
1418 @cindex Command ring
|
|
1419
|
|
1420 In Insert or Replace state, these commands let the user
|
|
1421 peruse the history of insertion strings used in previous insert or replace
|
|
1422 commands. Try to hit @kbd{C-c M-p} or @kbd{C-c M-n} repeatedly and see what
|
|
1423 happens. @xref{Viper Specials}, for more.
|
|
1424
|
|
1425 In Vi state, these commands let the user peruse the history of Vi-style
|
|
1426 destructive commands, such as @kbd{dw}, @kbd{J}, @kbd{a}, etc.
|
|
1427 By repeatedly typing @kbd{C-c M-p} or @kbd{C-c M-n} you will cycle Viper
|
|
1428 through the recent history of Vi commands, displaying the commands one by
|
|
1429 one. Once
|
|
1430 an appropriate command is found, it can be executed by typing `@kbd{.}'.
|
|
1431
|
|
1432 Since typing @kbd{C-c M-p} is tedious, it is more convenient to bind an
|
|
1433 appropriate function to a function key on the keyboard and use that key.
|
|
1434 @xref{Viper Specials}, for details.
|
|
1435
|
|
1436 @item Ex commands
|
|
1437 @findex @kbd{:args}
|
|
1438 @findex @kbd{:n}
|
|
1439 @findex @kbd{:pwd}
|
|
1440 @findex @kbd{:pre}
|
|
1441 The commands @kbd{:args}, @kbd{:next}, @kbd{:pre} behave
|
|
1442 differently. @kbd{:pwd} exists to get current directory.
|
|
1443 The commands @kbd{:b} and @kbd{:B} switch buffers around. @xref{File and
|
|
1444 Buffer Handling}, for details.
|
|
1445 There are also the new commands @kbd{:RelatedFile} and
|
|
1446 @kbd{PreviousRelatedFile} (which abbreviate to @kbd{R} and @kbd{P},
|
|
1447 respectively. @xref{Viper Specials}, for details.
|
|
1448 @findex @kbd{:RelatedFile}
|
|
1449 @findex @kbd{:PreviousRelatedFile}
|
|
1450 @end table
|
|
1451
|
|
1452 Apart from the new commands, many old commands have been enhanced. Most
|
|
1453 notably, Vi style macros are much more powerful in Viper than in Vi. @xref{Vi
|
|
1454 Macros}, for details.
|
|
1455
|
|
1456 @node Useful Packages, ,New Commands, Improvements over Vi
|
|
1457 @section Useful Packages
|
|
1458
|
|
1459 Some Emacs packages are mentioned here as an aid to the new Viper user, to
|
|
1460 indicate what Viper is capable of.
|
|
1461 A vast number comes with the standard Emacs distribution, and many more exist
|
|
1462 on the net and on the archives.
|
|
1463
|
|
1464 This manual also mentions some Emacs features a new user
|
|
1465 should know about. The details of these are found in the GNU Emacs
|
|
1466 Manual.
|
|
1467
|
|
1468 The features first. For details, look up the Emacs Manual.
|
|
1469
|
|
1470 @table @samp
|
|
1471 @item Make
|
|
1472 @cindex make
|
|
1473 @cindex compiling
|
|
1474
|
|
1475 Makes and Compiles can be done from the editor. Error messages will be
|
|
1476 parsed and you can move to the error lines.
|
|
1477 @item Shell
|
|
1478 @cindex shell
|
|
1479 @cindex interactive shell
|
|
1480 You can talk to Shells from inside the editor. Your entire shell session
|
|
1481 can be treated as a file.
|
|
1482 @item Mail
|
|
1483 @cindex email
|
|
1484 @cindex mail
|
|
1485 Mail can be read from and sent within the editor. Several sophisticated
|
|
1486 packages exist.
|
|
1487 @item Language Sensitive Editing
|
|
1488 Editing modes are written for most computer languages in existence. By
|
|
1489 controlling indentation, they catch punctuation errors.
|
|
1490 @end table
|
|
1491
|
|
1492 The packages, below, represents a drop in the sea of special-purpose
|
|
1493 packages that come with standard distribution of Emacs 19.
|
|
1494
|
|
1495 @table @samp
|
|
1496 @item Transparent FTP
|
|
1497 @cindex transparent ftp
|
|
1498 @pindex ange-ftp.el
|
|
1499 @code{ange-ftp.el} can ftp from the editor to files on other machines
|
|
1500 transparent to the user.
|
|
1501 @item RCS Interfaces
|
|
1502 @cindex version maintenance
|
|
1503 @cindex RCS
|
|
1504 @pindex vc.el
|
|
1505 @code{vc.el} for doing RCS commands from inside the editor
|
|
1506 @item Directory Editor
|
|
1507 @cindex dired
|
|
1508 @pindex dired.el
|
|
1509 @code{dired.el} for editing contents of directories and for navigating in
|
|
1510 the file system.
|
|
1511 @item Syntactic Highlighting
|
|
1512 @cindex hilit19
|
|
1513 @pindex hilit19.el
|
|
1514 @cindex font-lock
|
|
1515 @pindex font-lock.el
|
78
|
1516 @code{font-lock.el} for automatic highlighting various parts of a buffer
|
0
|
1517 using different fonts and colors.
|
|
1518 @item Saving Emacs Configuration
|
|
1519 @cindex desktop
|
|
1520 @pindex desktop.el
|
|
1521 @code{desktop.el} for saving/restoring configuration on Emacs exit/startup.
|
|
1522 @item Spell Checker
|
|
1523 @cindex ispell
|
|
1524 @pindex ispell.el
|
|
1525 @code{ispell.el} for spell checking the buffer, words, regions, etc.
|
|
1526 @item File and Buffer Comparison
|
|
1527 @cindex ediff
|
|
1528 @pindex ediff.el
|
|
1529 @code{ediff.el} for finding differences between files and for applying
|
|
1530 patches.
|
|
1531 @end table
|
|
1532
|
|
1533 @noindent
|
|
1534 Emacs Lisp archives exist on
|
|
1535 @samp{archive.cis.ohio-state.edu}
|
|
1536 and @samp{wuarchive.wustl.edu}@refill
|
|
1537
|
|
1538
|
|
1539 @node Customization,Commands,Improvements over Vi,Top
|
|
1540 @chapter Customization
|
|
1541
|
|
1542 @cindex customization
|
|
1543
|
|
1544 Customization can be done in 2 ways.
|
|
1545
|
|
1546 @itemize @bullet
|
|
1547 @item
|
|
1548 @cindex initialization
|
|
1549 @cindex .vip
|
|
1550 Elisp code in a @file{.vip} file in your home directory. Viper
|
|
1551 loads @file{.vip} just before it does the binding for mode
|
|
1552 hooks. This is the recommended method.
|
|
1553 @item
|
|
1554 @cindex .emacs
|
|
1555 Elisp code in your @file{.emacs} file before and after the
|
|
1556 @code{(require 'viper)} line. This method is not recommended, unless you
|
|
1557 are know what you are doing.@refill
|
|
1558 @end itemize
|
|
1559
|
|
1560 @noindent
|
|
1561 Emacs customization is done in Emacs Lisp. For the common cases,
|
|
1562 examples are provided that you can use directly.
|
|
1563
|
|
1564 @menu
|
|
1565 * Rudimentary Changes:: Simple constant definitions.
|
|
1566 * Keybindings:: Enabling Emacs Keys, Rebinding keys, etc.
|
|
1567 * Packages that Change Keymaps:: How to deal with such beasts.
|
|
1568 * Viper Specials:: Special Viper commands.
|
|
1569 * Vi Macros:: How to do Vi style macros.
|
|
1570 @end menu
|
|
1571
|
|
1572 @node Rudimentary Changes,Keybindings,Customization,Customization
|
|
1573 @section Rudimentary Changes
|
|
1574
|
|
1575 @cindex setting variables
|
|
1576 @cindex variables for customization
|
|
1577 @findex @kbd{:set}
|
|
1578
|
|
1579 An easy way to customize Viper is to change the values of constants used in
|
|
1580 Viper. Here is the list of the constants used in Viper and their default
|
|
1581 values. The corresponding :se command is also indicated. (The symbols
|
|
1582 @code{t} and @code{nil} represent ``true'' and ``false'' in Lisp).
|
|
1583
|
|
1584 Viper supports both the abbreviated Vi variable names and their full
|
|
1585 names. Variable completion is done on full names only. @kbd{TAB} and
|
|
1586 @kbd{SPC} complete
|
|
1587 variable names. Typing `=' will complete the name and then will prompt for
|
|
1588 a value, if applicable. For instance, @kbd{:se auSPC} will complete the
|
|
1589 command to @kbd{:set autoindent}; @kbd{:se taSPC} will complete the command
|
|
1590 and prompt further like this: @kbd{:set tabstop = }.
|
|
1591 However, typing @kbd{:se tsSPC} will produce a ``No match'' message
|
|
1592 because @kbd{ts} is an abbreviation for @kbd{tabstop} and Viper supports
|
|
1593 completion on full names only. However, you can still hit @kbd{RET}
|
|
1594 or @kbd{=}, which will complete the command like this: @kbd{:set ts = } and
|
|
1595 Viper will be waiting for you to type a value for the tabstop variable.
|
|
1596 To get the full list of Vi variables, type @kbd{:se SPC TAB}.
|
|
1597
|
|
1598 @table @code
|
|
1599 @item vip-auto-indent nil
|
|
1600 @itemx :se ai (:se autoindent)
|
|
1601 @itemx :se gai (:se global-autoindent)
|
|
1602 If @code{t}, enable auto indentation.
|
|
1603 by @kbd{RET}, @kbd{o} or @kbd{O} command.
|
|
1604
|
|
1605 @code{vip-auto-indent} is a local variable. To change the value globally, use
|
|
1606 @code{setq-default}. It may be useful for certain major modes to have their
|
|
1607 own values of @code{vip-auto-indent}. This can be achieved by using
|
|
1608 @code{setq} to change the local value of this variable in the hooks to the
|
|
1609 appropriate major modes.
|
|
1610
|
|
1611 @kbd{:se ai} changes the value of @code{vip-auto-indent} in the current
|
|
1612 buffer only; @kbd{:se gai} does the same globally.
|
|
1613 @item vip-electric-mode t
|
78
|
1614 If not @code{nil}, auto-indentation becomes electric, which means that
|
|
1615 @kbd{RET}, @kbd{O}, and @kbd{o} indent cursor according to the current
|
|
1616 major mode. In the future, this variable may control additional electric
|
|
1617 features.
|
0
|
1618
|
|
1619 This is a local variable: @code{setq} changes the value of this variable
|
|
1620 in the current buffer only. Use @code{setq-default} to change the value in
|
|
1621 all buffers.
|
|
1622 @item vip-case-fold-search nil
|
|
1623 @itemx :se ic (:se ignorecase)
|
78
|
1624 If not @code{nil}, search ignores cases.
|
0
|
1625 This can also be toggled by quickly hitting @kbd{/} twice.
|
|
1626 @item vip-re-search nil
|
|
1627 @itemx :se magic
|
78
|
1628 If not @code{nil}, search will use regular expressions; if @code{nil} then
|
|
1629 use vanilla search.
|
0
|
1630 This behavior can also be toggled by quickly hitting @kbd{/} trice.
|
|
1631 @item buffer-read-only
|
|
1632 @itemx :se ro (:se readonly)
|
|
1633 Set current buffer to read only. To change globally put
|
|
1634 @code{(setq-default buffer-read-only t)} in your @file{.emacs} file.
|
|
1635 @item blink-matching-paren t
|
|
1636 @itemx :se sm (:se showmatch)
|
|
1637 Show matching parens by blinking cursor.
|
|
1638 @item tab-width t (default setting via @code{setq-default})
|
|
1639 @itemx :se ts=value (:se tabstop=value)
|
|
1640 @itemx :se gts=value (:se global-tabstop=value)
|
|
1641 @code{tab-width} is a local variable that controls the width of the tab stops.
|
|
1642 To change the value globally, use @code{setq-default}; for local settings,
|
|
1643 use @code{setq}.
|
|
1644
|
|
1645 The command @kbd{:se ts}
|
|
1646 sets the tab width in the current
|
|
1647 buffer only; it has no effect on other buffers.
|
|
1648
|
|
1649 The command @kbd{:se gts} sets tab width globally,
|
|
1650 for all buffers where the tab is not yet set locally,
|
|
1651 including the new buffers.
|
|
1652
|
|
1653 Note that typing @kbd{TAB} normally
|
|
1654 doesn't insert the tab, since this key is usually bound to
|
|
1655 a text-formatting function, @code{indent-for-tab-command} (which facilitates
|
|
1656 programming and document writing). Instead, the tab is inserted via the
|
|
1657 command @code{vip-insert-tab}, which is bound to @kbd{S-tab} (shift + tab).
|
|
1658
|
|
1659 On some non-windowing terminals, Shift doesn't modify the @kbd{TAB} key, so
|
|
1660 @kbd{S-tab} behaves as if it were @kbd{TAB}. In such a case, you will have
|
|
1661 to bind @code{vip-insert-tab} to some other convenient key.
|
|
1662
|
|
1663 @item vip-shift-width 8
|
|
1664 @itemx :se sw=value (:se shiftwidth=value)
|
|
1665 The number of columns shifted by @kbd{>} and @kbd{<} commands.
|
|
1666 @item vip-search-wrap-around t
|
|
1667 @itemx :se ws (:se wrapscan)
|
78
|
1668 If not @code{nil}, search wraps around the end/beginning of buffer.
|
80
|
1669 @item vip-search-scroll-threshold 2
|
|
1670 In search lands within this many lines of the window top or bottom, the
|
|
1671 window will be scrolled up or down by about 1/7-th of its size, to reveal
|
|
1672 the context. If the value is negative---don't scroll.
|
0
|
1673 @item vip-tags-file-name "TAGS"
|
|
1674 The name of the file used as the tag table.
|
|
1675 @item vip-re-query-replace nil
|
78
|
1676 If not @code{nil}, use reg-exp replace in query replace.
|
0
|
1677 @item vip-want-ctl-h-help nil
|
78
|
1678 If not @code{nil}, @kbd{C-h} is bound to @code{help-command};
|
0
|
1679 if @code{nil}, it is bound to @code{delete-backward-char}.
|
|
1680 @item vip-vi-style-in-minibuffer t
|
78
|
1681 If not @code{nil}, Viper provides a high degree of compatibility with Vi
|
|
1682 insert mode when you type text in the Minibuffer; if @code{nil}, typing in
|
|
1683 the Minibuffer feels like plain Emacs.
|
0
|
1684 @item vip-no-multiple-ESC t
|
|
1685 If you set this to @code{nil}, you can use @kbd{ESC} as Meta in Vi state.
|
|
1686 Normally, this is not necessary, since graphical displays have separate
|
|
1687 Meta keys (usually on each side of the space bar). On a dumb terminal, Viper
|
|
1688 sets this variable to @code{twice}, which is almost like @code{nil}, except
|
|
1689 that double @kbd{ESC} beeps. This, too, lets ESC to be used as a Meta.
|
|
1690 @item vip-keysequence-delay 140
|
|
1691 Escape sequences separated by this much delay are interpreted as command,
|
|
1692 ignoring the special meaning of ESC in VI. The default is suitable for most
|
|
1693 terminals. However, if your terminal is extremely slow, you
|
|
1694 might want to increase this slightly. You will know if your terminal is
|
|
1695 slow if the ESC key sequences emitted by the arrow keys are interpreted as
|
|
1696 separately typed characters (and thus the arrow keys won't work).
|
|
1697 Making this value too large will slow you down, so exercise restraint.
|
|
1698 @item vip-ex-style-motion t
|
|
1699 Set this to @code{nil}, if you want @kbd{l,h} to cross
|
|
1700 lines, etc. @xref{Movement and Markers}, for more info.
|
|
1701 @item vip-ex-style-editing-in-insert t
|
78
|
1702 Set this to to @code{nil}, if you want @kbd{ESC} to not move back and
|
0
|
1703 @kbd{C-h} to not stop
|
|
1704 at the beginning of a line in Insert state.
|
|
1705 @item vip-always t
|
|
1706 Leave it to Viper to decide when a buffer must be brought up in Vi state,
|
|
1707 Insert state, or Emacs state. This heuristics works well in virtually all
|
|
1708 cases.
|
|
1709 This option must be
|
|
1710 set before Viper is loaded or in the @file{.vip} file.
|
|
1711 @item vip-custom-file-name "~/.vip"
|
|
1712 Change this if you want. Must be set in @file{.emacs} (not @file{.vip}!)
|
|
1713 before Viper is loaded. Note that you
|
|
1714 have to set it as a string inside double quotes.
|
|
1715 @item vip-spell-function 'ispell-region
|
|
1716 Function used by the command @kbd{#c<move>} to spell.
|
|
1717 @item ex-nontrivial-find-file-function
|
|
1718 The value of this variable is the function used to find all files that
|
|
1719 match a wildcard. This is usually done when the user types @kbd{:e} and
|
|
1720 specifies a wildcard in the file name (or if the file name contains unusual
|
|
1721 symbols (e.g., a space). Viper provides two functions for this: one for
|
|
1722 Unix-like systems (@code{vip-ex-nontrivial-find-file-unix}) and one for
|
|
1723 DOS, W95, and NT (@code{vip-ex-nontrivial-find-file-ms}). If the default
|
|
1724 function doesn't quite do what you expect or if you prefer to use ``fancy''
|
|
1725 shells, you may have to write your own version of this function and make it
|
|
1726 into the value of @code{ex-nontrivial-find-file-function}. Use
|
|
1727 @code{vip-ex-nontrivial-find-file-unix} and
|
|
1728 @code{vip-ex-nontrivial-find-file-ms} as examples.
|
|
1729 @vindex @code{ex-nontrivial-find-file-function}.
|
|
1730 @findex @code{vip-ex-nontrivial-find-file-ms}
|
|
1731 @findex @code{vip-ex-nontrivial-find-file-unix}
|
|
1732 @item ex-cycle-other-window t
|
78
|
1733 If not @code{nil}, @kbd{:n} and @kbd{:b} will cycle through files in another
|
0
|
1734 window, if one exists.
|
|
1735 @item ex-cycle-through-non-files nil
|
|
1736 @kbd{:n} does not normally cycle through buffers. Set this to get
|
|
1737 buffers also.
|
|
1738 @item vip-automatic-iso-accents nil
|
|
1739 If @kbd{t}, ISO accents will be turned on in insert/replace Viper states
|
|
1740 and turned off in Vi state. This is useful for editing text in European
|
|
1741 languages. This variable is buffer-local. If used, it should be set in the
|
|
1742 hooks to the appropriate major modes (usually setting it in
|
|
1743 @code{text-mode-hook} is enough).
|
|
1744 @item vip-want-emacs-keys-in-insert
|
|
1745 This is set to @code{nil} for user levels 1 and 2 and to @code{t} for user
|
|
1746 levels 3 and 4. Users who specify level 5 are allowed to set this variable
|
|
1747 as they please (the default for this level is @code{t}). If set to
|
|
1748 @code{nil}, complete Vi compatibility is provided in Insert state. This is
|
|
1749 really not recommended, as this precludes you from using language-specific
|
|
1750 features provided by the major modes.
|
|
1751 @item vip-want-emacs-keys-in-vi
|
|
1752 This is set to @code{nil} for user
|
|
1753 level 1 and to @code{t} for user levels 2--4.
|
|
1754 At level 5, users are allowed to set this variable as they please (the
|
|
1755 default for this level is @code{t}).
|
|
1756 If set to @code{nil}, complete Vi compatibility is provided
|
|
1757 in Vi command state. Setting this to @code{nil} is really a bad idea,
|
|
1758 unless you are a novice, as this precludes the use
|
|
1759 of language-specific features provided by the major modes.
|
|
1760 @item vip-keep-point-on-repeat t
|
78
|
1761 If not @code{nil}, point is not moved when the user repeats the previous
|
|
1762 command by typing `.' This is very useful for doing repeated changes with
|
|
1763 the @kbd{.} key.
|
0
|
1764 @item vip-repeat-from-history-key 'f12
|
|
1765 Prefix key used to invoke the macros @kbd{f12 1} and @kbd{f12 2} that repeat
|
|
1766 the second-last and the third-last destructive command.
|
|
1767 Both these macros are bound (as Viper macros) to
|
|
1768 @code{vip-repeat-from-history},
|
|
1769 which checks the second key by which it is invoked to see which of the
|
|
1770 previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only,
|
|
1771 but the user can bind more in @file{~/.vip}. @xref{Vi Macros}, for how to do
|
|
1772 this.
|
|
1773 @item vip-keep-point-on-undo nil
|
78
|
1774 If not @code{nil}, Viper tries to not move point when undoing commands.
|
0
|
1775 Instead, it will briefly move the cursor to the place where change has
|
|
1776 taken place. However, if the undone piece of text is not seen in window,
|
|
1777 then point will be moved to the place where the change took place.
|
|
1778 Set it to @code{t} and see if you like it better.
|
|
1779 @item vip-delete-backwards-in-replace nil
|
78
|
1780 If not @code{nil}, DEL key will delete characters while moving the cursor
|
|
1781 backwards. If @code{nil}, the cursor will move backwards without deleting
|
|
1782 anything.
|
0
|
1783 @item vip-replace-overlay-face 'vip-replace-overlay-face
|
78
|
1784 @itemx vip-replace-overlay-pixmap "grey3"
|
0
|
1785 On a graphical display, Viper highlights replacement regions instead of
|
|
1786 putting a @samp{$} at the end. This variable controls the so called
|
|
1787 @dfn{face} used to highlight the region.
|
|
1788
|
78
|
1789 By default, @code{vip-replace-overlay-face} underlines the replacement on
|
|
1790 monochrome displays and also lays a pixmap over them (as specified in the
|
|
1791 variable @code{vip-replace-overlay-pixmap}. On color displays, replacement
|
|
1792 regions are highlighted with color.
|
|
1793
|
|
1794 If you know something about Emacs faces and don't like how Viper highlights
|
|
1795 replacement regions, you can change @code{vip-replace-overlay-face} by
|
|
1796 specifying a new face. (Emacs faces are described in the Emacs Lisp
|
|
1797 reference.) On a color display, the following customization method is
|
|
1798 usually most effective:
|
0
|
1799 @example
|
|
1800 (set-face-foreground vip-replace-overlay-face "DarkSlateBlue")
|
|
1801 (set-face-background vip-replace-overlay-face "yellow")
|
|
1802 @end example
|
78
|
1803 For a complete list of colors available to you, evaluate the expression
|
|
1804 @code{(x-defined-colors)}. (Type it in the buffer @code{*scratch*} and then
|
|
1805 hit the @kbd{C-j} key.
|
|
1806
|
|
1807 On a monochrome display, you can change the value of the variable
|
|
1808 @code{vip-replace-overlay-pixmap} to specify the pixmap of your choice
|
|
1809 (which should be a string denoting the file name of the pixmap). Emacs
|
|
1810 takes pixmaps from the directory specified in the variable
|
|
1811 @code{x-bitmap-file-path}.
|
0
|
1812 @item vip-replace-overlay-cursor-color "Red"
|
78
|
1813 @vindex @code{vip-replace-overlay-cursor-color}
|
0
|
1814 Cursor color when it is inside the replacement region.
|
|
1815 This has effect only on color displays and only when Emacs runs as an X
|
|
1816 application.
|
78
|
1817 @item vip-insert-state-cursor-color nil
|
|
1818 @vindex @code{vip-insert-state-cursor-color}
|
|
1819 If set to a valid color, this will be the cursor color when Viper is in
|
|
1820 insert state.
|
0
|
1821 @item vip-replace-region-end-delimiter "$"
|
78
|
1822 A string used to mark the end of replacement regions. It is used only on
|
0
|
1823 TTYs or if @code{vip-use-replace-region-delimiters} is non-nil.
|
|
1824 @item vip-replace-region-start-delimiter ""
|
|
1825 A string used to mark the beginning of replacement regions. It is used
|
78
|
1826 only on TTYs or if @code{vip-use-replace-region-delimiters} is non-nil.
|
0
|
1827 @item vip-use-replace-region-delimiters
|
|
1828 If non-nil, Viper will always use @code{vip-replace-region-end-delimiter} and
|
|
1829 @code{vip-replace-region-start-delimiter} to delimit replacement regions,
|
|
1830 even on color displays (where this is unnecessary). By default, this
|
|
1831 variable is non-nil only on TTYs or monochrome displays.
|
82
|
1832 @item vip-allow-multiline-replace-regions t
|
|
1833 If non-nil, multi-line text replacement regions, such as those produced by
|
|
1834 commands @kbd{c55w}, @kbd{3C}, etc., will stay around until the user exits
|
|
1835 the replacement mode. In this variable is set to @code{nil}, Viper will
|
|
1836 emulate the standard Vi behavior, which supports only intra-line
|
|
1837 replacement regions (and multi-line replacement regions are deleted).
|
0
|
1838 @item vip-toggle-key "\C-z"
|
|
1839 Specifies the key used to switch from Emacs to Vi and back.
|
|
1840 Must be set in @file{.vip} or prior to loading Viper. This variable can't be
|
|
1841 changed interactively after Viper is loaded.
|
78
|
1842
|
|
1843 In Insert state, this key acts as a temporary escape to Vi state, i.e., it
|
|
1844 will set Viper up so that the very next command will be executed as if it
|
|
1845 were typed in Vi state.
|
0
|
1846 @item vip-ESC-key "\e"
|
|
1847 Specifies the key used to escape from Insert/Replace states to Vi.
|
|
1848 Must be set in @file{.vip} or prior to loading Viper. This variable cannot be
|
|
1849 changed interactively after Viper is loaded.
|
|
1850 @item vip-buffer-search-char nil
|
|
1851 Key used for buffer search. @xref{Viper Specials}, for details.
|
|
1852 @item vip-surrounding-word-function 'vip-surrounding-word
|
|
1853 The value of this variable is a function name that is used to determine
|
|
1854 what constitutes a word clicked upon by the mouse. This is used by mouse
|
|
1855 search and insert.
|
|
1856 @item vip-search-face 'vip-search-face
|
|
1857 Variable that controls how search patterns are highlighted when they are
|
|
1858 found.
|
|
1859 @item vip-vi-state-hook nil
|
|
1860 List of parameterless functions to be run just after entering the Vi
|
|
1861 command state.
|
|
1862 @item vip-insert-state-hook nil
|
|
1863 Same for Insert state. This hook is also run after entering Replace state.
|
|
1864 @item vip-replace-state-hook nil
|
|
1865 List of (parameterless) functions called just after entering Replace state
|
|
1866 (and after all @code{vip-insert-state-hook}).
|
|
1867 @item vip-emacs-state-hook nil
|
|
1868 List of (parameterless) functions called just after switching from Vi state
|
|
1869 to Emacs state.
|
|
1870 @item vip-load-hook nil
|
|
1871 List of (parameterless) functions called just after loading Viper. This is
|
|
1872 the last chance to do customization before Viper is up and running.
|
|
1873 @end table
|
|
1874 @noindent
|
|
1875 You can reset some of these constants in Viper with the Ex command @kbd{:set}
|
|
1876 (when so indicated in the table). Or you
|
|
1877 can include a line like this in your @file{.vip} file:
|
|
1878 @example
|
|
1879 (setq vip-case-fold-search t)
|
|
1880 @end example
|
|
1881 @vindex @code{vip-auto-indent}
|
|
1882 @vindex @code{vip-electric-mode}
|
|
1883 @vindex @code{vip-case-fold-search}
|
|
1884 @vindex @code{vip-re-search}
|
|
1885 @vindex @code{vip-shift-width}
|
|
1886 @vindex @code{buffer-read-only}
|
|
1887 @vindex @code{vip-search-wrap-around}
|
80
|
1888 @vindex @code{vip-search-scroll-threshold}
|
0
|
1889 @vindex @code{vip-search-face}
|
|
1890 @vindex @code{vip-tags-file-name}
|
|
1891 @vindex @code{vip-re-query-replace}
|
|
1892 @vindex @code{vip-want-ctl-h-help}
|
|
1893 @vindex @code{vip-vi-style-in-minibuffer}
|
|
1894 @vindex @code{vip-no-multiple-ESC}
|
|
1895 @vindex @code{vip-always}
|
|
1896 @vindex @code{vip-keysequence-delay}
|
|
1897 @vindex @code{vip-ex-style-motion}
|
|
1898 @vindex @code{vip-ex-style-editing-in-insert}
|
|
1899 @vindex @code{vip-custom-file-name}
|
|
1900 @vindex @code{vip-spell-function}
|
|
1901 @vindex @code{ex-cycle-other-window}
|
|
1902 @vindex @code{ex-cycle-through-non-files}
|
|
1903 @vindex @code{vip-automatic-iso-accents}
|
|
1904 @vindex @code{vip-want-emacs-keys-in-insert}
|
|
1905 @vindex @code{vip-want-emacs-keys-in-vi}
|
|
1906 @vindex @code{vip-keep-point-on-repeat}
|
|
1907 @vindex @code{vip-keep-point-on-undo}
|
|
1908 @vindex @code{vip-delete-backwards-in-replace}
|
|
1909 @vindex @code{vip-replace-overlay-face}
|
78
|
1910 @vindex @code{vip-replace-overlay-pixmap}
|
0
|
1911 @vindex @code{vip-replace-region-end-symbol}
|
|
1912 @vindex @code{vip-replace-region-start-symbol}
|
82
|
1913 @vindex @code{vip-allow-multiline-replace-regions}
|
0
|
1914 @vindex @code{vip-toggle-key}
|
|
1915 @vindex @code{vip-ESC-key}
|
|
1916 @vindex @code{vip-buffer-search-char}
|
|
1917 @vindex @code{vip-surrounding-word-function}
|
|
1918 @vindex @code{vip-vi-state-hook}
|
|
1919 @vindex @code{vip-insert-state-hook}
|
|
1920 @vindex @code{vip-replace-state-hook}
|
|
1921 @vindex @code{vip-emacs-state-hook}
|
|
1922
|
|
1923 @node Keybindings, Packages that Change Keymaps, Rudimentary Changes,Customization
|
|
1924 @section Keybindings
|
|
1925
|
|
1926 @cindex keybindings
|
|
1927 @cindex keymaps
|
|
1928
|
|
1929 Viper lets you define hot keys, i.e., you can associate keyboard keys
|
|
1930 such as F1, Help, PgDn, etc., with Emacs Lisp functions (that may already
|
|
1931 exist or that you will write). Each key has a "preferred form" in
|
|
1932 Emacs. For instance, the Up key's preferred form is [up], the Help key's
|
|
1933 preferred form is [help], and the Undo key has the preferred form [f14].
|
|
1934 You can find out the preferred form of a key by typing @kbd{M-x
|
|
1935 describe-key-briefly} and then typing the key you want to know about.
|
|
1936
|
|
1937 Under X Windows, every keyboard key emits its preferred form, so you can
|
|
1938 just type
|
|
1939
|
|
1940 @lisp
|
|
1941 (global-set-key [f11] 'calendar) ; L1, Stop
|
|
1942 (global-set-key [f14] 'undo) ; L4, Undo
|
|
1943 @end lisp
|
|
1944
|
|
1945 @noindent
|
|
1946 to bind L1 so it will invoke the Emacs Calendar and to bind L4 so it will
|
|
1947 undo changes.
|
|
1948 However, on a dumb terminal or in an Xterm window, even the standard arrow
|
|
1949 keys may
|
|
1950 not emit the right signals for Emacs to understand. To let Emacs know about
|
|
1951 those keys, you will have to find out which key sequences they emit
|
|
1952 by typing @kbd{C-q} and then the key (you should switch to Emacs state
|
|
1953 first). Then you can bind those sequences to their preferred forms using
|
|
1954 @code{function-key-map} as follows:
|
|
1955
|
|
1956 @lisp
|
|
1957 (cond ((string= (getenv "TERM") "xterm")
|
|
1958 (define-key function-key-map "\e[192z" [f11]) ; L1
|
|
1959 (define-key function-key-map "\e[195z" [f14]) ; L4, Undo
|
|
1960 @end lisp
|
|
1961
|
|
1962 The above illustrates how to do this for Xterm. On VT100, you would have to
|
|
1963 replace "xterm" with "vt100" and also change the key sequences (the same
|
|
1964 key may emit different sequences on different types of terminals).
|
|
1965
|
|
1966 The above keys are global, so they are overwritten by the local maps
|
|
1967 defined by the major modes and by Viper itself. Therefore, if you wish to
|
|
1968 change a binding set by a major mode or by Viper, read this.
|
|
1969
|
|
1970 Viper users who wish to specify their own key bindings should be concerned
|
|
1971 only with the following three keymaps:
|
|
1972 @code{vip-vi-global-user-map} for Vi state commands,
|
|
1973 @code{vip-insert-global-user-map} for Insert state commands,
|
|
1974 and @code{vip-emacs-global-user-map} for Emacs state commands (note:
|
|
1975 customized bindings for Emacs state made to @code{vip-emacs-global-user-map}
|
|
1976 are @emph{not} inherited by Insert state).
|
|
1977
|
|
1978 For more information on Viper keymaps, see the header of the file
|
|
1979 @file{viper.el}.
|
|
1980 If you wish to change a Viper binding, you can use the
|
|
1981 @code{define-key} command, to modify @code{vip-vi-global-user-map},
|
|
1982 @code{vip-insert-global-user-map}, and @code{vip-emacs-global-user-map}, as
|
|
1983 explained below. Each of these key maps affects the corresponding Viper state.
|
|
1984 The keymap @code{vip-vi-global-user-map} also affects Viper's Replace state.
|
|
1985
|
|
1986 @noindent
|
|
1987 If you want to
|
|
1988 bind a key, say @kbd{C-v}, to the function that scrolls
|
|
1989 page down and to make @kbd{0} display information on the current buffer,
|
|
1990 putting this in @file{.vip} will do the trick in Vi state:
|
|
1991 @example
|
|
1992 (define-key vip-vi-global-user-map "\C-v" 'scroll-down)
|
|
1993 @end example
|
|
1994 @noindent
|
|
1995 To set a key globally,
|
|
1996 @example
|
|
1997 (define-key vip-emacs-global-user-map "\C-c m" 'smail)
|
|
1998 (define-key vip-vi-global-user-map "0" 'vip-info-on-file)
|
|
1999 @end example
|
|
2000 @noindent
|
|
2001 Note, however, that this binding may be overwritten by other keymaps, since
|
|
2002 the global keymap has the lowest priority.
|
|
2003 To make sure that nothing will override a binding in Emacs state, you
|
|
2004 can write this:
|
|
2005 @example
|
|
2006 (define-key vip-emacs-global-user-map "\C-c m" 'smail)
|
|
2007 @end example
|
|
2008 @noindent
|
|
2009 To customize the binding for @kbd{C-h} in Insert state:
|
|
2010 @example
|
|
2011 (define-key vip-insert-global-user-map "\C-h" 'my-del-backwards-function)
|
|
2012 @end example
|
|
2013 @noindent
|
|
2014
|
|
2015 Each Emacs command key calls some lisp function. If you have enabled the
|
|
2016 Help, (@xref{Rudimentary Changes}) @kbd{C-h k} will show you the function
|
|
2017 for each specific key; @kbd{C-h b} will show all bindings, and @kbd{C-h m}
|
|
2018 will provide information on the major mode in effect. If Help is not
|
|
2019 enabled, you can still get help in Vi state by prefixing the above commands
|
|
2020 with @kbd{\}, e.g., @kbd{\ C-h k} (or you can use the Help menu in the
|
|
2021 menu bar, if Emacs runs under X Windows).
|
|
2022
|
|
2023 Viper users can also change bindings on a per major mode basis. As with
|
|
2024 global bindings, this can be done separately for each of the three main Viper
|
|
2025 states. To this end, Viper provides the function
|
|
2026 @code{vip-modify-major-mode}.
|
|
2027 @findex @code{vip-modify-major-mode}
|
|
2028
|
|
2029 To modify keys in Emacs state for @code{my-favorite-major-mode}, the user
|
|
2030 needs to create a sparse keymap, say, @code{my-fancy-map}, bind whatever
|
|
2031 keys necessary in that keymap, and put
|
|
2032
|
|
2033 @example
|
|
2034 (vip-modify-major-mode 'dired-mode 'emacs-state my-fancy-map)
|
|
2035 @end example
|
|
2036
|
|
2037 @noindent
|
|
2038 in @file{~/.vip}. To do the same in Vi and Insert states, one should use
|
|
2039 @code{vi-state} and @code{insert-state}. Changes in Insert state are also
|
|
2040 in effect in Replace state. For instance, suppose that the user wants to
|
|
2041 use @kbd{dd} in Vi state under Dired mode to delete files, @kbd{u} to unmark
|
|
2042 files, etc. The following code in @file{~/.vip} will then do the job:
|
|
2043
|
|
2044 @example
|
|
2045 (setq my-dired-modifier-map (make-sparse-keymap))
|
|
2046 (define-key my-dired-modifier-map "dd" 'dired-flag-file-deletion)
|
|
2047 (define-key my-dired-modifier-map "u" 'dired-unmark)
|
|
2048 (vip-modify-major-mode 'dired-mode 'vi-state my-dired-modifier-map)
|
|
2049 @end example
|
|
2050
|
|
2051 A Vi purist may want to modify Emacs state under Dired mode so that
|
|
2052 @kbd{k}, @kbd{l}, etc., will move around in directory buffers, as in
|
|
2053 Vi. Although this is not recommended, as these keys are bound to useful
|
|
2054 Dired functions, the trick can be accomplished via the following code:
|
|
2055
|
|
2056 @example
|
|
2057 (setq my-dired-vi-purist-map (make-sparse-keymap))
|
|
2058 (define-key my-dired-vi-purist-map "k" 'vip-previous-line)
|
|
2059 (define-key my-dired-vi-purist-map "l" 'vip-forward-char)
|
|
2060 (vip-modify-major-mode 'dired-mode 'emacs-state my-dired-vi-purist-map)
|
|
2061 @end example
|
|
2062
|
|
2063 Similar effect can be achieved by defining Vi keyboard macros using the
|
|
2064 Ex commands @kbd{:map} and @kbd{:map!}. The difference is that multi-key
|
|
2065 Vi macros do not override the keys they are bound to, unless these keys are
|
|
2066 typed in quick succession. So, with macros, one can use the normal keys
|
|
2067 alongside with the macros. If per-mode modifications are needed, the user
|
|
2068 can try both ways and see which one is more convenient.
|
|
2069 @findex @kbd{:map}
|
|
2070 @xref{Vi Macros}, for details.
|
|
2071
|
|
2072 Note: in major modes that come up in @emph{Emacs state} by default, the
|
|
2073 aforesaid modifications may not take place immediately (but only after the
|
|
2074 buffer switches to some other Viper state and then back to Emacs state). To
|
|
2075 avoid this, one should add @code{vip-change-state-to-emacs} to an
|
|
2076 appropriate hook of that major mode. (Check the function
|
|
2077 @code{vip-set-hooks} in @file{viper.el} for examples.) However, if you
|
|
2078 have set @code{vip-always} to @code{t}, chances are that you won't need to
|
|
2079 perform the above procedure, because Viper will take care of most useful
|
|
2080 defaults.
|
|
2081
|
|
2082
|
|
2083 Finally, Viper has a facility that lets the user define per-buffer
|
|
2084 bindings, i.e., bindings that are in effect in some specific buffers
|
|
2085 only. Unlike per-mode bindings described above, per-buffer bindings can be
|
|
2086 defined based on considerations other than the major mode. This is done
|
|
2087 via the function @code{vip-add-local-keys}, which lets one specify bindings
|
|
2088 that should be in effect in the current buffer only and for a specific Viper
|
|
2089 state. For instance,
|
|
2090 @lisp
|
|
2091 (vip-add-local-keys 'vi-state '(("ZZ" . TeX-command-master)
|
|
2092 ("ZQ" . vip-save-kill-buffer)))
|
|
2093 @end lisp
|
|
2094 @noindent
|
|
2095 redefines @kbd{ZZ} to invoke @code{TeX-command-master} in @code{vi-state}
|
|
2096 and @kbd{ZQ} to save-then-kill the current buffer. These bindings take
|
|
2097 effect only in the buffer where this command is executed. The typical use
|
|
2098 of this function is to execute the above expression from within a function
|
|
2099 that is included in a hook to some major mode. For instance, the above
|
|
2100 expression
|
|
2101 could be called from a function, @code{my-tex-init}, which may be added to
|
|
2102 @code{tex-mode-hook} as follows:
|
|
2103 @lisp
|
|
2104 (add-hook 'tex-mode-hook 'my-tex-init)
|
|
2105 @end lisp
|
|
2106 @noindent
|
|
2107 When TeX mode starts, the hook is executed and the above Lisp expression is
|
|
2108 evaluated. Then, the bindings for @kbd{ZZ} and @kbd{ZQ} are changed in Vi
|
|
2109 command mode for all buffers in TeX mode.
|
|
2110
|
|
2111 Another useful application is to bind @kbd{ZZ} to @code{send-mail}
|
|
2112 in the Mail mode buffers (the specifics of this depend on which mail
|
|
2113 package you are using, @code{rmail}, @code{mh-e}, @code{vm}, etc.
|
|
2114 For instance, here is how to do this for @code{mh-e}, the Emacs interface
|
|
2115 to MH:
|
|
2116 @lisp
|
|
2117 (defun mh-add-vi-keys ()
|
|
2118 "Set up ZZ for MH-e and XMH."
|
|
2119 (vip-add-local-keys 'vi-state '(("ZZ" . mh-send-letter))))
|
|
2120 (add-hook 'mh-letter-mode-hook 'mh-add-vi-keys)
|
|
2121 @end lisp
|
|
2122
|
|
2123 You can also use @code{vip-add-local-keys} to set per buffer
|
|
2124 bindings in Insert state and Emacs state by passing as a parameter the
|
|
2125 symbols @code{'insert-state} and @code{'emacs-state}, respectively.
|
|
2126 As with global bindings, customized local bindings done to Emacs state
|
|
2127 are not inherited by Insert state.
|
|
2128
|
|
2129 On rare occasions, local keys may be added by mistake. Usually this is done
|
|
2130 indirectly, by invoking a major mode that adds local keys (e.g.,
|
|
2131 @code{shell-mode} redefines @kbd{RET}). In such a case, exiting the wrong
|
|
2132 major mode won't rid you from unwanted local keys, since these keys are
|
|
2133 local to Viper state and the current buffer, not to the major mode.
|
|
2134 In such situations, the remedy is to type @kbd{M-x vip-zap-local-keys}.
|
|
2135
|
|
2136 So much about Viper-specific bindings.
|
|
2137 @xref{Customization,,Customization,emacs,The GNU Emacs
|
|
2138 Manual}, and the Emacs quick reference card for the general info on key
|
|
2139 bindings in Emacs.
|
|
2140
|
|
2141 @vindex @code{function-key-map}
|
|
2142 @vindex @code{vip-vi-global-user-map}
|
|
2143 @vindex @code{vip-insert-global-user-map}
|
|
2144 @vindex @code{vip-emacs-global-user-map}
|
|
2145 @findex @code{vip-add-local-keys}
|
|
2146 @findex @code{vip-zap-local-keys}
|
|
2147
|
|
2148 @node Packages that Change Keymaps,Viper Specials,Keybindings,Customization
|
|
2149 @subsection Packages that Change Keymaps
|
|
2150 @cindex C-c and Viper
|
|
2151 @cindex Viper and C-c
|
|
2152
|
|
2153 Viper is designed to coexist with all major and minor modes of Emacs. This
|
|
2154 means that bindings set by those modes are generally available with Viper
|
|
2155 (unless you explicitly prohibit them by setting
|
|
2156 @code{vip-want-emacs-keys-in-vi} and @code{vip-want-emacs-keys-in-insert} to
|
|
2157 @code{nil}).
|
|
2158 If @code{vip-always} is set to @code{t}, Viper will try to bring each buffer
|
|
2159 in the a Viper state that is most appropriate for that buffer.
|
|
2160 Usually, this would be the Vi state, but sometimes it could be the Insert
|
|
2161 state or the Emacs state.
|
|
2162
|
|
2163 Some major mode bindings will necessarily be overwritten by Viper. Indeed, in
|
|
2164 Vi state, most of the 1-character keys are used for Vi-style editing. This
|
|
2165 usually causes no problems because most packages designed for editing files
|
|
2166 typically do not bind such keys. Instead, they use key sequences that start
|
|
2167 with @kbd{C-x} and @kbd{C-c}. This is why it was so important for us to
|
|
2168 free up @kbd{C-x} and @kbd{C-c}.
|
|
2169 It is common for language-specific major modes to bind @kbd{TAB} and
|
|
2170 @kbd{LFD} (the line feed) keys to various formatting functions. This is
|
|
2171 extremely useful, but may require some getting used to for a Vi user. If you
|
|
2172 decide that this feature is not for you, you can re-bind these keys as
|
|
2173 explained earlier (@xref{Customization}).
|
|
2174
|
|
2175 Binding for @kbd{TAB} is one of the most unusual aspects of Viper for many
|
|
2176 novice users. In Emacs, @kbd{TAB} is used to format text and programs, and
|
|
2177 is extremely useful. For instance, hitting @kbd{TAB} causes the current
|
|
2178 line to be re-indented in accordance with the context. In programming,
|
|
2179 this is very important, since improper automatic indentation would
|
|
2180 immediately alert the programmer to a possible error. For instance, if a
|
|
2181 @kbd{)} or a @kbd{"} is missing somewhere above the current
|
|
2182 line, @kbd{TAB} is likely to mis-indent the line.
|
|
2183
|
|
2184 For this reason, Viper doesn't change the standard Emacs binding of
|
|
2185 @kbd{TAB}, thereby sacrificing Vi compatibility
|
|
2186 (except for users at level 1). Instead, in Viper, the key
|
|
2187 @kbd{S-tab} (shift+ tab) is chosen to emulate Vi's @kbd{TAB}.
|
|
2188
|
|
2189 We should note that on some non-windowing terminals, Shift doesn't modify
|
|
2190 the @kbd{TAB} key, so @kbd{S-tab} behaves as if it were @kbd{TAB}. In such
|
|
2191 a case, you will have to bind @code{vip-insert-tab} to some other
|
|
2192 convenient key.
|
|
2193
|
78
|
2194 Some packages, notably Dired, Gnus, Info, etc., attach special meaning to
|
|
2195 common keys like @kbd{SPC}, @kbd{x}, @kbd{d}, @kbd{v}, and others. This
|
0
|
2196 means that Vi command state is inappropriate for working with these
|
|
2197 packages. Fortunately, these modes operate on read-only buffers and are
|
|
2198 designed not for editing files, but for special-purpose browsing, reading
|
|
2199 news, mail, etc., and Vi commands are meaningless in these situations. For
|
|
2200 this reason, Viper doesn't force Vi state on such major modes. Rather, it
|
|
2201 brings them in Emacs state. You can switch to Vi state by typing @kbd{C-z}
|
|
2202 if, for instance, you want to do Vi-style search in a buffer (although,
|
|
2203 usually, incremental search, which is bound to @kbd{C-s}, is sufficient in
|
|
2204 these situations). But you should then switch back to Emacs state if you
|
|
2205 plan to continue using these major modes productively. You can also switch
|
78
|
2206 to Vi temporarily, to execute just one command. This is done by typing
|
|
2207 @kbd{C-c \}. (In some of these modes, @kbd{/} and @kbd{:} are bound
|
|
2208 Vi-style, unless these keys perform essential duties.)
|
0
|
2209
|
|
2210 It is also possible to harness some major modes, even though they may bind
|
|
2211 common keys to specialized commands. Harnessing can make sense for modes
|
|
2212 that bind only a small number of common keys. For instance, if
|
|
2213 @code{vip-always} is set to @code{t} in your @file{~/.vip} file, Viper will
|
|
2214 harness the Shell mode by changing the bindings for @kbd{C-m} and @kbd{C-d}
|
|
2215 using @code{vip-add-local-keys} described in section on customization
|
|
2216 (@xref{Customization}). In general, there is no single recipe for
|
|
2217 harnessing modes. It can be as simple as adding the function
|
|
2218 @code{viper-mode} to a hook associated with the mode, or it can be more
|
|
2219 complex, as in the case of Shell mode and Emerge. Take a look at
|
|
2220 @code{vip-set-hooks} function for some examples.
|
|
2221
|
|
2222 Conversely, it may be the case that most of the major modes harnessed
|
|
2223 by @code{vip-set-hooks} function fit your working style, except one or two
|
|
2224 cases. In this case, you may still be able to set @code{vip-always} to
|
|
2225 @code{t} and then remove a hook that forces Vi command state. For instance,
|
|
2226 to unharness @code{lisp-interaction-mode}, you can put the following line
|
|
2227 in your @file{.emacs} (not @code{.vip}!) file after @code{(require 'viper)}:
|
|
2228 @lisp
|
|
2229 (remove-hook 'lisp-interaction-mode-hook 'viper-mode)
|
|
2230 @end lisp
|
|
2231
|
|
2232 In some rare cases, some minor modes may override certain essential
|
|
2233 bindings in Vi command state. This is not really catastrophic because this
|
|
2234 may happen only in the beginning, when the minor mode kicks in. Typing
|
|
2235 @code{M-x viper-mode} will correct the situation. Viper knows about
|
|
2236 several such minor modes and takes care of them, so that the above trick
|
|
2237 is usually not necessary. If you find that some minor mode, e.g.,
|
|
2238 @code{nasty-mode.el} interferes with Viper, putting the following in
|
|
2239 @file{.vip} should fix the problem:
|
|
2240 @lisp
|
|
2241 (vip-harness-minor-mode "nasty-mode")
|
|
2242 @end lisp
|
|
2243 @noindent
|
|
2244 The argument to @code{vip-harness-minor-mode} is the name of the file for the
|
|
2245 offending minor mode with the suffixes @file{.el} and @file{.elc} removed.
|
|
2246
|
|
2247 It may be tricky, however, to find out which minor mode is at fault. The
|
|
2248 only guidance here is to look into the file that defines the minor mode you
|
|
2249 are suspecting, say @code{nasty-mode.el}, and see if it has a variable
|
|
2250 called @code{nasty-mode-map}. Then check if there is a statement of the form
|
|
2251 @lisp
|
|
2252 (define-key nasty-mode-map key function)
|
|
2253 @end lisp
|
|
2254 @noindent
|
|
2255 that binds the misbehaving
|
|
2256 keys. If so, use the above line to harness @code{nasty-mode}. If your
|
|
2257 suspicion is wrong, no harm is done if you harness a minor mode that
|
|
2258 doesn't need to be harnessed.
|
|
2259
|
|
2260 @vindex @code{vip-want-emacs-keys-in-vi}
|
|
2261 @vindex @code{vip-want-emacs-keys-in-insert}
|
|
2262 @vindex @code{vip-always}
|
|
2263 @findex @code{vip-set-hooks}
|
|
2264 @findex @code{viper-mode}
|
|
2265 @findex @code{vip-harness-minor-mode}
|
|
2266 @findex @code{remove-hook}
|
|
2267 @findex @code{add-hook}
|
|
2268
|
|
2269 @node Viper Specials,Vi Macros,Packages that Change Keymaps,Customization
|
|
2270 @section Viper Specials
|
|
2271
|
|
2272 Viper extends Vi with a number of useful features. This includes various
|
|
2273 search functions, histories of search strings, Ex commands, insertions, and
|
|
2274 Vi's destructive commands. In addition, Viper supports file name completion
|
|
2275 and history, completion of Ex commands and variables, and many other
|
|
2276 features. Some of these features are explained in detail elsewhere in this
|
|
2277 document. Other features are explained here.
|
|
2278
|
|
2279 @table @code
|
|
2280 @item (vip-buffer-search-enable)
|
|
2281 @item vip-buffer-search-char nil
|
|
2282 Enable buffer search. Explicit call to @code{vip-buffer-search-enable}
|
|
2283 sets @code{vip-buffer-search-char} to @kbd{g}. Alternatively, the user can
|
|
2284 set @code{vip-buffer-search-char} in @file{.vip} to a key sequence
|
|
2285 to be used for buffer search. There is no need to call
|
|
2286 @code{vip-buffer-search-enable} in that case.
|
|
2287 @findex @code{vip-buffer-search-enable}
|
|
2288 @vindex @code{vip-buffer-search-char}
|
|
2289 @item vip-toggle-search-style
|
|
2290 This function, bound to @kbd{C-c /}, lets one toggle case-sensitive and
|
|
2291 case-insensitive search, and also switch between plain vanilla search and
|
|
2292 search via regular expressions. Without the prefix argument, the user is
|
|
2293 asked which mode to toggle. With prefix argument 1, this toggles
|
|
2294 case-sensitivity. With prefix argument 2, regular expression/vanilla search
|
|
2295 will be toggled.
|
|
2296
|
|
2297 However, we found that the most convenient way to toggle
|
|
2298 these options is to bind a Vi macro to
|
|
2299 bind @kbd{//} to toggles case sensitivity and to @kbd{///} to toggles
|
|
2300 vanilla search. Thus, quickly hitting @kbd{/} twice will switch Viper from
|
|
2301 case sensitive search to case-insensitive. Repeating this once again will
|
|
2302 restore the original state. Likewise, quickly hitting @kbd{/} three times
|
|
2303 will switch you from vanilla-style search to search via regular expressions.
|
|
2304 If you hit something other than @kbd{/} after the first @kbd{/} or if the
|
|
2305 second @kbd{/} doesn't follow quickly enough, then Viper will issue the
|
|
2306 usual prompt @kbd{/} and will wait for input, as usual in Vi.
|
|
2307 If you don't like this behavior, you can ``unrecord'' these macros in your
|
78
|
2308 @file{~/.vip} file. For instance, if you don't like the above feature, put
|
0
|
2309 this in @file{~/.vip}:
|
|
2310 @example
|
78
|
2311 (vip-set-vi-search-style-macros 'undefine)
|
0
|
2312 @end example
|
78
|
2313 @findex @code{vip-set-vi-search-style-macros}
|
|
2314
|
|
2315 @item Vi-isms in Emacs state
|
|
2316 Some people find it useful to use the Vi-style search key, `/', to invoke
|
|
2317 search in modes which Viper leaves in emacs-state. These modes are:
|
|
2318 @code{dired-mode}, @code{mh-folder-mode}, @code{gnus-group-mode},
|
|
2319 @code{gnus-summary-mode}, @code{Info-mode}, and @code{Buffer-menu-mode}
|
|
2320 (more may be added in the future). So, in the above modes, Viper binds `/'
|
|
2321 so that it will behave Vi-style. Furthermore, in those major modes, Viper
|
|
2322 binds `:' to invoke ex-style commands, like in vi-state. And, as described
|
|
2323 above, `//' and `///' get bound to Vi-style macros that toggle
|
|
2324 case-insensitivity and regexp-search.
|
|
2325
|
|
2326 If you don't like these features---which I don't really understand---you
|
|
2327 can unbind `/' and `:' in @code{vip-dired-modifier-map} (for Dired) or in
|
|
2328 @code{vip-slash-and-colon-map}, for other modes.
|
|
2329 @vindex @code{vip-slash-and-colon-map}
|
|
2330 @vindex @code{vip-dired-modifier-map}
|
|
2331
|
|
2332 To unbind the macros `//' and `///' for a major mode where you feel they
|
|
2333 are undesirable, execute @code{vip-set-emacs-search-style-macros} with a
|
|
2334 non-nil argument. This can be done either interactively, by supplying a
|
|
2335 prefix argument, or by placing
|
|
2336 @example
|
|
2337 (vip-set-emacs-search-style-macros 'undefine)
|
|
2338 @end example
|
|
2339 @findex @code{vip-set-emacs-search-style-macros}
|
|
2340 in the hook to the major mode (e.g., @code{dired-mode-hook}).
|
0
|
2341 @xref{Vi Macros}, for more information on Vi macros.
|
78
|
2342
|
0
|
2343 @item vip-heading-start
|
|
2344 @item vip-heading-end
|
|
2345 @cindex headings
|
|
2346 @cindex sections
|
|
2347 @cindex paragraphs
|
|
2348 @cindex sentences
|
|
2349 Regular Expressions for @kbd{[[} and @kbd{]]}. Note that Emacs defines
|
|
2350 Regexps for paragraphs and sentences. @xref{Paragraphs,,Paragraphs and
|
|
2351 Sentences,emacs,The GNU Emacs Manual}, for details.
|
|
2352 @item M-x vip-set-expert-level
|
|
2353 @findex @code{vip-set-expert-level}
|
|
2354 Change your user level interactively.
|
|
2355 @item vip-smart-suffix-list '("" "tex" "c" "cc" "el" "p")
|
|
2356 @vindex @code{vip-smart-suffix-list}
|
|
2357 Viper supports Emacs-style file completion when it prompts the user for a
|
|
2358 file name. However, in many cases, the same directory may contain files
|
|
2359 with identical prefix but different suffixes, e.g., prog.c, prog.o,
|
|
2360 paper.tex, paper.dvi. In such cases, completion will stop at the `.'.
|
|
2361 If the above variable is a list of strings representing suffixes, Viper will
|
|
2362 try these suffixes
|
|
2363 in the order listed and will check if the corresponding file exists.
|
|
2364
|
|
2365 For instance, if completion stopped at `paper.' and the user typed RET,
|
|
2366 then Viper will check if the files `paper.', `paper.tex', `paper.c', etc., exist.
|
|
2367 It will take the first such file. If no file exists, Viper will give a chance
|
|
2368 to complete the file name by typing the appropriate suffix. If `paper.' was
|
|
2369 the intended file name, hitting return will accept it.
|
|
2370
|
|
2371 To turn this feature off, set the above variable to @code{nil}.
|
|
2372
|
|
2373 @item vip-insertion-ring-size 14
|
|
2374 @vindex @code{vip-insertion-ring-size}
|
|
2375 @cindex Insertion ring
|
|
2376 Viper remembers what was previously inserted in Insert and Replace states.
|
|
2377 Several such recent insertions are kept in a special ring of strings of size
|
|
2378 @code{vip-insertion-ring-size}.
|
|
2379 If you enter Insert or Replace state you can reinsert strings from this
|
|
2380 ring by typing @kbd{C-c M-p} or @kbd{C-c M-n}. The former will search the
|
|
2381 ring in
|
|
2382 the direction of older insertions, and the latter will search in
|
|
2383 the direction of newer insertions. Hitting @kbd{C-c M-p} or @kbd{C-c M-n}
|
|
2384 in succession
|
|
2385 will undo the previous insertion from the ring and insert the next item on
|
|
2386 the ring. If a larger ring size is needed, change the value of the above
|
|
2387 variable in the @file{~/.vip} file.
|
|
2388
|
|
2389 Since typing these sequences of keys may be tedious, it is suggested that the
|
|
2390 user should bind a function key, such as @kbd{f31}, as follows:
|
|
2391 @example
|
|
2392 (define-key vip-insert-global-user-map [f31]
|
|
2393 'vip-insert-prev-from-insertion-ring)
|
|
2394 @end example
|
|
2395 This binds @kbd{f31} (which is usually @kbd{R11} on a Sun workstation)
|
|
2396 to the function that inserts the previous string in the insertion history.
|
|
2397 To rotate the history in the opposite
|
|
2398 direction, you can either bind an unused key to
|
|
2399 @code{vip-insert-next-from-insertion-ring} or hit any digit (1 to 9) then
|
|
2400 @kbd{f31}.
|
|
2401
|
|
2402 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
|
|
2403 this will interfere with the Minibuffer histories and, possibly, other
|
|
2404 major modes.
|
|
2405
|
|
2406 @item vip-command-ring-size 14
|
|
2407 @vindex @code{vip-command-ring-size}
|
|
2408 @cindex Destructive command ring
|
|
2409 @cindex Destructive command history
|
|
2410 Viper keeps track of the recent history of destructive
|
|
2411 commands, such as @kbd{dw}, @kbd{i}, etc.
|
|
2412 In Vi state,
|
|
2413 the most recent command can be re-executed by hitting `@kbd{.}', as in Vi.
|
|
2414 However, repeated typing @kbd{C-c M-p} will cause Viper to show the
|
|
2415 previous destructive commands in the minibuffer. Subsequent hitting `@kbd{.}'
|
|
2416 will execute the command that was displayed last.
|
|
2417 The key @kbd{C-c M-n} will cycle through the command history in the
|
|
2418 opposite direction.
|
|
2419 Since typing @kbd{C-c M-p} may be tedious, it is more convenient to bind an
|
|
2420 appropriate function to an unused function key on the keyboard and use that
|
|
2421 key. For instance, the following
|
|
2422 @example
|
|
2423 (define-key vip-vi-global-user-map [f31]
|
|
2424 'vip-prev-destructive-command)
|
|
2425 @end example
|
|
2426 binds the key @kbd{f31} (which is usually @kbd{R11} on a Sun workstation)
|
|
2427 to the function that searches the command history in the direction of older
|
|
2428 commands. To search in the opposite
|
|
2429 direction, you can either bind an unused key to
|
|
2430 @code{vip-next-destructive-command} or hit any digit (1 to 9) then @kbd{f31}.
|
|
2431
|
|
2432 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
|
|
2433 this will interfere with the Minibuffer histories and, possibly, other
|
|
2434 major modes.
|
|
2435
|
|
2436 @item vip-minibuffer-vi-face 'vip-minibuffer-vi-face
|
|
2437 @item vip-minibuffer-insert-face 'vip-minibuffer-insert-face
|
|
2438 @item vip-minibuffer-emacs-face 'vip-minibuffer-emacs-face
|
|
2439 These faces control the appearance of the minibuffer text in the
|
|
2440 corresponding Viper states. For heavy-duty customization, consult
|
|
2441 the Lisp Reference to Emacs. You can also take a look how these faces are
|
|
2442 defined in @file{viper.el}.
|
|
2443
|
|
2444 However, on a color workstation, the following method usually suffices:
|
|
2445 @example
|
|
2446 (set-face-foreground vip-minibuffer-vi-face "blue")
|
|
2447 (set-face-background vip-minibuffer-emacs-face "orchid")
|
|
2448 @end example
|
|
2449 This will make a blue foreground in the Minibuffer when it is in Vi
|
|
2450 state; its background will turn to orchid when it switches to Emacs state.
|
|
2451
|
|
2452 Note that only the text you type in is affected by the above faces.
|
|
2453 Prompts and Minibuffer messages are not affected.
|
|
2454
|
|
2455 Purists who do not like adornments in the minibuffer can always zap them by
|
|
2456 putting
|
|
2457 @example
|
|
2458 (copy-face 'default 'vip-minibuffer-vi-face)
|
|
2459 (copy-face 'default 'vip-minibuffer-insert-face)
|
|
2460 (copy-face 'default 'vip-minibuffer-emacs-face)
|
|
2461 @end example
|
|
2462 in the @file{~/.vip} file. However, in that case, the user will not have any
|
|
2463 indication of the current Viper state in the minibuffer. (This is important
|
|
2464 if the user accidentally switches to another Viper state by typing @kbd{ESC} or
|
78
|
2465 @kbd{C-z}).
|
0
|
2466 @end table
|
|
2467
|
|
2468 @cindex Multifile documents and programs
|
|
2469
|
|
2470 Viper provides some support for multi-file documents and programs.
|
|
2471 If a document consists of several files we can designate one of them as a
|
|
2472 master and put the following at the end of that file:
|
|
2473 @lisp
|
|
2474 ;;; Local Variables:
|
|
2475 ;;; eval: (vip-setup-master-buffer "file1" "file2" "file3" "file5" "file5")
|
|
2476 ;;; End:
|
|
2477 @end lisp
|
|
2478 @noindent
|
|
2479 where @code{file1} to @code{file5} are names of files related to the master
|
|
2480 file. Next time, when the master file is visited, the command
|
|
2481 @code{vip-setup-master-buffer} will be evaluated and the above files will
|
|
2482 be associated with the master file. Then, the new Ex command
|
|
2483 @kbd{:RelatedFile} (abbr. @kbd{:R}) will display files 1 to 5 one after
|
|
2484 another, so you can edit them. If a file is not in any Emacs buffer, it
|
|
2485 will be visited. The command @kbd{PreviousRelatedFile} (abbr., @kbd{:P})
|
|
2486 goes through the file list in the opposite direction.
|
|
2487 @findex @kbd{:RelatedFile}
|
|
2488 @findex @kbd{:PreviousRelatedFile}
|
|
2489
|
|
2490 These commands are akin to @kbd{:n} and @kbd{:N}, but they allow the user to
|
|
2491 focus on relevant files only.
|
|
2492
|
|
2493 Note that only the master file needs to have the aforementioned block of
|
|
2494 commands. Also, ";;;" above can be replaced by some other
|
|
2495 markers. Semicolon is good for Lisp programs, since it is considered a
|
|
2496 comment designator there. For LaTeX, this could be "%%%", and for C the
|
|
2497 above block should be commented out.
|
|
2498
|
|
2499 Even though these commands are sometimes useful, they are no substitute for
|
|
2500 the powerful @emph{tag table} facility of Emacs. Viper's @kbd{:tag} command
|
|
2501 in a primitive interface to Emacs tags. @xref{Tags,Tags,Tags,emacs,
|
|
2502 The Gnu Emacs Manual}, for more information on tags.
|
|
2503
|
|
2504 The following two commands are normally bound to a mouse click and are part
|
|
2505 of Viper. They work only if Emacs runs as an application under X
|
|
2506 Windows (or under some other window system for which a port of GNU Emacs 19
|
|
2507 is available). Clicking the mouse when Emacs is invoked in an Xterm window
|
|
2508 (using @code{emacs -nw}) will do no good.
|
|
2509
|
|
2510 @table @code
|
|
2511 @cindex mouse
|
|
2512 @item M-S-mouse-1 (Emacs)
|
|
2513 @item meta shift button1up (XEmacs)
|
|
2514 Holding Meta and Shift while clicking mouse button 1
|
|
2515 will initiate search for a region under the
|
|
2516 mouse pointer (defined below). This command can take a prefix argument,
|
|
2517 which indicates the occurrence of the pattern to search for.
|
|
2518
|
|
2519 Note: Viper binds this mouse action only if it is not already bound to
|
|
2520 something else. If you want to use this feature and @kbd{M-S-mouse-1}
|
|
2521 is already used for something else, you can rebind mouse-search as, for
|
|
2522 example, in the following example:
|
|
2523 @lisp
|
|
2524 (global-set-key [M-mouse-1] 'vip-mouse-click-search-word)
|
|
2525 (global-set-key [M-down-mouse-1] 'vip-mouse-catch-frame-switch)
|
|
2526 @end lisp
|
|
2527 This would bind mouse search to the action invoked by pressing the
|
|
2528 Meta key and clicking mouse button 1. Note: if
|
|
2529 @code{vip-mouse-click-search-word} is bound to an action, then
|
|
2530 @code{vip-mouse-catch-frame-switch} must be bound to a down-action, as
|
|
2531 shown in the above example.
|
|
2532
|
|
2533 In XEmacs, you can change bindings as follows:
|
|
2534 @lisp
|
|
2535 (global-set-key [(meta control button1up)]
|
|
2536 'vip-mouse-click-search-word)
|
|
2537 (global-set-key [(meta control button1)]
|
|
2538 'vip-mouse-catch-frame-switch)
|
|
2539 @end lisp
|
|
2540 if, say, you prefer to hold both meta and control while clicking.
|
|
2541
|
|
2542 Like in Emacs, there are special rules for binding these functions: the
|
|
2543 first must be bound to a button-up event while the second must be bound to
|
|
2544 a button-event (which is XEmacs' equivalent of a down-mouse event). Also,
|
|
2545 in Emacs, the double-click and triple-click actions for the same button
|
|
2546 (@code{double-S-mouse-1}, etc., if the above default binding is used)
|
|
2547 should not be bound (or it should be bound to the same function,
|
|
2548 @code{vip-mouse-click-search-word}).
|
|
2549
|
|
2550 The region that is chosen as a pattern to search for is determined as
|
|
2551 follows. If search is invoked via a single click, Viper chooses the region
|
|
2552 that lies between the beginning of the ``word'' under the pointer (``word''
|
|
2553 is understood in Vi sense) and the end of that word. The only difference
|
|
2554 with Vi's words is that in Lisp major modes `-' is considered an
|
|
2555 alphanumeric symbol. This is done for the convenience of working with Lisp
|
|
2556 symbols, which often have an `-' in them. Also, if you click on a
|
|
2557 non-alphanumeric character that is not a word separator (in Vi sense) then
|
|
2558 this character will also be considered alphanumeric, provided that it is
|
|
2559 adjacent (from either side) to an alphanumeric character. This useful
|
|
2560 feature gives added control over the patterns selected by the mouse click.
|
|
2561
|
|
2562 On a double-click, the region is determined by the beginning of the current
|
|
2563 Vi's ``Word'' (i.e., the largest non-separator chunk of text) and the End
|
|
2564 of that ``Word'' (as determined by the @kbd{E} command).
|
|
2565
|
|
2566 On a triple-click, the region consists of the entire line where the click
|
|
2567 occurred with all leading and trailing spaces and tabs removed.
|
|
2568
|
|
2569 @item M-S-mouse-2 (Emacs)
|
|
2570 @item meta shift button2up (XEmacs)
|
|
2571 Holding Meta and Shift while clicking mouse button 2
|
|
2572 will insert the region surrounding the
|
|
2573 mouse pointer. The rules defining this region are the same as for
|
|
2574 mouse-search. This command takes an optional prefix argument, which
|
|
2575 indicates how many such regions to snarf from the buffer and insert. (In
|
|
2576 case of a triple-click, the prefix argument is ignored.)
|
|
2577
|
|
2578 Note: Viper binds this mouse action only if it not already bound to
|
|
2579 something else. If you want to use this feature and @kbd{S-mouse-2}
|
|
2580 is already used for something else, you can rebind mouse-insert as follows:
|
|
2581 @lisp
|
|
2582 (global-set-key [M-mouse-2] 'vip-mouse-click-insert-word)
|
|
2583 (global-set-key [M-down-mouse-2] 'vip-mouse-catch-frame-switch)
|
|
2584 @end lisp
|
|
2585 In XEmacs, you can change the bindings as follows:
|
|
2586 @lisp
|
|
2587 (global-set-key [(meta control button2up)]
|
|
2588 'vip-mouse-click-insert-word)
|
|
2589 (global-set-key [(meta control button2)]
|
|
2590 'vip-mouse-catch-frame-switch)
|
|
2591 @end lisp
|
|
2592
|
|
2593 @item vip-multiclick-timeout
|
|
2594 This variable controls the rate at which double-clicking must occur for the
|
|
2595 purpose of mouse search and mouse insert. By default, this is set to
|
|
2596 @code{double-click-time} in Emacs and to
|
|
2597 @code{mouse-track-multi-click-time} milliseconds in XEmacs.
|
|
2598 @end table
|
|
2599 @kindex @kbd{S-mouse-1}
|
|
2600 @kindex @kbd{S-mouse-2}
|
|
2601 @kindex @kbd{meta shift button1up}
|
|
2602 @kindex @kbd{meta shift button2up}
|
|
2603 @vindex @code{vip-multiclick-timeout}
|
|
2604 @findex @code{vip-mouse-click-insert-word}
|
|
2605 @findex @code{vip-mouse-click-search-word}
|
|
2606
|
|
2607 Note: The above functions search and insert in the selected window of
|
|
2608 the latest active frame. This means that you can click in another window or
|
|
2609 another frame and have search or insertion done in the frame and window you
|
|
2610 just left. This lets one use these functions in a multi-frame
|
|
2611 configuration. However, this may require some getting used to. For
|
|
2612 instance, if you are typing in a frame, A, and then move the mouse to frame
|
|
2613 B and click to invoke mouse search, search (or insertion) will be performed
|
|
2614 in frame A. To perform search/insertion in frame B, you will first have to
|
|
2615 shift focus there, which doesn't happen until you type a character or
|
|
2616 perform some other action in frame B---mouse search doesn't shift focus (in
|
|
2617 XEmacs, to shift focus to frame B, you will have to select this frame with
|
|
2618 a mouse, by clicking.
|
|
2619
|
|
2620 If you decide that you don't like the above feature and always want
|
|
2621 search/insertion be performed in the frame where the click occurs, don't
|
|
2622 bind (and unbind, if necessary) @code{vip-mouse-catch-frame-switch} from
|
|
2623 the mouse event it is bound to.
|
|
2624
|
|
2625 Mouse search is integrated with Vi-style search, so you can
|
|
2626 repeat it with @kbd{n} and @kbd{N}. It should be also noted that, while
|
|
2627 case-sensitivity of search in Viper is controlled by the variable
|
|
2628 @code{vip-case-fold-search}, the case of mouse search is
|
|
2629 controlled by the Emacs variable @code{case-fold-search}, which may be set
|
|
2630 differently from @code{vip-case-fold-search}. Therefore, case-sensitivity
|
|
2631 of mouse search may be different from that of the usual Vi-style search.
|
|
2632
|
|
2633 Finally, if the way Viper determines the word to be searched for or to be
|
|
2634 inserted is not what you want, there is a variable,
|
|
2635 @code{vip-surrounding-word-function}, which can be changed to indicate
|
|
2636 another function for snarfing words out of the buffer. The catch is that
|
|
2637 you will then have to write such a function and make it known to your
|
|
2638 Emacs. The function @code{vip-surrounding-word} in @file{viper.el} can be
|
|
2639 used as a guiding example.
|
|
2640
|
|
2641 @node Vi Macros, ,Viper Specials,Customization
|
|
2642 @section Vi Macros
|
|
2643
|
|
2644 @cindex Vi macros
|
|
2645
|
|
2646 Viper supports much enhanced Vi-style macros and also facilitates the use
|
|
2647 of Emacs-style macros. To define a temporary macro, it is generally more
|
|
2648 convenient to use Emacs keyboard macro facility. Emacs keyboard macros are
|
|
2649 usually defined anonymously, and the latest macro can be executed by typing
|
|
2650 @kbd{C-x e} (or @kbd{*}, if Viper is in Vi state). If you need to use several
|
|
2651 temporary macros, Viper lets you save them to a
|
|
2652 register (a lowercase letter); such macros can then be executed by typing
|
|
2653 @kbd{@@a} in Vi state (if a macro was previously saved in register
|
|
2654 @kbd{a}).
|
|
2655 @xref{Macros and Registers}, for details.
|
|
2656
|
|
2657 If, however, you need to use a macro regularly, it must be given a
|
|
2658 permanent name and saved. Emacs manual explains how to do this, but
|
|
2659 invocation of named Emacs macros is quite different from Vi's. First,
|
|
2660 invocation of permanent Emacs macros takes time because of the extra keys.
|
|
2661 Second, binding such macros to function keys, for
|
|
2662 fast access, hogs valuable real estate on the keyboard.
|
|
2663
|
|
2664 Vi-style macros are better in that respect, since Vi lets the user overload
|
|
2665 the meaning of key sequences: keys typed in fast succession are treated
|
|
2666 specially, if this key sequence is bound to a macro.
|
|
2667
|
|
2668 Viper provides keyboard macros through the usual Ex commands, @kbd{:map} and
|
|
2669 @kbd{:map!}. Vi-style macros are much more powerful in Viper than
|
|
2670 they are in the original Vi and in other emulators. This is because Viper
|
|
2671 implements an enhanced vi-style
|
|
2672 interface to the powerful Emacs keyboard macro facility.
|
|
2673
|
|
2674 First, any Emacs
|
|
2675 command can be executed while defining a macro, not just the Vi
|
|
2676 commands. In particular, the user can invoke Emacs commands via @kbd{M-x
|
|
2677 command-name} or by pressing various function keys on the keyboard. One
|
|
2678 can even use the mouse, although this is usually not useful and is not
|
|
2679 recommended (and macros defined with the use of the mouse cannot be saved in
|
|
2680 command history and in the startup file, for future use).
|
|
2681
|
|
2682 Macros defined by mixing Vi and Emacs commands are represented as
|
|
2683 vectors. So, don't be confused when you see one (usually through the
|
|
2684 history of Ex commands). For instance, if @kbd{gg} is defined by typing
|
|
2685 @kbd{l}, the up-arrow key and @kbd{M-x next-line}, its definition will look
|
|
2686 as follows in Emacs (in XEmacs, it looks slightly different, see below):
|
|
2687
|
|
2688 @example
|
|
2689 [l up (meta x) n e x t - l i n e return]
|
|
2690 @end example
|
|
2691
|
|
2692 Second, Viper macros are defined in a WYSIWYG style. This means that
|
|
2693 commands are executed as you type them, so you can see precisely what is
|
|
2694 being defined. Third, macros can be bound to arbitrary sequences of keys,
|
|
2695 not just to printable keys. For instance, one can define a macro that will
|
|
2696 be invoked by hitting @kbd{f3} then @kbd{f2} function keys. (The keys
|
|
2697 @kbd{delete} and @kbd{backspace} are excluded; also, a macro invocation
|
|
2698 sequence can't start with ESC. Some other keys, such as @kbd{f1} and
|
|
2699 @kbd{help}, can't be bound to macros under Emacs (not XEmacs), since they
|
|
2700 are bound in @code{key-translation-map}, which overrides any other binding
|
|
2701 the user gives to keys. In general, keys that have a binding in
|
|
2702 @code{key-translation-map} can't be bound to a macro.)
|
|
2703
|
|
2704 Fourth, in Viper, one can define macros that are specific to a given
|
|
2705 buffer, a given major mode, or macros that are defined for all buffers. In
|
|
2706 fact, the same macro name can have several different definitions: one
|
|
2707 global, several definitions for various major modes, and
|
|
2708 definitions for various specific buffers. Buffer-specific definitions
|
|
2709 override mode-specific definitions, which, in turn, override global
|
|
2710 definitions.
|
|
2711
|
|
2712 As if all that is not enough, Viper (through its interface to Emacs
|
|
2713 macros) lets the user define keyboard macros that ask for confirmation or
|
|
2714 even prompt the user for input and then continue. To do this, one should
|
|
2715 type @kbd{C-x q} (for confirmation) or @kbd{C-u C-x q} (for prompt).
|
|
2716 For details, @pxref{Kbd Macro Query,,Customization,emacs,The GNU Emacs
|
|
2717 Manual} @refill
|
|
2718
|
|
2719 When the user finishes defining a macro (which is done by typing @kbd{C-x)} ---
|
|
2720 a departure from Vi), you will be asked whether you want this
|
|
2721 macro to be global, mode-specific, or buffer-specific. You will also be
|
|
2722 given a chance to save the macro in your @file{~/.vip} file.
|
|
2723 This is the easiest way to save a macro and make
|
|
2724 it permanently available. If you work your startup files with bare hands,
|
|
2725 here is how Viper saves the above macro so that it will be
|
|
2726 available in Viper's Insert state (and Replace state) in buffer @code{my-buf}
|
|
2727 only:
|
|
2728
|
|
2729 @example
|
|
2730 (vip-record-kbd-macro "gg" 'insert-state
|
|
2731 [l up (meta x) n e x t - l i n e return]
|
|
2732 "my-buf")
|
|
2733 @end example
|
|
2734
|
|
2735 @noindent
|
|
2736 To do the same for Vi state and all buffers with the major mode
|
|
2737 @code{cc-mode}, use:
|
|
2738
|
|
2739 @example
|
|
2740 (vip-record-kbd-macro "gg" 'vi-state
|
|
2741 [l up (meta x) n e x t - l i n e return]
|
|
2742 'cc-mode)
|
|
2743 @end example
|
|
2744
|
|
2745 @noindent
|
|
2746 Both macro names and macro definitions are vectors of symbols that denote
|
|
2747 keys on the keyboard. Some keys, like @kbd{\}, @kbd{ }, or digit-keys must
|
|
2748 be escaped with a backslash. Modified keys are represented as lists. For
|
|
2749 instance, holding Meta and Control and pressing @kbd{f4} is represented as
|
|
2750 @kbd{(control meta f4)}.
|
|
2751 If all members of a vectors are printable characters (or sequences, such as
|
|
2752 @kbd{\e}, @kbd{\t}, for ESC and TAB), then they can also be represented as
|
|
2753 strings:
|
|
2754
|
|
2755 @example
|
|
2756 (vip-record-kbd-macro "aa" 'vi-state "aaa\e" "my-buffer")
|
|
2757 @end example
|
|
2758
|
|
2759 @noindent
|
|
2760 Thus, typing @kbd{aa} fast in Vi state will switch Viper to Insert state
|
|
2761 (due to the first @kbd{a}), insert @kbd{aa}, and then it will switch back to Vi
|
|
2762 state. All this will take effect only in the buffer named @code{my-buffer}.
|
|
2763
|
|
2764 Note that the last argument to @code{vip-record-kbd-macro} must be either a
|
|
2765 string (a buffer name), a symbol representing a major mode, or @code{t};
|
|
2766 the latter says that the macro is to be defined for all buffers
|
|
2767 (which is how macros are defined in original Vi).
|
|
2768
|
|
2769 For convenience, Viper also lets you define Vi-style macros in its Emacs
|
|
2770 state. There is no Ex command, like @kbd{:map} and @kbd{:map!} for doing
|
|
2771 this, but the user can include such a macro in the @file{~/.vip} file. The
|
|
2772 only thing is that the @code{vip-record-kbd-macro} command should specify
|
|
2773 @code{'emacs-state} instead of @code{'vi-state} or @code{'insert-state}.
|
|
2774
|
|
2775 The user can get rid of a macro either by using the Ex commands @kbd{:unmap}
|
|
2776 and @kbd{:unmap!} or by issuing a call to @code{vip-unrecord-kbd-macro}.
|
|
2777 The latter is more powerful, since it can delete macros even in
|
|
2778 @code{'emacs-state}. However, @code{vip-unrecord-kbd-macro} is usually
|
|
2779 needed only when the user needs to get rid of the macros that are already
|
|
2780 predefined in Viper.
|
|
2781 The syntax is:
|
|
2782 @findex @code{vip-unrecord-kbd-macro}
|
|
2783 @example
|
|
2784 (vip-unrecord-kbd-macro macro state)
|
|
2785 @end example
|
|
2786 @noindent
|
|
2787 The second argument must be @code{'vi-state}, @code{'insert-state}, or
|
|
2788 @code{'emacs-state}. The first argument is a name of a macro. To avoid
|
|
2789 mistakes in specifying names of existing macros, type @kbd{M-x
|
|
2790 vip-describe-kbd-macros} and use a name from the list displayed by this
|
|
2791 command.
|
|
2792
|
|
2793 If an error occurs during macro definition, Emacs
|
|
2794 aborts the process, and it must be repeated. This is analogous to Vi,
|
|
2795 except that in Vi the user doesn't know there is an error until the macro is
|
|
2796 actually run. All that means that in order for a definition to be
|
|
2797 successful, the user must do some simple planning of the process in
|
|
2798 advance, to avoid errors. For instance, if you want to map @kbd{gg} to
|
|
2799 @kbd{llll} in Vi state, you must make sure that there is enough room on the
|
|
2800 current line. Since @kbd{l} moves the cursor forward, it may signal an
|
|
2801 error on reaching the end of line, which will abort the definition.
|
|
2802
|
|
2803 These precautions are necessary only when defining macros; they will help
|
|
2804 avoid the need to redo the job. When macros are actually run, an error
|
|
2805 during the execution will simply terminate the current execution
|
|
2806 (but the macro will remain mapped).
|
|
2807
|
|
2808 A macro name can be a string of characters or a vector of keys.
|
|
2809 The latter makes it possible to define macros bound to, say, double-hits
|
|
2810 on a function key, such as @kbd{up} or @kbd{f13}.
|
|
2811 This is very useful if you run out of function keys on your keyboard; it
|
|
2812 makes Viper macro facility a @emph{keyboard doubler}, so to speak.
|
|
2813
|
|
2814 Elsewhere (@xref{Keybindings}, for details), we review
|
|
2815 the standard Emacs mechanism for binding function keys to commands.
|
|
2816 For instance,
|
|
2817
|
|
2818 @example
|
|
2819 (global-set-key [f13] 'repeat-complex-command)
|
|
2820 @end example
|
|
2821
|
|
2822 @noindent
|
|
2823 binds the key f13 to the Emacs function that repeats the last minibuffer
|
|
2824 command. Under Viper, however, you may still use this key for additional
|
|
2825 purposes, if you bind, say, a double-hitting action for that key to some
|
|
2826 other function. Emacs doesn't allow the user to do that, but Viper does
|
|
2827 this through its keyboard macro facility. To do this, type @kbd{:map }
|
|
2828 first. When you are asked to enter a macro name, hit f13 twice, followed by
|
|
2829 RET or SPC.
|
|
2830
|
|
2831 Emacs will now start the mapping process by actually executing
|
|
2832 Vi and Emacs commands, so that you could see what will happen each time the
|
|
2833 macro is executed. Suppose now we wanted to bind the key sequence
|
|
2834 @kbd{f13 f13} to the command @code{eval-last-sexp}. To accomplish this, we
|
|
2835 can type @kbd{M-x eval-last-sexp} followed by @kbd{C-x )}.
|
|
2836 If you answer positively to Viper's offer to save this macro in @file{~/.vip}
|
|
2837 for future uses, the following will be inserted in that file:
|
|
2838
|
|
2839 @example
|
|
2840 (vip-record-kbd-macro [f16 f16] 'vi-state
|
|
2841 [(meta x) e v a l - l a s t - s e x p]
|
|
2842 'lisp-interaction-mode)
|
|
2843 @end example
|
|
2844
|
|
2845 To illustrate the above point, Viper provides two canned macros, which, by
|
|
2846 default, are bound to @kbd{[f12 \1]} and @kbd{[f12 \2]} (invoked by typing
|
|
2847 @kbd{f12} then @kbd{1} and @kbd{2}, respectively). These macros are useful
|
|
2848 shortcuts to Viper's command ring history. The first macro will execute the
|
|
2849 second-last destructive command (the last one is executed by @kbd{.}, as
|
|
2850 usual). The second macro executes the third-last command.
|
|
2851
|
|
2852 If you need to go deeper into the command history, you will have to use
|
|
2853 other commands, as described earlier in this section; or you can bind,
|
|
2854 say, @kbd{f12 \3} like this:
|
|
2855
|
|
2856 @example
|
|
2857 (vip-record-kbd-macro [f12 \3] 'vi-state
|
|
2858 [(meta x) r e p e a t - f r o m - h i s t o r y]
|
|
2859 t)
|
|
2860 @end example
|
|
2861
|
|
2862
|
|
2863 Note that even though the macro uses the function key @kbd{f12}, the key is
|
|
2864 actually free and can still be bound to some Emacs function via
|
|
2865 @code{define-key} or @code{global-set-key}.
|
|
2866
|
|
2867
|
|
2868 Viper allows the user to define macro names that are prefixes of other macros.
|
|
2869 For instance, one can define @kbd{[[} and @kbd{[[[[} to be macros.
|
|
2870 If you type the exact sequence of such keys and then pause, Viper will
|
|
2871 execute the right macro. However, if you don't pause and, say, type
|
|
2872 @kbd{[[[[text} then the conflict is resolved as follows. If only one of the
|
|
2873 key sequences, @kbd{[[} or @kbd{[[[[} has a definition applicable to the
|
|
2874 current buffer, then, in fact, there is no conflict and the right macro
|
|
2875 will be chosen. If both have applicable definitions, then the first one
|
|
2876 found will be executed. Usually this is the macro with a shorter name. So,
|
|
2877 in our case, @kbd{[[[[text} will cause the macro @kbd{[[} to be executed
|
|
2878 twice and then the remaining keys, @kbd{t e x t}, will be processed.
|
|
2879
|
|
2880 When defining macros using @kbd{:map} or @kbd{:map!}, the user enters the
|
|
2881 actually keys to be used to invoke the macro. For instance, you should hit
|
|
2882 the actual key @kbd{f6} if it is to be part of a macro name; you do
|
|
2883 @emph{not} write `f 6'. When entering keys, Viper displays them as strings or
|
|
2884 vectors (e.g., "abc" or [f6 f7 a]). The same holds for unmapping. Hitting
|
|
2885 TAB while typing a macro name in the @kbd{:unmap} or @kbd{:unmap!} command
|
|
2886 will cause name completion. Completions are displayed as strings or vectors.
|
|
2887 However, as before, you don't actually type ``"'', ``['', or ``]'' that
|
|
2888 appear in the completions. These are meta-symbols that indicate whether
|
|
2889 the corresponding macro name is a vector or a string.
|
|
2890
|
|
2891 One last difference from Vi: Vi-style keyboard macros cannot be defined in
|
|
2892 terms of other Vi-style keyboard macros (but named Emacs macros are OK).
|
|
2893 More precisely, while defining or executing a macro, the special meaning
|
|
2894 of key sequences (as Vi macros) is ignored.
|
|
2895 This is because it is all too easy to create an infinite loop in this way.
|
|
2896 Since Viper macros are much more powerful than Vi's it is impossible to
|
|
2897 detect such loops. In practice, this is not really a limitation but,
|
|
2898 rather, a feature.
|
|
2899
|
|
2900 We should also note that Vi macros are disabled in the Minibuffer, which
|
|
2901 helps keep some potential troubles away.
|
|
2902
|
|
2903 The rate at which the user must type keys in order for them to be
|
|
2904 recognized as a timeout macro is controlled by the variable
|
|
2905 @code{vip-fast-keyseq-timeout}, which defaults to 200 milliseconds.
|
|
2906 @vindex @code{vip-fast-keyseq-timeout}
|
|
2907
|
|
2908 For the most part, Viper macros defined in @file{~/.vip} can be shared
|
|
2909 between Emacs, XEmacs, and X and TTY modes. However, macros defined via
|
|
2910 function keys may need separate definitions when XEmacs and Emacs have
|
|
2911 different names for the same keyboard key. For instance, the `Page Up' key
|
|
2912 may be known in Emacs as @kbd{prior} and in XEmacs as @kbd{pgup}.
|
|
2913 The problem with TTY may be that the function keys there generate sequences
|
|
2914 of events instead of a single event (as under a window system).
|
|
2915 Both Emacs and XEmacs mape some of these sequences back to the logical keys
|
|
2916 (e.g., the sequences generated by the arrow keys are mapped to @kbd{up},
|
|
2917 @kbd{left}, etc.). However, not all function keys are mapped in this way.
|
|
2918 Macros that are bound to key sequences that contain such unmapped function
|
|
2919 keys have to be redefined for TTY's (and possibly for every type of TTY you
|
|
2920 may be using). To do this, start Emacs on an appropriate TTY device and
|
|
2921 define the macro using @kbd{:map}, as usual.
|
|
2922
|
|
2923 @findex @code{vip-describe-kbd-macros}
|
|
2924 Finally, Viper provides a function that conveniently displays all macros
|
|
2925 currently defined. To see all macros along with their definitions, type
|
|
2926 @kbd{M-x vip-describe-kbd-macros}.
|
|
2927
|
|
2928 @include viper-cmd.texi
|
|
2929
|
|
2930 @node Acknowledgments,,,Top
|
|
2931 @comment node-name, next, previous, up
|
|
2932 @unnumbered Acknowledgments
|
|
2933
|
|
2934 Viper, formerly known as VIP-19, was written by Michael Kifer. Viper is
|
|
2935 based on the original VIP package by Masahiko Sato and on its enhancement,
|
|
2936 VIP 4.4, by Aamod Sane. This manual is an adaptation of the manual for VIP
|
|
2937 4.4, which, in turn, was based on Sato's manual for VIP 3.5.
|
|
2938
|
|
2939 Many contributors on the net pointed out bugs and suggested a number of
|
|
2940 useful features. Here is a (hopefully) complete list of contributors:
|
|
2941
|
|
2942 @example
|
|
2943 jjm@@hplb.hpl.hp.com (Jean-Jacques Moreau), jl@@cse.ogi.edu (John
|
|
2944 Launchbury), rxga@@ulysses.att.com, jamesm@@bga.com (D.J. Miller II),
|
|
2945 ascott@@fws214.intel.com (Andy Scott), toma@@convex.convex.com,
|
|
2946 dave@@hellgate.utah.edu, cook@@biostat.wisc.edu
|
|
2947 (Tom Cook), lindstro@@biostat.wisc.edu (Mary Lindstrom),
|
|
2948 edmonds@@edmonds.home.cs.ubc.ca (Brian Edmonds), mveiga@@dit.upm.es
|
|
2949 (Marcelino Veiga Tuimil), dwight@@toolucky.llnl.gov (Dwight Shih),
|
|
2950 phil_brooks@@MENTORG.COM (Phil Brooks), kin@@isi.com (Kin Cho),
|
|
2951 ahg@@panix.com (Al Gelders), dwallach@@cs.princeton.edu (Dan Wallach),
|
|
2952 hpz@@ibmhpz.aug.ipp-garching.mpg.de (Hans-Peter Zehrfeld),
|
|
2953 simonb@@prl.philips.co.uk (Simon Blanchard), Mark.Bordas@@East.Sun.COM
|
|
2954 (Mark Bordas), gviswana@@cs.wisc.edu (Guhan Viswanathan),
|
|
2955 meyering@@comco.com (Jim Meyering), pfister@@cs.sunysb.edu (Hanspeter
|
|
2956 Pfister), amade@@diagram.fr (Paul-Bernard Amade),
|
|
2957 jackr@@dblues.engr.sgi.com (Jack Repenning),
|
|
2958 pogrell@@informatik.hu-berlin.de (Lutz Pogrell),
|
|
2959 csdayton@@midway.uchicago.edu (Soren Dayton),
|
|
2960 pradyut@@cs.uchicago.edu (Pradyut Shah),
|
|
2961 vrenjak@@sun1.racal.com (Milan Vrenjak),
|
|
2962 gvr@@halcyon.com (George V. Reilly),
|
|
2963 whicken@@dragon.parasoft.com (Wendell Hicken),
|
|
2964 terra@@diku.dk (Morten Welinder),
|
|
2965 kanze@@gabi-soft.fr (James Kanze),
|
|
2966 hatazaki@@bach.convex.com (Takao Hatazaki),
|
|
2967 sawdey@@lcse.umn.edu (Aaron Sawdey),
|
|
2968 jobrien@@hchp.org (John O'Brien),
|
78
|
2969 mrb@@Eng.Sun.COM (Martin Buchholz),
|
|
2970 kwzh@@gnu.ai.mit.edu (Karl Heuer),
|
|
2971 sudish@@MindSpring.COM (Sudish Joseph)
|
0
|
2972 @end example
|
|
2973
|
|
2974
|
|
2975 @node Key Index,Function Index,,Top
|
|
2976 @comment node-name, next, previous, up
|
|
2977 @unnumbered Key Index
|
|
2978
|
|
2979 @printindex ky
|
|
2980
|
|
2981 @node Function Index,Variable Index,Key Index,Top
|
|
2982 @comment node-name, next, previous, up
|
|
2983 @unnumbered Function Index
|
|
2984
|
|
2985 @printindex fn
|
|
2986
|
|
2987 @node Variable Index,Package Index,Function Index,Top
|
|
2988 @comment node-name, next, previous, up
|
|
2989 @unnumbered Variable Index
|
|
2990
|
|
2991 @printindex vr
|
|
2992
|
|
2993 @node Package Index,Concept Index,Variable Index,Top
|
|
2994 @comment node-name, next, previous, up
|
|
2995 @unnumbered Package Index
|
|
2996
|
|
2997 @printindex pg
|
|
2998
|
|
2999 @node Concept Index,,Package Index,Top
|
|
3000 @comment node-name, next, previous, up
|
|
3001 @unnumbered Concept Index
|
|
3002
|
|
3003 @printindex cp
|
|
3004
|
|
3005 @contents
|
|
3006 @bye
|