20 |
@titlepage |
@titlepage |
21 |
@title Viper Is a Package for Emacs Rebels |
@title Viper Is a Package for Emacs Rebels |
22 |
@subtitle a Vi emulator for Emacs |
@subtitle a Vi emulator for Emacs |
23 |
@subtitle October 2000, Viper Version 3.09 |
@subtitle January 2002, Viper Version 3.11.2 |
24 |
|
|
25 |
@author Michael Kifer (Viper) |
@author Michael Kifer (Viper) |
26 |
@author Aamod Sane (VIP 4.4) |
@author Aamod Sane (VIP 4.4) |
33 |
@unnumbered Distribution |
@unnumbered Distribution |
34 |
|
|
35 |
@noindent |
@noindent |
36 |
Copyright @copyright{} 1995, 1996, 1997, 2001 Free Software Foundation, Inc. |
Copyright @copyright{} 1995, 1996, 1997, 2001, 2002 Free Software Foundation, Inc. |
37 |
|
|
38 |
Permission is granted to copy, distribute and/or modify this document |
Permission is granted to copy, distribute and/or modify this document |
39 |
under the terms of the GNU Free Documentation License, Version 1.1 or |
under the terms of the GNU Free Documentation License, Version 1.1 or |
58 |
@unnumbered Viper |
@unnumbered Viper |
59 |
|
|
60 |
We believe that one or more of the following statements are adequate |
We believe that one or more of the following statements are adequate |
61 |
descriptions: |
descriptions of Viper: |
62 |
|
|
63 |
@example |
@example |
64 |
Viper Is a Package for Emacs Rebels; |
Viper Is a Package for Emacs Rebels; |
80 |
|
|
81 |
Viper, formerly known as VIP-19, was written by Michael Kifer. It is based |
Viper, formerly known as VIP-19, was written by Michael Kifer. It is based |
82 |
on VIP version 3.5 by Masahiko Sato and VIP version 4.4 by Aamod Sane. |
on VIP version 3.5 by Masahiko Sato and VIP version 4.4 by Aamod Sane. |
83 |
Viper tries to be compatible with these packages. |
About 15% of the code still comes from those older packages. |
84 |
|
|
85 |
Viper is intended to be usable without reading this manual --- the defaults |
Viper is intended to be usable without reading this manual --- the defaults |
86 |
are set to make Viper as close to Vi as possible. At startup, Viper will |
are set to make Viper as close to Vi as possible. At startup, Viper will |
89 |
management commands to help you start immediately. |
management commands to help you start immediately. |
90 |
|
|
91 |
Although this manual explains how to customize Viper, some basic |
Although this manual explains how to customize Viper, some basic |
92 |
familiarity with Emacs Lisp would be a plus. |
familiarity with Emacs Lisp is a plus. |
93 |
|
|
94 |
It is recommended that you read the Overview node. The other nodes may |
It is recommended that you read the Overview node. The other nodes may |
95 |
be visited as needed. |
be visited as needed. |
96 |
|
|
97 |
Comments and bug reports are welcome. |
Comments and bug reports are welcome. |
98 |
@code{kifer@@cs.sunysb.edu} is the current address for Viper bug reports. |
@code{kifer@@cs.stonybrook.edu} is the current address for Viper bug reports. |
99 |
Please use the Ex command @kbd{:submitReport} for this purpose.@refill |
Please use the Ex command @kbd{:submitReport} for this purpose.@refill |
100 |
|
|
101 |
@end ifinfo |
@end ifinfo |
102 |
|
|
103 |
@menu |
@menu |
104 |
* Overview:: Must read to get started |
* Overview:: Read for a smoother start |
105 |
* Improvements over Vi:: New features, Improvements |
* Improvements over Vi:: New features, Improvements |
106 |
* Customization:: How to customize Viper |
* Customization:: How to customize Viper |
107 |
* Commands:: Vi and Ex Commands |
* Commands:: Vi and Ex Commands |
118 |
@unnumbered Introduction |
@unnumbered Introduction |
119 |
|
|
120 |
We believe that one or more of the following statements are adequate |
We believe that one or more of the following statements are adequate |
121 |
descriptions: |
descriptions of Viper: |
122 |
|
|
123 |
@example |
@example |
124 |
Viper Is a Package for Emacs Rebels; |
Viper Is a Package for Emacs Rebels; |
134 |
and on the new features of Viper. |
and on the new features of Viper. |
135 |
|
|
136 |
Viper was written by Michael Kifer. It is based on VIP version 3.5 by |
Viper was written by Michael Kifer. It is based on VIP version 3.5 by |
137 |
Masahiko Sato and VIP version 4.4 by Aamod Sane. Viper tries to be |
Masahiko Sato and VIP version 4.4 by Aamod Sane. About 15% of the code |
138 |
compatible with these packages. |
still comes from those older packages. |
139 |
|
|
140 |
Viper is intended to be usable out of the box, without reading this manual |
Viper is intended to be usable out of the box, without reading this manual |
141 |
--- the defaults are set to make Viper as close to Vi as possible. At |
--- the defaults are set to make Viper as close to Vi as possible. At |
144 |
basic GNU Emacs window management commands to help you start immediately. |
basic GNU Emacs window management commands to help you start immediately. |
145 |
|
|
146 |
Although this manual explains how to customize Viper, some basic |
Although this manual explains how to customize Viper, some basic |
147 |
familiarity with Emacs Lisp would be a plus. |
familiarity with Emacs Lisp is a plus. |
148 |
|
|
149 |
It is recommended that you read the chapter Overview. The other chapters |
It is recommended that you read the chapter Overview. The other chapters |
150 |
will be useful for customization and advanced usage. |
will be useful for customization and advanced usage. |
154 |
@kbd{@key{ESC} x info} with vanilla Emacs sometime. |
@kbd{@key{ESC} x info} with vanilla Emacs sometime. |
155 |
|
|
156 |
Comments and bug reports are welcome. |
Comments and bug reports are welcome. |
157 |
@code{kifer@@cs.sunysb.edu} is the current address for Viper bug reports. |
@code{kifer@@cs.stonybrook.edu} is the current address for Viper bug reports. |
158 |
Please use the Ex command @kbd{:submitReport} for this purpose.@refill |
Please use the Ex command @kbd{:submitReport} for this purpose.@refill |
159 |
|
|
160 |
@end iftex |
@end iftex |
179 |
included in your @file{~/.viper} file and are found at the following URL: |
included in your @file{~/.viper} file and are found at the following URL: |
180 |
@file{http://www.eecs.umich.edu/~jshawkin/viper-sample}. |
@file{http://www.eecs.umich.edu/~jshawkin/viper-sample}. |
181 |
|
|
|
Viper was formerly known as VIP-19, which was |
|
|
a descendant of VIP 3.5 by Masahiko Sato and VIP 4.4 by Aamod Sane. |
|
|
|
|
182 |
@menu |
@menu |
183 |
* Emacs Preliminaries:: Basic concepts in Emacs. |
* Emacs Preliminaries:: Basic concepts in Emacs. |
184 |
* Loading Viper:: Loading and Preliminary Configuration. |
* Loading Viper:: Loading and Preliminary Configuration. |
185 |
* States in Viper:: Viper has four states orthogonal to Emacs |
* States in Viper:: Viper has four states orthogonal to Emacs |
186 |
modes. |
modes. |
187 |
* The Minibuffer:: Command line in Emacs. |
* The Minibuffer:: Command line in Emacs. |
336 |
job of customization significantly. |
job of customization significantly. |
337 |
|
|
338 |
Viper also uses the file @file{~/.viper} for Viper-specific customization. |
Viper also uses the file @file{~/.viper} for Viper-specific customization. |
|
If you wish to be in Vi command state whenever this is deemed appropriate |
|
|
by the author, you can include the following line in your @file{.viper}: |
|
|
@lisp |
|
|
(setq viper-always t) |
|
|
@end lisp |
|
|
@noindent |
|
|
(@xref{Vi State}, for the explanation of Vi command state.) |
|
|
|
|
339 |
The location of Viper customization file can be changed by setting the |
The location of Viper customization file can be changed by setting the |
340 |
variable @code{viper-custom-file-name} in @file{.emacs} @emph{prior} to loading |
variable @code{viper-custom-file-name} in @file{.emacs} @emph{prior} to loading |
341 |
Viper. |
Viper. |
351 |
@xref{Packages that Change Keymaps}, to find out when forcing Vi command state |
@xref{Packages that Change Keymaps}, to find out when forcing Vi command state |
352 |
on a buffer may be counter-productive. |
on a buffer may be counter-productive. |
353 |
|
|
354 |
Even if your @file{.emacs} and @file{.viper} files do not contain any of the |
Even if your @file{.emacs} file does not invoke Viper automatically, |
355 |
above lines, you can still load Viper and enter Vi command state by typing the |
you can still load Viper and enter the Vi command state by typing the |
356 |
following from within Emacs: |
following from within Emacs: |
357 |
|
|
358 |
@lisp |
@lisp |
367 |
new commands that, in many cases, are more convenient than @kbd{:e}, |
new commands that, in many cases, are more convenient than @kbd{:e}, |
368 |
@kbd{:vi}, and similar old-style Vi commands.)@refill |
@kbd{:vi}, and similar old-style Vi commands.)@refill |
369 |
|
|
370 |
Finally, if at some point you would want to get de-Viperize your running |
Finally, if at some point you would want to de-Viperize your running |
371 |
copy of Emacs after Viper has been loaded, the command @kbd{M-x |
copy of Emacs after Viper has been loaded, the command @kbd{M-x |
372 |
viper-go-away} will do it for you. The function @code{toggle-viper-mode} |
viper-go-away} will do it for you. The function @code{toggle-viper-mode} |
373 |
toggles Viperization of Emacs on and off. |
toggles Viperization of Emacs on and off. |
465 |
sensitive editing. For the novice user (at Viper level 1), all major mode |
sensitive editing. For the novice user (at Viper level 1), all major mode |
466 |
bindings are turned off in Vi state as well. This includes the bindings for |
bindings are turned off in Vi state as well. This includes the bindings for |
467 |
key sequences that start with @kbd{C-c}, which practically means that all |
key sequences that start with @kbd{C-c}, which practically means that all |
468 |
major mode bindings are supported. @xref{Customization}, to find out how |
major mode bindings are unsupported. @xref{Customization}, to find out how |
469 |
to allow Emacs keys in Insert state. |
to allow Emacs keys in Insert state. |
470 |
|
|
471 |
@menu |
@menu |
560 |
functions are accessible only via that key as @kbd{M-x function-name}. |
functions are accessible only via that key as @kbd{M-x function-name}. |
561 |
Therefore, we need to simulate it somehow. In Viper's Vi, Insert, and |
Therefore, we need to simulate it somehow. In Viper's Vi, Insert, and |
562 |
Replace states, the meta key is set to be @kbd{C-\}. Thus, to get |
Replace states, the meta key is set to be @kbd{C-\}. Thus, to get |
563 |
@kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no Meta key). |
@kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no Meta key, |
564 |
|
which is rare these days). |
565 |
This works both in the Vi command state and in the Insert and Replace |
This works both in the Vi command state and in the Insert and Replace |
566 |
states. In Vi command state, you can also use @kbd{\ @key{ESC}} as the |
states. In Vi command state, you can also use @kbd{\ @key{ESC}} as the |
567 |
meta key. |
meta key. |
890 |
|
|
891 |
@itemize @bullet |
@itemize @bullet |
892 |
@item |
@item |
893 |
@kbd{:ab} and @kbd{:una} are not implemented. |
@kbd{:ab} and @kbd{:una} are not implemented, since |
894 |
Both @kbd{:map} and @kbd{:ab} are considered obsolete, since Emacs has much |
@kbd{:ab} is considered obsolete, since Emacs has much |
895 |
more powerful facilities for defining keyboard macros and abbreviations. |
more powerful facilities for defining abbreviations. |
896 |
@item |
@item |
897 |
@kbd{:set option?} is not implemented. The current |
@kbd{:set option?} is not implemented. The current |
898 |
@kbd{:set} can also be used to set Emacs variables. |
@kbd{:set} can also be used to set Emacs variables. |
1192 |
way to do this is to use Emacs customization widget, which is accessible |
way to do this is to use Emacs customization widget, which is accessible |
1193 |
from the menubar. Viper customization group is located under the |
from the menubar. Viper customization group is located under the |
1194 |
@emph{Emulations} customization group, which in turn is under the |
@emph{Emulations} customization group, which in turn is under the |
1195 |
@emph{Editing} group. All Viper faces are grouped together under Viper's |
@emph{Editing} group (or simply by typing @kbd{:customize}). All Viper |
1196 |
|
faces are grouped together under Viper's |
1197 |
@emph{Highlighting} group. |
@emph{Highlighting} group. |
1198 |
|
|
1199 |
Try it: it is really simple! |
Try it: it is really simple! |
1574 |
@cindex .viper |
@cindex .viper |
1575 |
Elisp code in a @file{.viper} file in your home directory. Viper |
Elisp code in a @file{.viper} file in your home directory. Viper |
1576 |
loads @file{.viper} just before it does the binding for mode |
loads @file{.viper} just before it does the binding for mode |
1577 |
hooks. This is the recommended method. |
hooks. This is recommended for experts only. |
1578 |
@item |
@item |
1579 |
@cindex .emacs |
@cindex .emacs |
1580 |
Elisp code in your @file{.emacs} file before and after the @code{(require |
Elisp code in your @file{.emacs} file before and after the @code{(require |
1581 |
'viper)} line. This method is not recommended, unless you know what you are |
'viper)} line. This method is @emph{not} recommended, unless you know what |
1582 |
doing. Only two variables, @code{viper-mode} and |
you are doing. Only two variables, @code{viper-mode} and |
1583 |
@code{viper-custom-file-name} are supposed to be customized in @file{.emacs}, |
@code{viper-custom-file-name}, are supposed to be customized in @file{.emacs}, |
1584 |
prior to loading Viper.@refill |
prior to loading Viper (i.e., prior to @code{(require 'viper)} command.@refill |
1585 |
@end itemize |
@item |
1586 |
|
@cindex :customize |
1587 |
@noindent |
By executing the @kbd{:customize} Ex command. This takes you to the Emacs |
1588 |
Most of Viper's behavior can be customized via the interactive Emacs user |
customization widget, which lets you change the values of Viper |
1589 |
interface. Choose "Customize" from the menubar, click on "Editing", then on |
customizable variables easily. This method is good for novice and |
1590 |
"Emulations". The customization widget is self-explanatory. Once you are |
experts alike. The customization code in the form of Lisp commands will be |
1591 |
satisfied with your changes, save them into a file and then include the |
placed in @file{~/.emacs} or some other customization file depending on the |
1592 |
contents of that file in the Viper customization repository, @file{.viper} |
version of Emacs that you use. Still, it is recommended to separate |
1593 |
(except for @code{viper-mode} and @code{viper-custom-file-name}, which are |
Viper-related customization produced by the Emacs customization widget |
1594 |
supposed to go into @code{.emacs}). |
and keep in in the @file{.viper} file. |
1595 |
|
|
1596 |
Some advanced customization cannot be accomplished this way, however, and |
Some advanced customization cannot be accomplished this way, however, and |
1597 |
has to be done in Emacs Lisp. For the common cases, examples are provided |
has to be done in Emacs Lisp in the @file{.viper} file. For the common |
1598 |
that you can use directly. |
cases, examples are provided that you can use directly. |
1599 |
|
@end itemize |
1600 |
|
|
1601 |
|
|
1602 |
@menu |
@menu |
1603 |
* Rudimentary Changes:: Simple constant definitions. |
* Rudimentary Changes:: Simple constant definitions. |
1995 |
@end lisp |
@end lisp |
1996 |
|
|
1997 |
@noindent |
@noindent |
1998 |
to bind L1 so it will invoke the Emacs Calendar and to bind L4 so it will |
to bind L1 (a key that exists on some SUN workstations) so it will invoke |
1999 |
undo changes. |
the Emacs Calendar and to bind L4 so it will undo changes. |
2000 |
However, on a dumb terminal or in an Xterm window, even the standard arrow |
However, on a dumb terminal or in an Xterm window, even the standard arrow |
2001 |
keys may |
keys may |
2002 |
not emit the right signals for Emacs to understand. To let Emacs know about |
not emit the right signals for Emacs to understand. To let Emacs know about |
2137 |
avoid this, one should add @code{viper-change-state-to-emacs} to an |
avoid this, one should add @code{viper-change-state-to-emacs} to an |
2138 |
appropriate hook of that major mode. (Check the function |
appropriate hook of that major mode. (Check the function |
2139 |
@code{viper-set-hooks} in @file{viper.el} for examples.) However, if you |
@code{viper-set-hooks} in @file{viper.el} for examples.) However, if you |
2140 |
have set @code{viper-always} to @code{t}, chances are that you won't need to |
did not set @code{viper-always} to @code{nil}, chances are that you won't |
2141 |
perform the above procedure, because Viper will take care of most useful |
need to perform the above procedure, because Viper will take care of most |
2142 |
defaults. |
useful defaults. |
2143 |
|
|
2144 |
|
|
2145 |
Finally, Viper has a facility that lets the user define per-buffer |
Finally, Viper has a facility that lets the user define per-buffer |
2217 |
(unless you explicitly prohibit them by setting |
(unless you explicitly prohibit them by setting |
2218 |
@code{viper-want-emacs-keys-in-vi} and @code{viper-want-emacs-keys-in-insert} to |
@code{viper-want-emacs-keys-in-vi} and @code{viper-want-emacs-keys-in-insert} to |
2219 |
@code{nil}). |
@code{nil}). |
2220 |
If @code{viper-always} is set to @code{t}, Viper will try to bring each buffer |
If @code{viper-always} is set to @code{t} (which is the default), Viper |
2221 |
|
will try to bring each buffer |
2222 |
in the Viper state that is most appropriate for that buffer. |
in the Viper state that is most appropriate for that buffer. |
2223 |
Usually, this would be the Vi state, but sometimes it could be the Insert |
Usually, this would be the Vi state, but sometimes it could be the Insert |
2224 |
state or the Emacs state. |
state or the Emacs state. |
2605 |
@end lisp |
@end lisp |
2606 |
|
|
2607 |
You can also change this setting interactively, through the customization |
You can also change this setting interactively, through the customization |
2608 |
widget of Emacs (choose option "Customize.Customize Group" from the |
widget of Emacs (type @kbd{:customize}). |
|
menubar). |
|
2609 |
|
|
2610 |
The region that is chosen as a pattern to search for is determined as |
The region that is chosen as a pattern to search for is determined as |
2611 |
follows. If search is invoked via a single click, Viper chooses the region |
follows. If search is invoked via a single click, Viper chooses the region |
2720 |
If, however, you need to use a macro regularly, it must be given a |
If, however, you need to use a macro regularly, it must be given a |
2721 |
permanent name and saved. Emacs manual explains how to do this, but |
permanent name and saved. Emacs manual explains how to do this, but |
2722 |
invocation of named Emacs macros is quite different from Vi's. First, |
invocation of named Emacs macros is quite different from Vi's. First, |
2723 |
invocation of permanent Emacs macros takes time because of the extra keys. |
invocation of permanent Emacs macros takes time because it requires typing |
2724 |
|
too many keys (to a Vi user's taste, anyway). |
2725 |
Second, binding such macros to function keys, for |
Second, binding such macros to function keys, for |
2726 |
fast access, hogs valuable real estate on the keyboard. |
fast access, hogs valuable real estate on the keyboard. |
2727 |
|
|
2729 |
the meaning of key sequences: keys typed in fast succession are treated |
the meaning of key sequences: keys typed in fast succession are treated |
2730 |
specially, if this key sequence is bound to a macro. |
specially, if this key sequence is bound to a macro. |
2731 |
|
|
2732 |
Viper provides keyboard macros through the usual Ex commands, @kbd{:map} and |
Viper provides Vi-style keyboard macros through the usual Ex commands, |
2733 |
@kbd{:map!}. Vi-style macros are much more powerful in Viper than |
@kbd{:map} and |
2734 |
|
@kbd{:map!}. These macros are much more powerful in Viper than |
2735 |
they are in the original Vi and in other emulators. This is because Viper |
they are in the original Vi and in other emulators. This is because Viper |
2736 |
implements an enhanced vi-style |
implements an enhanced vi-style |
2737 |
interface to the powerful Emacs keyboard macro facility. |
interface to the powerful Emacs keyboard macro facility. |
4476 |
mbutler@@redfernnetworks.com (Malcolm Butler), |
mbutler@@redfernnetworks.com (Malcolm Butler), |
4477 |
mveiga@@dit.upm.es (Marcelino Veiga Tuimil), |
mveiga@@dit.upm.es (Marcelino Veiga Tuimil), |
4478 |
paulk@@summit.esg.apertus.com (Paul Keusemann), |
paulk@@summit.esg.apertus.com (Paul Keusemann), |
4479 |
pfister@@cs.sunysb.edu (Hanspeter Pfister), |
pfister@@cs.stonybrook.edu (Hanspeter Pfister), |
4480 |
phil_brooks@@MENTORG.COM (Phil Brooks), |
phil_brooks@@MENTORG.COM (Phil Brooks), |
4481 |
pogrell@@informatik.hu-berlin.de (Lutz Pogrell), |
pogrell@@informatik.hu-berlin.de (Lutz Pogrell), |
4482 |
pradyut@@cs.uchicago.edu (Pradyut Shah), |
pradyut@@cs.uchicago.edu (Pradyut Shah), |