2285 |
bind common keys to specialized commands. This might make sense for modes |
bind common keys to specialized commands. This might make sense for modes |
2286 |
that bind only a small number of common keys. For instance, Viper subverts |
that bind only a small number of common keys. For instance, Viper subverts |
2287 |
the Shell mode by changing the bindings for @kbd{C-m} and @kbd{C-d} using |
the Shell mode by changing the bindings for @kbd{C-m} and @kbd{C-d} using |
2288 |
@code{viper-add-local-keys} described in section on customization |
@code{viper-add-local-keys} described in the section on customization |
2289 |
(@pxref{Customization}). |
(@pxref{Customization}). |
2290 |
|
|
2291 |
In some cases, some @emph{minor} modes might override certain essential |
In some cases, some @emph{minor} modes might override certain essential |
2294 |
@code{M-x viper-mode} will correct the situation. Viper knows about |
@code{M-x viper-mode} will correct the situation. Viper knows about |
2295 |
several such minor modes and takes care of them, so the above trick |
several such minor modes and takes care of them, so the above trick |
2296 |
is usually not necessary. If you find that some minor mode, e.g., |
is usually not necessary. If you find that some minor mode, e.g., |
2297 |
@code{nasty-mode.el} interferes with Viper, putting the following in |
@code{nasty-mode} interferes with Viper, putting the following in |
2298 |
@file{.viper} should fix the problem: |
@file{.viper} should fix the problem: |
2299 |
@lisp |
@lisp |
2300 |
(viper-harness-minor-mode "nasty-mode") |
(viper-harness-minor-mode "nasty-mode") |
2305 |
|
|
2306 |
It may not be always obvious which minor mode is at fault. The only |
It may not be always obvious which minor mode is at fault. The only |
2307 |
guidance here is to look into the file that defines the minor mode you are |
guidance here is to look into the file that defines the minor mode you are |
2308 |
suspecting, say @code{nasty-mode.el}, and see if it has a variable called |
suspecting, say @file{nasty-mode.el}, and see if it has a variable called |
2309 |
@code{nasty-mode-map}. Then check if there is a statement of the form |
@code{nasty-mode-map}. Then check if there is a statement of the form |
2310 |
@lisp |
@lisp |
2311 |
(define-key nasty-mode-map key function) |
(define-key nasty-mode-map key function) |
2316 |
suspicion is wrong, no harm is done if you harness a minor mode that |
suspicion is wrong, no harm is done if you harness a minor mode that |
2317 |
doesn't need to be harnessed. |
doesn't need to be harnessed. |
2318 |
|
|
2319 |
|
It is recommended to harness even those minor modes that don't override |
2320 |
|
Viper keys, but still have their own keymaps. A general way to |
2321 |
|
make a minor mode, @code{my-mode}, |
2322 |
|
compatible with Viper is to have the file @file{my-mode.el} include the following code: |
2323 |
|
|
2324 |
|
@lisp |
2325 |
|
(when (fboundp 'viper-harness-minor-mode) |
2326 |
|
(let ((lib (file-name-sans-extension |
2327 |
|
(file-name-nondirectory load-file-name)))) |
2328 |
|
(viper-harness-minor-mode lib))) |
2329 |
|
@end lisp |
2330 |
|
|
2331 |
@vindex @code{viper-want-emacs-keys-in-vi} |
@vindex @code{viper-want-emacs-keys-in-vi} |
2332 |
@vindex @code{viper-want-emacs-keys-in-insert} |
@vindex @code{viper-want-emacs-keys-in-insert} |
2333 |
@vindex @code{viper-always} |
@vindex @code{viper-always} |
2383 |
@end example |
@end example |
2384 |
@findex @code{viper-set-searchstyle-toggling-macros} |
@findex @code{viper-set-searchstyle-toggling-macros} |
2385 |
|
|
2386 |
|
If you don't like this feature as a default, but would still like to have |
2387 |
|
it in some major modes, you can do so by first unsetting it globally, as |
2388 |
|
shown above, and then setting it in the desired major modes as follows: |
2389 |
|
@example |
2390 |
|
(viper-set-searchstyle-toggling-macros nil 'c-mode) |
2391 |
|
(viper-set-searchstyle-toggling-macros nil 'lisp-mode) |
2392 |
|
@end example |
2393 |
|
|
2394 |
@item Vi-isms in Emacs state |
@item Vi-isms in Emacs state |
2395 |
Some people find it useful to use the Vi-style search key, `/', to invoke |
Some people find it useful to use the Vi-style search key, `/', to invoke |
2396 |
search in modes which Viper leaves in emacs-state. These modes are: |
search in modes which Viper leaves in emacs-state. These modes are: |
2397 |
@code{dired-mode}, @code{mh-folder-mode}, @code{gnus-group-mode}, |
@code{dired-mode}, @code{mh-folder-mode}, |
2398 |
@code{gnus-summary-mode}, @code{Info-mode}, and @code{Buffer-menu-mode} |
@code{Info-mode}, and @code{Buffer-menu-mode} |
2399 |
(more may be added in the future). So, in the above modes, Viper binds `/' |
(more may be added in the future). So, in the above modes, Viper binds `/' |
2400 |
so that it will behave Vi-style. Furthermore, in those major modes, Viper |
so that it will behave Vi-style. Furthermore, in those major modes, Viper |
2401 |
binds `:' to invoke ex-style commands, like in vi-state. And, as described |
binds `:' to invoke ex-style commands, like in vi-state. And, as described |
4490 |
gvr@@halcyon.com (George V.@: Reilly), |
gvr@@halcyon.com (George V.@: Reilly), |
4491 |
hatazaki@@bach.convex.com (Takao Hatazaki), |
hatazaki@@bach.convex.com (Takao Hatazaki), |
4492 |
hpz@@ibmhpz.aug.ipp-garching.mpg.de (Hans-Peter Zehrfeld), |
hpz@@ibmhpz.aug.ipp-garching.mpg.de (Hans-Peter Zehrfeld), |
4493 |
|
irie@@t.email.ne.jp (Irie Tetsuya), |
4494 |
jackr@@dblues.engr.sgi.com (Jack Repenning), |
jackr@@dblues.engr.sgi.com (Jack Repenning), |
4495 |
jamesm@@bga.com (D.J.@: Miller II), |
jamesm@@bga.com (D.J.@: Miller II), |
4496 |
jjm@@hplb.hpl.hp.com (Jean-Jacques Moreau), |
jjm@@hplb.hpl.hp.com (Jean-Jacques Moreau), |