summaryrefslogtreecommitdiff
path: root/doc/misc/viper.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/misc/viper.texi')
-rw-r--r--doc/misc/viper.texi130
1 files changed, 68 insertions, 62 deletions
diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi
index 0048d1363f..ee3a4d057e 100644
--- a/doc/misc/viper.texi
+++ b/doc/misc/viper.texi
@@ -170,8 +170,8 @@ world of Vi! These users are well familiar with Emacs bindings and prefer them
in some cases, especially in the Vi Insert state. John Hawkins
<jshawkin@@eecs.umich.edu> has provided a set of customizations, which
enables additional Emacs bindings under Viper. These customizations can be
-included in your @file{~/.viper} file and are found at the following URL:
-@file{http://traeki.freeshell.org/files/viper-sample}.
+included in your @file{~/.emacs.d/viper} file and are found at the
+following URL: @file{http://traeki.freeshell.org/files/viper-sample}.
@menu
* Emacs Preliminaries:: Basic concepts in Emacs.
@@ -329,14 +329,14 @@ the place where all general Emacs customization takes place. Beginning with
version 20.0, Emacsen have an interactive interface, which simplifies the
job of customization significantly.
-Viper also uses the file @file{~/.viper} for Viper-specific customization.
+Viper also uses the file @file{~/.emacs.d/viper} for Viper-specific customization.
The location of Viper customization file can be changed by setting the
variable @code{viper-custom-file-name} in @file{.emacs} @emph{prior} to loading
Viper.
The latest versions of Emacs have an interactive customization facility,
which allows you to (mostly) bypass the use of the @file{.emacs} and
-@file{.viper} files. You can reach this customization
+@code{viper-custom-file-name} files. You can reach this customization
facility from within Viper's VI state by executing the Ex command
@kbd{:customize}.
@@ -611,8 +611,8 @@ is slightly different from other programs. It is designed to minimize the
need for deleting file names that Emacs provides in its prompts. (This is
usually convenient, but occasionally the prompt may suggest a wrong file
name for you.) If you see a prompt @kbd{/usr/foo/} and you wish to edit the
-file @kbd{~/.viper}, you don't have to erase the prompt. Instead, simply
-continue typing what you need. Emacs will interpret @kbd{/usr/foo/~/.viper}
+file @kbd{~/.file}, you don't have to erase the prompt. Instead, simply
+continue typing what you need. Emacs will interpret @kbd{/usr/foo/~/.file}
correctly. Similarly, if the prompt is @kbd{~/foo/} and you need to get to
@kbd{/bar/file}, keep typing. Emacs interprets @kbd{~/foo//bar/} as
@kbd{/bar/file}, since when it sees @samp{//}, it understands that
@@ -795,8 +795,8 @@ between the Vi state and Insert state at will, and even use the replace mode.
Initially, the minibuffer comes up in Insert state.
Some users prefer plain Emacs bindings in the minibuffer. To this end, set
-@code{viper-vi-style-in-minibuffer} to @code{nil} in @file{.viper}.
-@xref{Customization}, to learn how to do this.
+@code{viper-vi-style-in-minibuffer} to @code{nil} in
+your Viper customization file. @xref{Customization}, to learn how to do this.
When the minibuffer changes Viper states, you will notice that the appearance
of the text there changes as well. This is useful because the minibuffer
@@ -989,8 +989,8 @@ In the Overview chapter, some Multiple File issues were discussed
(@pxref{Multiple Files in Viper}). In addition to the files, Emacs has
buffers. These can be seen in the @kbd{:args} list and switched using
@kbd{:next} if you type @kbd{:set ex-cycle-through-non-files t}, or
-specify @code{(setq ex-cycle-through-non-files t)} in your @file{.viper}
-file. @xref{Customization}, for details.
+specify @code{(setq ex-cycle-through-non-files t)} in your
+Viper customization file. @xref{Customization}, for details.
@node Undo and Backups
@section Undo and Backups
@@ -1132,7 +1132,8 @@ of the form @kbd{/foo//bar} as @kbd{/bar} and @kbd{/foo/~/bar} as
@cindex word search
Viper provides buffer search, the ability to search the buffer for a region
-under the cursor. You have to turn this on in @file{.viper} either by calling
+under the cursor. You have to turn this on in your Viper customization file
+either by calling
@example
(viper-buffer-search-enable)
@@ -1182,10 +1183,10 @@ variable that controls how search patterns are highlighted is
@end example
@vindex @code{viper-search-face}
@noindent
-in @file{~/.viper}. If you want to change how patterns are highlighted, you
-will have to change @code{viper-search-face} to your liking. The easiest
-way to do this is to use Emacs customization widget, which is accessible
-from the menubar. Viper customization group is located under the
+in your Viper customization file. If you want to change how patterns are
+highlighted, you will have to change @code{viper-search-face} to your liking.
+The easiest way to do this is to use Emacs customization widget, which is
+accessible from the menubar. Viper customization group is located under the
@emph{Emulations} customization group, which in turn is under the
@emph{Editing} group (or simply by typing @kbd{:customize}). All Viper
faces are grouped together under Viper's
@@ -1225,8 +1226,8 @@ Facilities like this make Vi's @kbd{:ab} command obsolete.
Viper can be set free from the line--limited movements in Vi, such as @kbd{l}
refusing to move beyond the line, @key{ESC} moving one character back,
-etc. These derive from Ex, which is a line editor. If your @file{.viper}
-contains
+etc. These derive from Ex, which is a line editor. If your
+Viper customization file contains
@example
@code{(setq viper-ex-style-motion nil)}
@@ -1306,9 +1307,10 @@ These two keys invoke many important Emacs functions. For example, if you
hit @kbd{C-x} followed by @kbd{2}, then the current window will be split
into 2. Except for novice users, @kbd{C-c} is also set to execute an Emacs
command from the current major mode. @key{ESC} will do the same, if you
-configure @key{ESC} as Meta by setting @code{viper-no-multiple-ESC} to @code{nil}
-in @file{.viper}. @xref{Customization}. @kbd{C-\} in Insert, Replace, or Vi
-states will make Emacs think @kbd{Meta} has been hit.
+configure @key{ESC} as Meta by setting @code{viper-no-multiple-ESC} to
+@code{nil} in your Viper customization file. @xref{Customization}.
+@kbd{C-\} in Insert, Replace, or Vi states will make Emacs think
+@kbd{Meta} has been hit.
@item \
@kindex @kbd{\}
Escape to Emacs to execute a single Emacs command. For instance,
@@ -1574,9 +1576,9 @@ Customization can be done in 2 ways.
@item
@cindex initialization
@cindex .viper
-Elisp code in a @file{.viper} file in your home directory. Viper
-loads @file{.viper} just before it does the binding for mode
-hooks. This is recommended for experts only.
+Elisp code in a @file{~/.emacs.d/viper} (or @file{~/.viper}) file.
+Viper loads this file just before it does the binding for mode hooks.
+This is recommended for experts only.
@item
@cindex .emacs
Elisp code in your @file{.emacs} file before and after the @code{(require
@@ -1591,12 +1593,12 @@ customization widget, which lets you change the values of Viper
customizable variables easily. This method is good for novice and
experts alike. The customization code in the form of Lisp commands will be
placed in @file{~/.emacs} or some other customization file depending on the
-version of Emacs that you use. Still, it is recommended to separate
+version of Emacs that you use. Still, it is recommended to separate
Viper-related customization produced by the Emacs customization widget
-and keep it in the @file{.viper} file.
+and keep it in your Viper customization file.
Some advanced customization cannot be accomplished this way, however, and
-has to be done in Emacs Lisp in the @file{.viper} file. For the common
+has to be done in Emacs Lisp in your Viper customization file. For the common
cases, examples are provided that you can use directly.
@end itemize
@@ -1753,10 +1755,10 @@ cases. @code{nil} means you either has to invoke @code{viper-mode} manually
for each buffer (or you can add @code{viper-mode} to the appropriate major mode
hooks using @code{viper-load-hook}).
-This option must be set in the file @file{~/.viper}.
-@item viper-custom-file-name "~/.viper"
+This option must be set in your Viper customization file.
+@item viper-custom-file-name "~/.emacs.d/viper"
File used for Viper-specific customization.
-Change this setting, if you want. Must be set in @file{.emacs} (not @file{.viper}!)
+Change this setting, if you want. Must be set in @file{.emacs}
before Viper is loaded. Note that you
have to set it as a string inside double quotes.
@item viper-spell-function 'ispell-region
@@ -1807,8 +1809,8 @@ Both these macros are bound (as Viper macros) to
@code{viper-repeat-from-history},
which checks the second key by which it is invoked to see which of the
previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only,
-but the user can bind more in @file{~/.viper}. @xref{Vi Macros}, for how to do
-this.
+but the user can bind more in his/her Viper customization file.
+@xref{Vi Macros}, for how to do this.
@item viper-keep-point-on-undo nil
If not @code{nil}, Viper tries to not move point when undoing commands.
Instead, it will briefly move the cursor to the place where change has
@@ -1873,7 +1875,7 @@ emulate the standard Vi behavior, which supports only intra-line
replacement regions (and multi-line replacement regions are deleted).
@item viper-toggle-key "\C-z"
Specifies the key used to switch from Emacs to Vi and back.
-Must be set in @file{.viper}. This variable can't be
+Must be set in your Viper customization file. This variable can't be
changed interactively after Viper is loaded.
In Insert state, this key acts as a temporary escape to Vi state, i.e., it
@@ -1906,7 +1908,7 @@ the last chance to do customization before Viper is up and running.
@noindent
You can reset some of these constants in Viper with the Ex command @kbd{:set}
(when so indicated in the table). Or you
-can include a line like this in your @file{.viper} file:
+can include a line like this in your Viper customization file:
@example
(setq viper-case-fold-search t)
@end example
@@ -2018,7 +2020,7 @@ state.
If you want to
bind a key, say @kbd{C-v}, to the function that scrolls
page down and to make @kbd{0} display information on the current buffer,
-putting this in @file{.viper} will do the trick in Vi state:
+putting this in your Viper customization file will do the trick in Vi state:
@example
(define-key viper-vi-global-user-map "\C-v" 'scroll-down)
@end example
@@ -2067,11 +2069,12 @@ keys necessary in that keymap, and put
@end example
@noindent
-in @file{~/.viper}. To do the same in Vi and Insert states, you should use
-@code{vi-state} and @code{insert-state}. Changes in Insert state are also
-in effect in Replace state. For instance, suppose that the user wants to
-use @kbd{dd} in Vi state under Dired mode to delete files, @kbd{u} to unmark
-files, etc. The following code in @file{~/.viper} will then do the job:
+in your Viper customization file. To do the same in Vi and Insert states, you
+should use @code{vi-state} and @code{insert-state}. Changes in Insert state
+are also in effect in Replace state. For instance, suppose that the user wants
+to use @kbd{dd} in Vi state under Dired mode to delete files, @kbd{u} to unmark
+files, etc. The following code in the Viper customization file will then do
+the job:
@example
(setq my-dired-modifier-map (make-sparse-keymap))
@@ -2275,7 +2278,7 @@ can happen only in the beginning, when the minor mode kicks in. Typing
several such minor modes and takes care of them, so the above trick
is usually not necessary. If you find that some minor mode, e.g.,
@code{nasty-mode} interferes with Viper, putting the following in
-@file{.viper} should fix the problem:
+your Viper customization file should fix the problem:
@lisp
(viper-harness-minor-mode "nasty-mode")
@end lisp
@@ -2332,8 +2335,8 @@ document. Other features are explained here.
@item viper-buffer-search-char nil
Enable buffer search. Explicit call to @code{viper-buffer-search-enable}
sets @code{viper-buffer-search-char} to @kbd{g}. Alternatively, the user can
-set @code{viper-buffer-search-char} in @file{.viper} to a key sequence
-to be used for buffer search. There is no need to call
+set @code{viper-buffer-search-char} in his/her Viper customization file to a key
+sequence to be used for buffer search. There is no need to call
@code{viper-buffer-search-enable} in that case.
@findex @code{viper-buffer-search-enable}
@vindex @code{viper-buffer-search-char}
@@ -2356,8 +2359,8 @@ If you hit something other than @kbd{/} after the first @kbd{/} or if the
second @kbd{/} doesn't follow quickly enough, then Viper will issue the
usual prompt @kbd{/} and will wait for input, as usual in Vi.
If you don't like this behavior, you can ``unrecord'' these macros in your
-@file{~/.viper} file. For instance, if you don't like the above feature, put
-this in @file{~/.viper}:
+Viper customization file. For instance, if you don't like the above
+feature, put this in the file:
@example
(viper-set-searchstyle-toggling-macros 'undefine)
@end example
@@ -2444,7 +2447,7 @@ the direction of newer insertions. Hitting @kbd{C-c M-p} or @kbd{C-c M-n}
in succession
will undo the previous insertion from the ring and insert the next item on
the ring. If a larger ring size is needed, change the value of the above
-variable in the @file{~/.viper} file.
+variable in the Viper customization file.
Since typing these sequences of keys may be tedious, it is suggested that the
user should bind a function key, such as @kbd{f31}, as follows:
@@ -2515,7 +2518,7 @@ putting
(copy-face 'default 'viper-minibuffer-insert-face)
(copy-face 'default 'viper-minibuffer-emacs-face)
@end example
-in the @file{~/.viper} file or through the customization widget, as
+in their Viper customization file or through the customization widget, as
described above. However, in that case, the user will not have any
indication of the current Viper state in the minibuffer. (This is important
if the user accidentally switches to another Viper state by typing @key{ESC} or
@@ -2587,8 +2590,8 @@ Note: while loading initially, Viper binds this mouse action only if it is
not already bound to something else. If you want to use the mouse-search
feature, and the @kbd{Meta-Shift-Mouse-1} mouse action is already bound to
something else, you can rebind the mouse-search feature by setting
-@code{viper-mouse-search-key} to something else in your @code{~/.viper}
-file:
+@code{viper-mouse-search-key} to something else in
+your Viper customization file:
@lisp
(setq viper-mouse-search-key '(meta 1))
@end lisp
@@ -2600,7 +2603,8 @@ Meta key and clicking mouse button 1. The allowed values of
If the requested mouse action (e.g., (meta 1)) is already taken for other
purposes then you have to confirm your intention by placing the following
-command in @code{~/.viper} after setting @code{viper-mouse-search-key}:
+command in your Viper customization file after setting
+@code{viper-mouse-search-key}:
@lisp
(viper-bind-mouse-search-key 'force)
@end lisp
@@ -2642,13 +2646,13 @@ case of a triple-click, the prefix argument is ignored.)
Note: while loading initially, Viper binds this mouse action only if it not
already bound to something else. If you want to use this feature and the
default mouse action is already bound, you can rebind mouse-insert by
-placing this command in @code{~/.viper}:
+placing this command in your Viper customization file:
@lisp
(setq viper-mouse-insert-key '(meta 2))
@end lisp
If you want to bind mouse-insert to an action even if this action is
already taken for other purposes in Emacs, then you should add this command
-to @code{~/.viper}, after setting @code{viper-mouse-insert-key}:
+to your Viper customization file, after setting @code{viper-mouse-insert-key}:
@lisp
(viper-bind-mouse-insert-key 'force)
@end lisp
@@ -2785,7 +2789,7 @@ Manual}.
When the user finishes defining a macro (which is done by typing @kbd{C-x)},
a departure from Vi), you will be asked whether you want this
macro to be global, mode-specific, or buffer-specific. You will also be
-given a chance to save the macro in your @file{~/.viper} file.
+given a chance to save the macro in your Viper customization file.
This is the easiest way to save a macro and make
it permanently available. If you work your startup files with bare hands,
here is how Viper saves the above macro so that it will be
@@ -2834,8 +2838,8 @@ the latter says that the macro is to be defined for all buffers
For convenience, Viper also lets you define Vi-style macros in its Emacs
state. There is no Ex command, like @kbd{:map} and @kbd{:map!} for doing
-this, but the user can include such a macro in the @file{~/.viper} file. The
-only thing is that the @code{viper-record-kbd-macro} command should specify
+this, but the user can include such a macro in the Viper customization file.
+The only thing is that the @code{viper-record-kbd-macro} command should specify
@code{emacs-state} instead of @code{vi-state} or @code{insert-state}.
The user can get rid of a macro either by using the Ex commands @kbd{:unmap}
@@ -2899,8 +2903,9 @@ Vi and Emacs commands, so that you could see what will happen each time the
macro is executed. Suppose now we wanted to bind the key sequence
@kbd{f13 f13} to the command @code{eval-last-sexp}. To accomplish this, we
can type @kbd{M-x eval-last-sexp} followed by @kbd{C-x )}.
-If you answer positively to Viper's offer to save this macro in @file{~/.viper}
-for future uses, the following will be inserted in that file:
+If you answer positively to Viper's offer to save this macro in your
+Viper customization file for future uses, the following will be inserted
+in that file:
@example
(viper-record-kbd-macro [f16 f16] 'vi-state
@@ -2972,8 +2977,8 @@ The rate at which the user must type keys in order for them to be
recognized as a timeout macro is controlled by the variable
@code{viper-fast-keyseq-timeout}, which defaults to 200 milliseconds.
-For the most part, Viper macros defined in @file{~/.viper} can be shared
-between X and TTY modes.
+For the most part, Viper macros defined in the Viper customization file can
+be shared between X and TTY modes.
The problem with TTY may be that the function keys there generate sequences
of events instead of a single event (as under a window system).
Emacs maps some of these sequences back to the logical keys
@@ -3359,7 +3364,8 @@ this function.
Find the next bracket/parenthesis/brace and go to its match.
By default, Viper ignores brackets/parentheses/braces that occur inside
parentheses. You can change this by setting
-@code{viper-parse-sexp-ignore-comments} to @code{nil} in your @file{.viper} file.
+@code{viper-parse-sexp-ignore-comments} to @code{nil} in your Viper
+customization file.
This option can also be toggled interactively if you quickly hit @kbd{%%%}.
This latter feature is implemented as a vi-style keyboard macro. If you
@@ -3370,7 +3376,7 @@ don't want this macro, put
@end example
@findex @code{viper-set-parsing-style-toggling-macro}
-in your @file{~/.viper} file.
+in your Viper customization file.
@end table
@kindex @kbd{%}
@@ -3544,7 +3550,7 @@ then be executed by typing `@kbd{.}'.
Since typing the above sequences of keys may be tedious, the
functions doing the perusing can be bound to unused keyboard keys in the
-@file{~/.viper} file. @xref{Viper Specials}, for details.
+Viper customization file. @xref{Viper Specials}, for details.
@end table
@kindex @kbd{C-c M-p}
@kindex @kbd{C-c M-n}
@@ -3984,7 +3990,7 @@ Write the file. Viper makes sure that a final newline is always added to
any file where this newline is missing. This is done by setting Emacs
variable @code{require-final-newline} to @code{t}. If you don't like this
feature, use @code{setq-default} to set @code{require-final-newline} to
-@code{nil}. This must be done in @file{.viper} file.
+@code{nil}. This must be done in the Viper customization file.
@item :[x,y] w <name>
Write to the file <name>.
@item :[x,y] w>> <name>