comparison man/viper.texi @ 181:bfd6434d15b3 r20-3b17

Import from CVS: tag r20-3b17
author cvs
date Mon, 13 Aug 2007 09:53:19 +0200
parents 2d532a89d707
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
180:add28d59e586 181:bfd6434d15b3
12 @finalout 12 @finalout
13 @end iftex 13 @end iftex
14 14
15 @titlepage 15 @titlepage
16 @title Viper Is a Package for Emacs Rebels 16 @title Viper Is a Package for Emacs Rebels
17 @subtitle a Vi emulator for GNU Emacs 19 and XEmacs 19 17 @subtitle a Vi emulator for GNU Emacs 20 and XEmacs 20
18 @subtitle July 1997, Viper Version 2.95 18 @subtitle August 1997, Viper Version 2.96
19 19
20 @author Michael Kifer (Viper)
21 @author Aamod Sane (VIP 4.4)
20 @author Masahiko Sato (VIP 3.5) 22 @author Masahiko Sato (VIP 3.5)
21 @author Aamod Sane (VIP 4.4)
22 @author Michael Kifer (Viper)
23 23
24 @page 24 @page
25 @vskip 0pt plus 1fill 25 @vskip 0pt plus 1fill
26 @end titlepage 26 @end titlepage
27 27
61 Viper Is a Package for Emacs Rebels; 61 Viper Is a Package for Emacs Rebels;
62 it is a VI Plan for Emacs Rescue 62 it is a VI Plan for Emacs Rescue
63 and/or a venomous VI PERil. 63 and/or a venomous VI PERil.
64 @end example 64 @end example
65 65
66 Technically speaking, Viper is a Vi emulation package for GNU Emacs 19 and 66 Technically speaking, Viper is a Vi emulation package for GNU Emacs and
67 XEmacs 19. Because of its reliance on minor mode keymaps, Viper will not 67 XEmacs. It implements all Vi and Ex commands, occasionally improving on
68 work under Emacs 18. Viper implements most Vi and Ex commands. It gives you 68 them and adding many new features. It gives the user the best of both
69 the best of both worlds: Vi keystrokes for editing combined with the GNU 69 worlds: Vi keystrokes for editing combined with the power of Emacs environment.
70 Emacs environment. Viper also fixes some common complaints with Vi 70
71 commands. This manual describes Viper, concentrating on the differences 71 Viper emulates Vi at several levels, from the one that closely follows Vi
72 from Vi and new features of Viper. 72 conventions to the one that departs from many of them. It has many
73 customizable options, which can be used to tailor Viper to the work habits
74 of various users.
75 This manual describes Viper, concentrating on the differences from Vi and
76 new features of Viper.
73 77
74 Viper, formerly known as VIP-19, was written by Michael Kifer. It is based 78 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. 79 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. 80 Viper tries to be compatible with these packages.
77 81
117 Viper Is a Package for Emacs Rebels; 121 Viper Is a Package for Emacs Rebels;
118 it is a VI Plan for Emacs Rescue 122 it is a VI Plan for Emacs Rescue
119 and/or a venomous VI PERil. 123 and/or a venomous VI PERil.
120 @end example 124 @end example
121 125
122 Viper is a Vi emulation package for GNU Emacs 19 and XEmacs 19. Because of 126 Viper is a Vi emulation package for GNU Emacs 20 and XEmacs 20. Viper
123 its reliance on minor mode keymaps, it will not work under Emacs 18. Viper 127 contains virtually all of Vi and Ex functionality and much more. It
124 contains virtually all of Vi and Ex functionality and much more. It gives 128 gives you the best of both worlds: Vi keystrokes for editing combined
125 you the best of both worlds: Vi keystrokes for editing combined with the 129 with the GNU Emacs environment. Viper also fixes some common complaints
126 GNU Emacs environment. Viper also fixes some common complaints with Vi 130 with Vi commands. This manual describes Viper, concentrating on the
127 commands. This manual describes Viper, concentrating on the differences 131 differences from Vi and on the new features of Viper.
128 from Vi and on the new features of Viper.
129 132
130 Viper was written by Michael Kifer. It is based on VIP version 3.5 by 133 Viper was written by Michael Kifer. It is based on VIP version 3.5 by
131 Masahiko Sato and VIP version 4.4 by Aamod Sane. Viper tries to be 134 Masahiko Sato and VIP version 4.4 by Aamod Sane. Viper tries to be
132 compatible with these packages. 135 compatible with these packages.
133 136
262 If no function is bound to a key in the 265 If no function is bound to a key in the
263 local map, however, the function bound to the key in the global map 266 local map, however, the function bound to the key in the global map
264 will be executed. @xref{Major Modes,Major Modes,Major Modes,emacs,The 267 will be executed. @xref{Major Modes,Major Modes,Major Modes,emacs,The
265 GNU Emacs Manual}, for more information.@refill 268 GNU Emacs Manual}, for more information.@refill
266 269
267 A buffer can also have a @dfn{minor mode}. Minor modes are options that you 270 A buffer can also have a @dfn{minor mode}. Minor modes are options that
268 can use or not. A buffer in @code{text-mode} can have @code{auto-fill-mode} 271 you can use or not. A buffer in @code{text-mode} can have
269 as minor mode, which can be turned off or on at any time. In Emacs 19, a 272 @code{auto-fill-mode} as minor mode, which can be turned off or on at
270 minor mode may have it own keymap, which overrides the local keymap when 273 any time. In Emacs, a minor mode may have it own keymap,
271 the minor mode is turned on. For more information, @pxref{Minor 274 which overrides the local keymap when the minor mode is turned on. For
272 Modes,Minor Modes,Minor Modes,emacs,The GNU Emacs Manual} @refill 275 more information, @pxref{Minor Modes,Minor Modes,Minor Modes,emacs,The
276 GNU Emacs Manual} @refill
273 277
274 @cindex Viper as minor mode 278 @cindex Viper as minor mode
275 @cindex Control keys 279 @cindex Control keys
276 @cindex Meta key 280 @cindex Meta key
277 281
321 @end lisp 325 @end lisp
322 @noindent 326 @noindent
323 (@xref{Vi State}, for the explanation of Vi command state.) 327 (@xref{Vi State}, for the explanation of Vi command state.)
324 328
325 The location of Viper customization file can be changed by setting the 329 The location of Viper customization file can be changed by setting the
326 variable @code{vip-custom-file-name} in @file{.emacs} @emph{prior} to loading 330 variable @code{viper-custom-file-name} in @file{.emacs} @emph{prior} to loading
327 Viper. 331 Viper.
328 332
329 Once invoked, Viper will arrange to bring up Emacs buffers in Vi state 333 Once invoked, Viper will arrange to bring up Emacs buffers in Vi state
330 whenever this makes sense. 334 whenever this makes sense.
331 @xref{Packages that Change Keymaps}, to find out when forcing Vi command state 335 @xref{Packages that Change Keymaps}, to find out when forcing Vi command state
347 new commands that, in many cases, are more convenient than @kbd{:e}, 351 new commands that, in many cases, are more convenient than @kbd{:e},
348 @kbd{:vi}, and similar old-style Vi commands.)@refill 352 @kbd{:vi}, and similar old-style Vi commands.)@refill
349 353
350 Finally, if at some point you would want to get de-Viperize your running 354 Finally, if at some point you would want to get de-Viperize your running
351 copy of Emacs after Viper has been loaded, the command @kbd{M-x 355 copy of Emacs after Viper has been loaded, the command @kbd{M-x
352 viper-go-away} will do it for you. 356 viper-go-away} will do it for you. The function @code{toggle-viper-mode}
357 toggles Viperization of Emacs on and off.
353 358
354 @node States in Viper, The Minibuffer, Loading Viper,Overview 359 @node States in Viper, The Minibuffer, Loading Viper,Overview
355 @section States in Viper 360 @section States in Viper
356 361
357 @kindex @kbd{C-z} 362 @kindex @kbd{C-z}
361 @cindex Vi state 366 @cindex Vi state
362 @cindex Insert state 367 @cindex Insert state
363 @cindex Replace state 368 @cindex Replace state
364 @cindex Ex commands 369 @cindex Ex commands
365 @findex @code{viper-go-away} 370 @findex @code{viper-go-away}
371 @findex @code{toggle-viper-mode}
366 372
367 Viper has four states, Emacs, Vi, Insert, and Replace. 373 Viper has four states, Emacs, Vi, Insert, and Replace.
368 374
369 @table @samp 375 @table @samp
370 @item Emacs state 376 @item Emacs state
517 @samp{Recursive Edits} in Emacs for which there is no comparable Vi 523 @samp{Recursive Edits} in Emacs for which there is no comparable Vi
518 functionality and no key-binding. Recursive edits are indicated by 524 functionality and no key-binding. Recursive edits are indicated by
519 @samp{[]} brackets framing the modes on the mode line. 525 @samp{[]} brackets framing the modes on the mode line.
520 @xref{Recursive Edit,Recursive 526 @xref{Recursive Edit,Recursive
521 Edit,Recursive Edit,emacs,The GNU Emacs Manual}. 527 Edit,Recursive Edit,emacs,The GNU Emacs Manual}.
522 At user level 1, @kbd{C-g} is bound to @code{vip-info-on-file} 528 At user level 1, @kbd{C-g} is bound to @code{viper-info-on-file}
523 function instead. 529 function instead.
524 @refill 530 @refill
525 @item C-\ 531 @item C-\
526 @kindex @kbd{C-\} 532 @kindex @kbd{C-\}
527 @cindex Meta key 533 @cindex Meta key
544 @item Undo 550 @item Undo
545 @kindex @kbd{u} 551 @kindex @kbd{u}
546 @kbd{u} will undo. Undo can be repeated by the @kbd{.} key. Undo itself 552 @kbd{u} will undo. Undo can be repeated by the @kbd{.} key. Undo itself
547 can be undone. Another @kbd{u} will change the direction. The presence 553 can be undone. Another @kbd{u} will change the direction. The presence
548 of repeatable undo means that @kbd{U}, undoing lines, is not very 554 of repeatable undo means that @kbd{U}, undoing lines, is not very
549 important. Therefore, @kbd{U} also calls @code{vip-undo}. 555 important. Therefore, @kbd{U} also calls @code{viper-undo}.
550 @cindex multiple undo 556 @cindex multiple undo
551 @cindex undo 557 @cindex undo
552 558
553 559
554 @item Counts 560 @item Counts
561 expressions, excepting the change-of-case escapes @samp{\u}, @samp{\L}, 567 expressions, excepting the change-of-case escapes @samp{\u}, @samp{\L},
562 @dots{}, etc. @xref{Regular Expressions,,Regular Expressions,emacs,The 568 @dots{}, etc. @xref{Regular Expressions,,Regular Expressions,emacs,The
563 GNU Emacs Manual}, for details. 569 GNU Emacs Manual}, for details.
564 Files specified to @kbd{:e} use @code{csh} regular expressions 570 Files specified to @kbd{:e} use @code{csh} regular expressions
565 (globbing, wildcards, what have you). 571 (globbing, wildcards, what have you).
566 However, the function @code{vip-toggle-search-style}, bound to @kbd{C-c /}, 572 However, the function @code{viper-toggle-search-style}, bound to @kbd{C-c /},
567 lets the user switch from search with regular expressions to plain vanilla 573 lets the user switch from search with regular expressions to plain vanilla
568 search and vice versa. It also lets one switch from case-sensitive search 574 search and vice versa. It also lets one switch from case-sensitive search
569 to case-insensitive and back. 575 to case-insensitive and back.
570 @xref{Viper Specials}, for more details. 576 @xref{Viper Specials}, for more details.
571 @cindex regular expressions 577 @cindex regular expressions
758 can use the regular Vi commands to edit the Minibuffer. You can switch 764 can use the regular Vi commands to edit the Minibuffer. You can switch
759 between the Vi state and Insert state at will, and even use the replace mode. 765 between the Vi state and Insert state at will, and even use the replace mode.
760 Initially, the Minibuffer comes up in Insert state. 766 Initially, the Minibuffer comes up in Insert state.
761 767
762 Some users prefer plain Emacs bindings in the Minibuffer. To this end, set 768 Some users prefer plain Emacs bindings in the Minibuffer. To this end, set
763 @code{vip-vi-style-in-minibuffer} to @code{nil} in @file{.viper}. 769 @code{viper-vi-style-in-minibuffer} to @code{nil} in @file{.viper}.
764 @xref{Customization}, to learn how to do this. 770 @xref{Customization}, to learn how to do this.
765 771
766 When the Minibuffer changes Viper states, you will notice that the appearance 772 When the Minibuffer changes Viper states, you will notice that the appearance
767 of the text there changes as well. This is useful because the Minibuffer 773 of the text there changes as well. This is useful because the Minibuffer
768 has no mode line to tell which Vi state it is in. 774 has no mode line to tell which Vi state it is in.
1099 1105
1100 Viper provides buffer search, the ability to search the buffer for a region 1106 Viper provides buffer search, the ability to search the buffer for a region
1101 under the cursor. You have to turn this on in @file{.viper} either by calling 1107 under the cursor. You have to turn this on in @file{.viper} either by calling
1102 1108
1103 @example 1109 @example
1104 (vip-buffer-search-enable) 1110 (viper-buffer-search-enable)
1105 @end example 1111 @end example
1106 1112
1107 @noindent 1113 @noindent
1108 or by setting @code{vip-buffer-search-char} to, say, @kbd{f3}: 1114 or by setting @code{viper-buffer-search-char} to, say, @kbd{f3}:
1109 @example 1115 @example
1110 (setq vip-buffer-search-char [f3]) 1116 (setq viper-buffer-search-char [f3])
1111 @end example 1117 @end example
1112 1118
1113 @noindent 1119 @noindent
1114 If the user calls @code{vip-buffer-search-enable} explicitly (the first 1120 If the user calls @code{viper-buffer-search-enable} explicitly (the first
1115 method), then @code{vip-buffer-search-char} will be set to @kbd{g}. 1121 method), then @code{viper-buffer-search-char} will be set to @kbd{g}.
1116 Regardless of how this feature is enabled, the key 1122 Regardless of how this feature is enabled, the key
1117 @code{vip-buffer-search-char} will take movement commands, like 1123 @code{viper-buffer-search-char} will take movement commands, like
1118 @kbd{w,/,e}, to find a region and then search for the contents of that 1124 @kbd{w,/,e}, to find a region and then search for the contents of that
1119 region. This command is very useful for searching for variable names, etc., 1125 region. This command is very useful for searching for variable names, etc.,
1120 in a program. The search can be repeated by @kbd{n} or reversed by @kbd{N}. 1126 in a program. The search can be repeated by @kbd{n} or reversed by @kbd{N}.
1121 1127
1122 @cindex incremental search 1128 @cindex incremental search
1140 word by clicking on it. @xref{Viper Specials}, for details. 1146 word by clicking on it. @xref{Viper Specials}, for details.
1141 1147
1142 Finally, on a window display, Viper highlights search patterns as it finds 1148 Finally, on a window display, Viper highlights search patterns as it finds
1143 them. This is done through what is known as @emph{faces} in Emacs. The 1149 them. This is done through what is known as @emph{faces} in Emacs. The
1144 variable that controls how search patterns are highlighted is 1150 variable that controls how search patterns are highlighted is
1145 @code{vip-search-face}. 1151 @code{viper-search-face}. If you don't want any highlighting at all, put
1146 If you don't want any highlighting at all, put
1147 @example 1152 @example
1148 (setq vip-search-face 'default) 1153 (copy-face 'default 'viper-search-face)
1149 @end example 1154 @end example
1150 @vindex @code{vip-search-face} 1155 @vindex @code{viper-search-face}
1151 @noindent 1156 @noindent
1152 in @file{~/.viper}. If you want to change how patterns are highlighted, you 1157 in @file{~/.viper}. If you want to change how patterns are highlighted, you
1153 will have to set the variable @code{vip-search-face} to some other face, 1158 will have to change @code{viper-search-face} to your liking. The easiest
1154 such as @code{highlight}. If none of the existing faces fits the bill, you 1159 way to do this is to use Emacs customization widget, which is accessible
1155 would have to create your own. Further details on faces can be found 1160 from the menubar. Viper customization group is located under the
1156 in the Emacs Lisp Manual. 1161 @emph{Emulations} customization group, which in turn is under the
1162 @emph{Editing} group. All Viper faces are grouped together under Viper's
1163 @emph{Highlighting} group.
1164
1165 Try it: it is really simple!
1157 1166
1158 @node Abbreviation Facilities,Movement and Markers,Improved Search,Improvements over Vi 1167 @node Abbreviation Facilities,Movement and Markers,Improved Search,Improvements over Vi
1159 @section Abbreviation Facilities 1168 @section Abbreviation Facilities
1160 1169
1161 @cindex abbrevs 1170 @cindex abbrevs
1189 refusing to move beyond the line, @key{ESC} moving one character back, 1198 refusing to move beyond the line, @key{ESC} moving one character back,
1190 etc. These derive from Ex, which is a line editor. If your @file{.viper} 1199 etc. These derive from Ex, which is a line editor. If your @file{.viper}
1191 contains 1200 contains
1192 1201
1193 @example 1202 @example
1194 @code{(setq vip-ex-style-motion nil)} 1203 @code{(setq viper-ex-style-motion nil)}
1195 @end example 1204 @end example
1196 1205
1197 @noindent 1206 @noindent
1198 the motion will be a true screen editor motion. One thing you must then 1207 the motion will be a true screen editor motion. One thing you must then
1199 watch out for is that it is possible to be on the end-of-line character. 1208 watch out for is that it is possible to be on the end-of-line character.
1200 The keys @kbd{x} and @kbd{%} will still work correctly, i.e., as if they 1209 The keys @kbd{x} and @kbd{%} will still work correctly, i.e., as if they
1201 were on the last character. 1210 were on the last character.
1202 1211
1203 @vindex @code{vip-syntax-preference} 1212 @vindex @code{viper-syntax-preference}
1204 @cindex syntax table 1213 @cindex syntax table
1205 1214
1206 The word-movement commands @kbd{w}, @kbd{e}, etc., and the associated 1215 The word-movement commands @kbd{w}, @kbd{e}, etc., and the associated
1207 deletion/yanking commands, @kbd{dw}, @kbd{yw}, etc., can be made to 1216 deletion/yanking commands, @kbd{dw}, @kbd{yw}, etc., can be made to
1208 understand Emacs syntax tables. If the variable 1217 understand Emacs syntax tables. If the variable
1209 @code{vip-syntax-preference} is set to @code{strict-vi} (the default) then 1218 @code{viper-syntax-preference} is set to @code{strict-vi} (the default) then
1210 the meaning of @emph{word} is the same as in 1219 the meaning of @emph{word} is the same as in
1211 Vi. However, if the value is @code{reformed-vi} then the alphanumeric 1220 Vi. However, if the value is @code{reformed-vi} then the alphanumeric
1212 symbols will be those specified by the current Emacs syntax table (which 1221 symbols will be those specified by the current Emacs syntax table (which
1213 may be different for different major modes) plus the underscore symbol 1222 may be different for different major modes) plus the underscore symbol
1214 @kbd{_}. The user can also specify the value @code{emacs}, which would 1223 @kbd{_}. The user can also specify the value @code{emacs}, which would
1215 make Viper use exactly the Emacs notion of word. In particular, the 1224 make Viper use exactly the Emacs notion of word. In particular, the
1216 underscore may not be part of a word. Finally, if 1225 underscore may not be part of a word. Finally, if
1217 @code{vip-syntax-preference} is set to @code{extended}, Viper words would 1226 @code{viper-syntax-preference} is set to @code{extended}, Viper words would
1218 consist of characters that are classified as alphanumeric @emph{or} as 1227 consist of characters that are classified as alphanumeric @emph{or} as
1219 parts of symbols. This is convenient for writing programs and in many other 1228 parts of symbols. This is convenient for writing programs and in many other
1220 situations. 1229 situations.
1221 1230
1222 @code{vip-syntax-preference} is a local variable, so it can have different 1231 @code{viper-syntax-preference} is a local variable, so it can have different
1223 values for different major modes. For instance, in programming modes it can 1232 values for different major modes. For instance, in programming modes it can
1224 have the value @code{extended}. In text modes where words contain special 1233 have the value @code{extended}. In text modes where words contain special
1225 characters, such as European (non-English) letters, Cyrillic letters, etc., 1234 characters, such as European (non-English) letters, Cyrillic letters, etc.,
1226 the value can be @code{reformed-vi} or @code{emacs}. 1235 the value can be @code{reformed-vi} or @code{emacs}.
1227 1236
1228 Changes to @code{vip-syntax-preference} should be done in the hooks to 1237 Changes to @code{viper-syntax-preference} should be done in the hooks to
1229 various major modes. Furthermore, for these changes to take effect, you 1238 various major modes. Furthermore, for these changes to take effect, you
1230 should execute @code{(vip-update-alphanumeric-class)} right after changing 1239 should execute @code{(viper-update-alphanumeric-class)} right after changing
1231 the value of @code{vip-syntax-preference}. 1240 the value of @code{viper-syntax-preference}.
1232 1241
1233 The above discussion of the meaning of Viper's words concerns only Viper's 1242 The above discussion of the meaning of Viper's words concerns only Viper's
1234 movement commands. In regular expressions, words remain the same as in 1243 movement commands. In regular expressions, words remain the same as in
1235 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use 1244 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use
1236 Emacs' idea of what is a word, and they don't look into the value of 1245 Emacs' idea of what is a word, and they don't look into the value of
1237 variable @code{vip-syntax-preference}. This is because Viper doesn't change 1246 variable @code{viper-syntax-preference}. This is because Viper doesn't change
1238 syntax tables in fear of upsetting the various major modes that set these 1247 syntax tables in fear of upsetting the various major modes that set these
1239 tables. 1248 tables.
1240 1249
1241 @cindex textmarkers 1250 @cindex textmarkers
1242 1251
1260 followed by @kbd{2}, then the current window will be split into 2 and you 1269 followed by @kbd{2}, then the current window will be split into 2 and you
1261 will be in Vi state again. Except for novice users, @kbd{C-c} is also set 1270 will be in Vi state again. Except for novice users, @kbd{C-c} is also set
1262 to temporarily escape to Emacs and execute a command from the current 1271 to temporarily escape to Emacs and execute a command from the current
1263 major mode. 1272 major mode.
1264 @key{ESC} will do the same, if 1273 @key{ESC} will do the same, if
1265 you configure @key{ESC} as Meta by setting @code{vip-no-multiple-ESC} to nil 1274 you configure @key{ESC} as Meta by setting @code{viper-no-multiple-ESC} to nil
1266 in @file{.viper}. @xref{Customization}. @kbd{C-\} 1275 in @file{.viper}. @xref{Customization}. @kbd{C-\}
1267 in Insert or Vi states will make Emacs think @kbd{Meta} has been hit.@refill 1276 in Insert or Vi states will make Emacs think @kbd{Meta} has been hit.@refill
1268 @item \ 1277 @item \
1269 @kindex @kbd{\} 1278 @kindex @kbd{\}
1270 Escape to Emacs to execute a single Emacs command. For instance, 1279 Escape to Emacs to execute a single Emacs command. For instance,
1272 @item Q 1281 @item Q
1273 @kindex @kbd{Q} 1282 @kindex @kbd{Q}
1274 @cindex query replace 1283 @cindex query replace
1275 @kbd{Q} is for query replace. By default, 1284 @kbd{Q} is for query replace. By default,
1276 each string to be replaced is treated as a regular expression. You can use 1285 each string to be replaced is treated as a regular expression. You can use
1277 @code{(setq vip-re-query-replace nil)} in your @file{.emacs} file to 1286 @code{(setq viper-re-query-replace nil)} in your @file{.emacs} file to
1278 turn this off. (For normal searches, @kbd{:se nomagic} will work. Note 1287 turn this off. (For normal searches, @kbd{:se nomagic} will work. Note
1279 that @kbd{:se nomagic} turns Regexps off completely, unlike Vi). 1288 that @kbd{:se nomagic} turns Regexps off completely, unlike Vi).
1280 @item v 1289 @item v
1281 @itemx V 1290 @itemx V
1282 @itemx C-v 1291 @itemx C-v
1309 (@code{upcase-region}). 1318 (@code{upcase-region}).
1310 Emacs command @kbd{M-u} does the same for words. 1319 Emacs command @kbd{M-u} does the same for words.
1311 @item # g 1320 @item # g
1312 @kindex @kbd{#g<move>} 1321 @kindex @kbd{#g<move>}
1313 Execute last keyboard macro for each line in the region 1322 Execute last keyboard macro for each line in the region
1314 (@code{vip-global-execute}).@refill 1323 (@code{viper-global-execute}).@refill
1315 @item # q 1324 @item # q
1316 @kindex @kbd{#q<move>} 1325 @kindex @kbd{#q<move>}
1317 Insert specified string at the beginning of each line in the region 1326 Insert specified string at the beginning of each line in the region
1318 (@code{vip-quote-region}). 1327 (@code{viper-quote-region}).
1319 @item # s 1328 @item # s
1320 @kindex @kbd{#s<move>} 1329 @kindex @kbd{#s<move>}
1321 Check spelling of words in the region (@code{spell-region}). 1330 Check spelling of words in the region (@code{spell-region}).
1322 The function used for spelling is determined from the variable 1331 The function used for spelling is determined from the variable
1323 @code{vip-spell-function}. 1332 @code{viper-spell-function}.
1324 @vindex @code{vip-spell-function} 1333 @vindex @code{viper-spell-function}
1325 @item * 1334 @item *
1326 @kindex @kbd{*} 1335 @kindex @kbd{*}
1327 Call last keyboard macro. 1336 Call last keyboard macro.
1328 @item m . 1337 @item m .
1329 Set mark at point and push old mark off the ring 1338 Set mark at point and push old mark off the ring
1465 Editing modes are written for most computer languages in existence. By 1474 Editing modes are written for most computer languages in existence. By
1466 controlling indentation, they catch punctuation errors. 1475 controlling indentation, they catch punctuation errors.
1467 @end table 1476 @end table
1468 1477
1469 The packages, below, represents a drop in the sea of special-purpose 1478 The packages, below, represents a drop in the sea of special-purpose
1470 packages that come with standard distribution of Emacs 19. 1479 packages that come with standard distribution of Emacs.
1471 1480
1472 @table @samp 1481 @table @samp
1473 @item Transparent FTP 1482 @item Transparent FTP
1474 @cindex transparent ftp 1483 @cindex transparent ftp
1475 @pindex ange-ftp.el 1484 @pindex ange-ftp.el
1484 @cindex dired 1493 @cindex dired
1485 @pindex dired.el 1494 @pindex dired.el
1486 @code{dired.el} for editing contents of directories and for navigating in 1495 @code{dired.el} for editing contents of directories and for navigating in
1487 the file system. 1496 the file system.
1488 @item Syntactic Highlighting 1497 @item Syntactic Highlighting
1489 @cindex hilit19
1490 @pindex hilit19.el
1491 @cindex font-lock 1498 @cindex font-lock
1492 @pindex font-lock.el 1499 @pindex font-lock.el
1493 @code{font-lock.el} for automatic highlighting various parts of a buffer 1500 @code{font-lock.el} for automatic highlighting various parts of a buffer
1494 using different fonts and colors. 1501 using different fonts and colors.
1495 @item Saving Emacs Configuration 1502 @item Saving Emacs Configuration
1530 @item 1537 @item
1531 @cindex .emacs 1538 @cindex .emacs
1532 Elisp code in your @file{.emacs} file before and after the @code{(require 1539 Elisp code in your @file{.emacs} file before and after the @code{(require
1533 'viper)} line. This method is not recommended, unless you know what you are 1540 'viper)} line. This method is not recommended, unless you know what you are
1534 doing. Only two variables, @code{viper-mode} and 1541 doing. Only two variables, @code{viper-mode} and
1535 @code{vip-custom-file-name} are supposed to be customized in @file{.emacs}, 1542 @code{viper-custom-file-name} are supposed to be customized in @file{.emacs},
1536 prior to loading Viper.@refill 1543 prior to loading Viper.@refill
1537 @end itemize 1544 @end itemize
1538 1545
1539 @noindent 1546 @noindent
1540 Most of Viper's behavior can be customized via the interactive Emacs user 1547 Most of Viper's behavior can be customized via the interactive Emacs user
1541 interface. Choose "Customize" from the menubar, click on "Editing", then on 1548 interface. Choose "Customize" from the menubar, click on "Editing", then on
1542 "Emulations". The customization widget is self-explanatory. Once you are 1549 "Emulations". The customization widget is self-explanatory. Once you are
1543 satisfied with your changes, save them into a file and then include the 1550 satisfied with your changes, save them into a file and then include the
1544 contents of that file in the Viper customization repository, @file{.viper} 1551 contents of that file in the Viper customization repository, @file{.viper}
1545 (except for @code{viper-mode} and @code{vip-custom-file-name}, which are 1552 (except for @code{viper-mode} and @code{viper-custom-file-name}, which are
1546 supposed to go into @code{.emacs}). 1553 supposed to go into @code{.emacs}).
1547 1554
1548 Some advanced customization cannot be accomplished this way, however, and 1555 Some advanced customization cannot be accomplished this way, however, and
1549 has to be done in Emacs Lisp. For the common cases, examples are provided 1556 has to be done in Emacs Lisp. For the common cases, examples are provided
1550 that you can use directly. 1557 that you can use directly.
1582 or @kbd{=}, which will complete the command like this: @kbd{:set ts = } and 1589 or @kbd{=}, which will complete the command like this: @kbd{:set ts = } and
1583 Viper will be waiting for you to type a value for the tabstop variable. 1590 Viper will be waiting for you to type a value for the tabstop variable.
1584 To get the full list of Vi variables, type @kbd{:se @key{SPC} @key{TAB}}. 1591 To get the full list of Vi variables, type @kbd{:se @key{SPC} @key{TAB}}.
1585 1592
1586 @table @code 1593 @table @code
1587 @item vip-auto-indent nil 1594 @item viper-auto-indent nil
1588 @itemx :se ai (:se autoindent) 1595 @itemx :se ai (:se autoindent)
1589 @itemx :se ai-g (:se autoindent-global) 1596 @itemx :se ai-g (:se autoindent-global)
1590 If @code{t}, enable auto indentation. 1597 If @code{t}, enable auto indentation.
1591 by @key{RET}, @kbd{o} or @kbd{O} command. 1598 by @key{RET}, @kbd{o} or @kbd{O} command.
1592 1599
1593 @code{vip-auto-indent} is a local variable. To change the value globally, use 1600 @code{viper-auto-indent} is a local variable. To change the value globally, use
1594 @code{setq-default}. It may be useful for certain major modes to have their 1601 @code{setq-default}. It may be useful for certain major modes to have their
1595 own values of @code{vip-auto-indent}. This can be achieved by using 1602 own values of @code{viper-auto-indent}. This can be achieved by using
1596 @code{setq} to change the local value of this variable in the hooks to the 1603 @code{setq} to change the local value of this variable in the hooks to the
1597 appropriate major modes. 1604 appropriate major modes.
1598 1605
1599 @kbd{:se ai} changes the value of @code{vip-auto-indent} in the current 1606 @kbd{:se ai} changes the value of @code{viper-auto-indent} in the current
1600 buffer only; @kbd{:se ai-g} does the same globally. 1607 buffer only; @kbd{:se ai-g} does the same globally.
1601 @item vip-electric-mode t 1608 @item viper-electric-mode t
1602 If not @code{nil}, auto-indentation becomes electric, which means that 1609 If not @code{nil}, auto-indentation becomes electric, which means that
1603 @key{RET}, @kbd{O}, and @kbd{o} indent cursor according to the current 1610 @key{RET}, @kbd{O}, and @kbd{o} indent cursor according to the current
1604 major mode. In the future, this variable may control additional electric 1611 major mode. In the future, this variable may control additional electric
1605 features. 1612 features.
1606 1613
1607 This is a local variable: @code{setq} changes the value of this variable 1614 This is a local variable: @code{setq} changes the value of this variable
1608 in the current buffer only. Use @code{setq-default} to change the value in 1615 in the current buffer only. Use @code{setq-default} to change the value in
1609 all buffers. 1616 all buffers.
1610 @item vip-case-fold-search nil 1617 @item viper-case-fold-search nil
1611 @itemx :se ic (:se ignorecase) 1618 @itemx :se ic (:se ignorecase)
1612 If not @code{nil}, search ignores cases. 1619 If not @code{nil}, search ignores cases.
1613 This can also be toggled by quickly hitting @kbd{/} twice. 1620 This can also be toggled by quickly hitting @kbd{/} twice.
1614 @item vip-re-search nil 1621 @item viper-re-search nil
1615 @itemx :se magic 1622 @itemx :se magic
1616 If not @code{nil}, search will use regular expressions; if @code{nil} then 1623 If not @code{nil}, search will use regular expressions; if @code{nil} then
1617 use vanilla search. 1624 use vanilla search.
1618 This behavior can also be toggled by quickly hitting @kbd{/} trice. 1625 This behavior can also be toggled by quickly hitting @kbd{/} trice.
1619 @item buffer-read-only 1626 @item buffer-read-only
1640 1647
1641 Note that typing @key{TAB} normally 1648 Note that typing @key{TAB} normally
1642 doesn't insert the tab, since this key is usually bound to 1649 doesn't insert the tab, since this key is usually bound to
1643 a text-formatting function, @code{indent-for-tab-command} (which facilitates 1650 a text-formatting function, @code{indent-for-tab-command} (which facilitates
1644 programming and document writing). Instead, the tab is inserted via the 1651 programming and document writing). Instead, the tab is inserted via the
1645 command @code{vip-insert-tab}, which is bound to @kbd{S-tab} (shift + tab). 1652 command @code{viper-insert-tab}, which is bound to @kbd{S-tab} (shift + tab).
1646 1653
1647 On some non-windowing terminals, Shift doesn't modify the @key{TAB} key, so 1654 On some non-windowing terminals, Shift doesn't modify the @key{TAB} key, so
1648 @kbd{S-tab} behaves as if it were @key{TAB}. In such a case, you will have 1655 @kbd{S-tab} behaves as if it were @key{TAB}. In such a case, you will have
1649 to bind @code{vip-insert-tab} to some other convenient key. 1656 to bind @code{viper-insert-tab} to some other convenient key.
1650 1657
1651 @item vip-shift-width 8 1658 @item viper-shift-width 8
1652 @itemx :se sw=value (:se shiftwidth=value) 1659 @itemx :se sw=value (:se shiftwidth=value)
1653 The number of columns shifted by @kbd{>} and @kbd{<} commands. 1660 The number of columns shifted by @kbd{>} and @kbd{<} commands.
1654 @item vip-search-wrap-around t 1661 @item viper-search-wrap-around t
1655 @itemx :se ws (:se wrapscan) 1662 @itemx :se ws (:se wrapscan)
1656 If not @code{nil}, search wraps around the end/beginning of buffer. 1663 If not @code{nil}, search wraps around the end/beginning of buffer.
1657 @item vip-search-scroll-threshold 2 1664 @item viper-search-scroll-threshold 2
1658 If search lands within this many lines of the window top or bottom, the 1665 If search lands within this many lines of the window top or bottom, the
1659 window will be scrolled up or down by about 1/7-th of its size, to reveal 1666 window will be scrolled up or down by about 1/7-th of its size, to reveal
1660 the context. If the value is negative---don't scroll. 1667 the context. If the value is negative---don't scroll.
1661 @item vip-tags-file-name "TAGS" 1668 @item viper-tags-file-name "TAGS"
1662 The name of the file used as the tag table. 1669 The name of the file used as the tag table.
1663 @item vip-re-query-replace nil 1670 @item viper-re-query-replace nil
1664 If not @code{nil}, use reg-exp replace in query replace. 1671 If not @code{nil}, use reg-exp replace in query replace.
1665 @item vip-want-ctl-h-help nil 1672 @item viper-want-ctl-h-help nil
1666 If not @code{nil}, @kbd{C-h} is bound to @code{help-command}; 1673 If not @code{nil}, @kbd{C-h} is bound to @code{help-command};
1667 if @code{nil}, it is bound to @code{delete-backward-char}. 1674 if @code{nil}, it is bound to @code{delete-backward-char}.
1668 @item vip-vi-style-in-minibuffer t 1675 @item viper-vi-style-in-minibuffer t
1669 If not @code{nil}, Viper provides a high degree of compatibility with Vi 1676 If not @code{nil}, Viper provides a high degree of compatibility with Vi
1670 insert mode when you type text in the Minibuffer; if @code{nil}, typing in 1677 insert mode when you type text in the Minibuffer; if @code{nil}, typing in
1671 the Minibuffer feels like plain Emacs. 1678 the Minibuffer feels like plain Emacs.
1672 @item vip-no-multiple-ESC t 1679 @item viper-no-multiple-ESC t
1673 If you set this to @code{nil}, you can use @key{ESC} as Meta in Vi state. 1680 If you set this to @code{nil}, you can use @key{ESC} as Meta in Vi state.
1674 Normally, this is not necessary, since graphical displays have separate 1681 Normally, this is not necessary, since graphical displays have separate
1675 Meta keys (usually on each side of the space bar). On a dumb terminal, Viper 1682 Meta keys (usually on each side of the space bar). On a dumb terminal, Viper
1676 sets this variable to @code{twice}, which is almost like @code{nil}, except 1683 sets this variable to @code{twice}, which is almost like @code{nil}, except
1677 that double @key{ESC} beeps. This, too, lets @key{ESC} to be used as a Meta. 1684 that double @key{ESC} beeps. This, too, lets @key{ESC} to be used as a Meta.
1678 @item vip-ESC-keyseq-timeout 200 on tty, 0 on windowing display 1685 @item viper-ESC-keyseq-timeout 200 on tty, 0 on windowing display
1679 Escape key sequences separated by this much delay (in miliseconds) are 1686 Escape key sequences separated by this much delay (in miliseconds) are
1680 interpreted as command, ignoring the special meaning of @key{ESC} in 1687 interpreted as command, ignoring the special meaning of @key{ESC} in
1681 VI. The default is suitable for most terminals. However, if your terminal 1688 VI. The default is suitable for most terminals. However, if your terminal
1682 is extremely slow, you might want to increase this slightly. You will know 1689 is extremely slow, you might want to increase this slightly. You will know
1683 if your terminal is slow if the @key{ESC} key sequences emitted by the 1690 if your terminal is slow if the @key{ESC} key sequences emitted by the
1684 arrow keys are interpreted as separately typed characters (and thus the 1691 arrow keys are interpreted as separately typed characters (and thus the
1685 arrow keys won't work). Making this value too large will slow you down, so 1692 arrow keys won't work). Making this value too large will slow you down, so
1686 exercise restraint. 1693 exercise restraint.
1687 @item vip-fast-keyseq-timeout 200 1694 @item viper-fast-keyseq-timeout 200
1688 Key sequences separated by this many miliseconds are treated as Vi-style 1695 Key sequences separated by this many miliseconds are treated as Vi-style
1689 keyboard macros. If the key sequence is defined as such a macro, it will be 1696 keyboard macros. If the key sequence is defined as such a macro, it will be
1690 executed. Otherwise, it is processed as an ordinary sequence of typed keys. 1697 executed. Otherwise, it is processed as an ordinary sequence of typed keys.
1691 1698
1692 Setting this variable too high may slow down your typing. Setting it too 1699 Setting this variable too high may slow down your typing. Setting it too
1693 low may make it hard to type macros quickly enough. 1700 low may make it hard to type macros quickly enough.
1694 @item vip-ex-style-motion t 1701 @item viper-ex-style-motion t
1695 Set this to @code{nil}, if you want @kbd{l,h} to cross 1702 Set this to @code{nil}, if you want @kbd{l,h} to cross
1696 lines, etc. @xref{Movement and Markers}, for more info. 1703 lines, etc. @xref{Movement and Markers}, for more info.
1697 @item vip-ex-style-editing-in-insert t 1704 @item viper-ex-style-editing-in-insert t
1698 Set this to to @code{nil}, if you want 1705 Set this to to @code{nil}, if you want
1699 @kbd{C-h} and @key{DEL} to not stop 1706 @kbd{C-h} and @key{DEL} to not stop
1700 at the beginning of a line in Insert state. 1707 at the beginning of a line in Insert state.
1701 @item vip-ESC-moves-cursor-back t 1708 @item viper-ESC-moves-cursor-back t
1702 It t, cursor moves back 1 character when switching from insert state to vi 1709 It t, cursor moves back 1 character when switching from insert state to vi
1703 state. If nil, the cursor stays where it was before the switch. 1710 state. If nil, the cursor stays where it was before the switch.
1704 @item viper-always t 1711 @item viper-always t
1705 @code{t} means: leave it to Viper to decide when a buffer must be brought 1712 @code{t} means: leave it to Viper to decide when a buffer must be brought
1706 up in Vi state, 1713 up in Vi state,
1707 Insert state, or Emacs state. This heuristics works well in virtually all 1714 Insert state, or Emacs state. This heuristics works well in virtually all
1708 cases. @code{nil} means you either has to invoke @code{viper-mode} manually 1715 cases. @code{nil} means you either has to invoke @code{viper-mode} manually
1709 for each buffer (or you can add @code{viper-mode} to the appropriate major mode 1716 for each buffer (or you can add @code{viper-mode} to the appropriate major mode
1710 hooks using @code{vip-load-hook}). 1717 hooks using @code{viper-load-hook}).
1711 1718
1712 This option must be set in the file @file{~/.viper}. 1719 This option must be set in the file @file{~/.viper}.
1713 @item vip-custom-file-name "~/.viper" 1720 @item viper-custom-file-name "~/.viper"
1714 File used for Viper-specific customization. 1721 File used for Viper-specific customization.
1715 Change this setting, if you want. Must be set in @file{.emacs} (not @file{.viper}!) 1722 Change this setting, if you want. Must be set in @file{.emacs} (not @file{.viper}!)
1716 before Viper is loaded. Note that you 1723 before Viper is loaded. Note that you
1717 have to set it as a string inside double quotes. 1724 have to set it as a string inside double quotes.
1718 @item vip-spell-function 'ispell-region 1725 @item viper-spell-function 'ispell-region
1719 Function used by the command @kbd{#c<move>} to spell. 1726 Function used by the command @kbd{#c<move>} to spell.
1720 @item ex-nontrivial-find-file-function 1727 @item ex-nontrivial-find-file-function
1721 The value of this variable is the function used to find all files that 1728 The value of this variable is the function used to find all files that
1722 match a wildcard. This is usually done when the user types @kbd{:e} and 1729 match a wildcard. This is usually done when the user types @kbd{:e} and
1723 specifies a wildcard in the file name (or if the file name contains unusual 1730 specifies a wildcard in the file name (or if the file name contains unusual
1724 symbols (e.g., a space). Viper provides two functions for this: one for 1731 symbols (e.g., a space). Viper provides two functions for this: one for
1725 Unix-like systems (@code{vip-ex-nontrivial-find-file-unix}) and one for 1732 Unix-like systems (@code{viper-ex-nontrivial-find-file-unix}) and one for
1726 DOS, W95, and NT (@code{vip-ex-nontrivial-find-file-ms}). If the default 1733 DOS, W95, and NT (@code{viper-ex-nontrivial-find-file-ms}). If the default
1727 function doesn't quite do what you expect or if you prefer to use ``fancy'' 1734 function doesn't quite do what you expect or if you prefer to use ``fancy''
1728 shells, you may have to write your own version of this function and make it 1735 shells, you may have to write your own version of this function and make it
1729 into the value of @code{ex-nontrivial-find-file-function}. Use 1736 into the value of @code{ex-nontrivial-find-file-function}. Use
1730 @code{vip-ex-nontrivial-find-file-unix} and 1737 @code{viper-ex-nontrivial-find-file-unix} and
1731 @code{vip-ex-nontrivial-find-file-ms} as examples. 1738 @code{viper-ex-nontrivial-find-file-ms} as examples.
1732 @vindex @code{ex-nontrivial-find-file-function}. 1739 @vindex @code{ex-nontrivial-find-file-function}.
1733 @findex @code{vip-ex-nontrivial-find-file-ms} 1740 @findex @code{viper-ex-nontrivial-find-file-ms}
1734 @findex @code{vip-ex-nontrivial-find-file-unix} 1741 @findex @code{viper-ex-nontrivial-find-file-unix}
1735 @item ex-cycle-other-window t 1742 @item ex-cycle-other-window t
1736 If not @code{nil}, @kbd{:n} and @kbd{:b} will cycle through files in another 1743 If not @code{nil}, @kbd{:n} and @kbd{:b} will cycle through files in another
1737 window, if one exists. 1744 window, if one exists.
1738 @item ex-cycle-through-non-files nil 1745 @item ex-cycle-through-non-files nil
1739 @kbd{:n} does not normally cycle through buffers. Set this to get 1746 @kbd{:n} does not normally cycle through buffers. Set this to get
1740 buffers also. 1747 buffers also.
1741 @item vip-automatic-iso-accents nil 1748 @item viper-automatic-iso-accents nil
1742 If @kbd{t}, ISO accents will be turned on in insert/replace Viper states 1749 If @kbd{t}, ISO accents will be turned on in insert/replace Viper states
1743 and turned off in Vi state. This is useful for editing text in European 1750 and turned off in Vi state. This is useful for editing text in European
1744 languages. This variable is buffer-local. If used, it should be set in the 1751 languages. This variable is buffer-local. If used, it should be set in the
1745 hooks to the appropriate major modes (usually setting it in 1752 hooks to the appropriate major modes (usually setting it in
1746 @code{text-mode-hook} is enough). 1753 @code{text-mode-hook} is enough).
1747 @item vip-want-emacs-keys-in-insert 1754 @item viper-want-emacs-keys-in-insert
1748 This is set to @code{nil} for user levels 1 and 2 and to @code{t} for user 1755 This is set to @code{nil} for user levels 1 and 2 and to @code{t} for user
1749 levels 3 and 4. Users who specify level 5 are allowed to set this variable 1756 levels 3 and 4. Users who specify level 5 are allowed to set this variable
1750 as they please (the default for this level is @code{t}). If set to 1757 as they please (the default for this level is @code{t}). If set to
1751 @code{nil}, complete Vi compatibility is provided in Insert state. This is 1758 @code{nil}, complete Vi compatibility is provided in Insert state. This is
1752 really not recommended, as this precludes you from using language-specific 1759 really not recommended, as this precludes you from using language-specific
1753 features provided by the major modes. 1760 features provided by the major modes.
1754 @item vip-want-emacs-keys-in-vi 1761 @item viper-want-emacs-keys-in-vi
1755 This is set to @code{nil} for user 1762 This is set to @code{nil} for user
1756 level 1 and to @code{t} for user levels 2--4. 1763 level 1 and to @code{t} for user levels 2--4.
1757 At level 5, users are allowed to set this variable as they please (the 1764 At level 5, users are allowed to set this variable as they please (the
1758 default for this level is @code{t}). 1765 default for this level is @code{t}).
1759 If set to @code{nil}, complete Vi compatibility is provided 1766 If set to @code{nil}, complete Vi compatibility is provided
1760 in Vi command state. Setting this to @code{nil} is really a bad idea, 1767 in Vi command state. Setting this to @code{nil} is really a bad idea,
1761 unless you are a novice, as this precludes the use 1768 unless you are a novice, as this precludes the use
1762 of language-specific features provided by the major modes. 1769 of language-specific features provided by the major modes.
1763 @item vip-keep-point-on-repeat t 1770 @item viper-keep-point-on-repeat t
1764 If not @code{nil}, point is not moved when the user repeats the previous 1771 If not @code{nil}, point is not moved when the user repeats the previous
1765 command by typing `.' This is very useful for doing repeated changes with 1772 command by typing `.' This is very useful for doing repeated changes with
1766 the @kbd{.} key. 1773 the @kbd{.} key.
1767 @item vip-repeat-from-history-key 'f12 1774 @item viper-repeat-from-history-key 'f12
1768 Prefix key used to invoke the macros @kbd{f12 1} and @kbd{f12 2} that repeat 1775 Prefix key used to invoke the macros @kbd{f12 1} and @kbd{f12 2} that repeat
1769 the second-last and the third-last destructive command. 1776 the second-last and the third-last destructive command.
1770 Both these macros are bound (as Viper macros) to 1777 Both these macros are bound (as Viper macros) to
1771 @code{vip-repeat-from-history}, 1778 @code{viper-repeat-from-history},
1772 which checks the second key by which it is invoked to see which of the 1779 which checks the second key by which it is invoked to see which of the
1773 previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only, 1780 previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only,
1774 but the user can bind more in @file{~/.viper}. @xref{Vi Macros}, for how to do 1781 but the user can bind more in @file{~/.viper}. @xref{Vi Macros}, for how to do
1775 this. 1782 this.
1776 @item vip-keep-point-on-undo nil 1783 @item viper-keep-point-on-undo nil
1777 If not @code{nil}, Viper tries to not move point when undoing commands. 1784 If not @code{nil}, Viper tries to not move point when undoing commands.
1778 Instead, it will briefly move the cursor to the place where change has 1785 Instead, it will briefly move the cursor to the place where change has
1779 taken place. However, if the undone piece of text is not seen in window, 1786 taken place. However, if the undone piece of text is not seen in window,
1780 then point will be moved to the place where the change took place. 1787 then point will be moved to the place where the change took place.
1781 Set it to @code{t} and see if you like it better. 1788 Set it to @code{t} and see if you like it better.
1782 @item vip-delete-backwards-in-replace nil 1789 @item viper-delete-backwards-in-replace nil
1783 If not @code{nil}, @key{DEL} key will delete characters while moving the cursor 1790 If not @code{nil}, @key{DEL} key will delete characters while moving the cursor
1784 backwards. If @code{nil}, the cursor will move backwards without deleting 1791 backwards. If @code{nil}, the cursor will move backwards without deleting
1785 anything. 1792 anything.
1786 @item vip-replace-overlay-face 'vip-replace-overlay-face 1793 @item viper-replace-overlay-face 'viper-replace-overlay-face
1787 @itemx vip-replace-overlay-pixmap "grey3"
1788 On a graphical display, Viper highlights replacement regions instead of 1794 On a graphical display, Viper highlights replacement regions instead of
1789 putting a @samp{$} at the end. This variable controls the so called 1795 putting a @samp{$} at the end. This variable controls the so called
1790 @dfn{face} used to highlight the region. 1796 @dfn{face} used to highlight the region.
1791 1797
1792 By default, @code{vip-replace-overlay-face} underlines the replacement on 1798 By default, @code{viper-replace-overlay-face} underlines the replacement on
1793 monochrome displays and also lays a pixmap over them (as specified in the 1799 monochrome displays and also lays a stipple over them. On color displays,
1794 variable @code{vip-replace-overlay-pixmap}. On color displays, replacement 1800 replacement regions are highlighted with color.
1795 regions are highlighted with color.
1796 1801
1797 If you know something about Emacs faces and don't like how Viper highlights 1802 If you know something about Emacs faces and don't like how Viper highlights
1798 replacement regions, you can change @code{vip-replace-overlay-face} by 1803 replacement regions, you can change @code{viper-replace-overlay-face} by
1799 specifying a new face. (Emacs faces are described in the Emacs Lisp 1804 specifying a new face. (Emacs faces are described in the Emacs Lisp
1800 reference.) On a color display, the following customization method is 1805 reference.) On a color display, the following customization method is
1801 usually most effective: 1806 usually most effective:
1802 @example 1807 @example
1803 (set-face-foreground vip-replace-overlay-face "DarkSlateBlue") 1808 (set-face-foreground viper-replace-overlay-face "DarkSlateBlue")
1804 (set-face-background vip-replace-overlay-face "yellow") 1809 (set-face-background viper-replace-overlay-face "yellow")
1805 @end example 1810 @end example
1806 For a complete list of colors available to you, evaluate the expression 1811 For a complete list of colors available to you, evaluate the expression
1807 @code{(x-defined-colors)}. (Type it in the buffer @code{*scratch*} and then 1812 @code{(x-defined-colors)}. (Type it in the buffer @code{*scratch*} and then
1808 hit the @kbd{C-j} key. 1813 hit the @kbd{C-j} key.
1809 1814
1810 On a monochrome display, you can change the value of the variable 1815 @item viper-replace-overlay-cursor-color "Red"
1811 @code{vip-replace-overlay-pixmap} to specify the pixmap of your choice 1816 @vindex @code{viper-replace-overlay-cursor-color}
1812 (which should be a string denoting the file name of the pixmap). Emacs
1813 takes pixmaps from the directory specified in the variable
1814 @code{x-bitmap-file-path}.
1815 @item vip-replace-overlay-cursor-color "Red"
1816 @vindex @code{vip-replace-overlay-cursor-color}
1817 Cursor color when it is inside the replacement region. 1817 Cursor color when it is inside the replacement region.
1818 This has effect only on color displays and only when Emacs runs as an X 1818 This has effect only on color displays and only when Emacs runs as an X
1819 application. 1819 application.
1820 @item vip-insert-state-cursor-color nil 1820 @item viper-insert-state-cursor-color nil
1821 @vindex @code{vip-insert-state-cursor-color} 1821 @vindex @code{viper-insert-state-cursor-color}
1822 If set to a valid color, this will be the cursor color when Viper is in 1822 If set to a valid color, this will be the cursor color when Viper is in
1823 insert state. 1823 insert state.
1824 @item vip-replace-region-end-delimiter "$" 1824 @item viper-replace-region-end-delimiter "$"
1825 A string used to mark the end of replacement regions. It is used only on 1825 A string used to mark the end of replacement regions. It is used only on
1826 TTYs or if @code{vip-use-replace-region-delimiters} is non-nil. 1826 TTYs or if @code{viper-use-replace-region-delimiters} is non-nil.
1827 @item vip-replace-region-start-delimiter "" 1827 @item viper-replace-region-start-delimiter ""
1828 A string used to mark the beginning of replacement regions. It is used 1828 A string used to mark the beginning of replacement regions. It is used
1829 only on TTYs or if @code{vip-use-replace-region-delimiters} is non-nil. 1829 only on TTYs or if @code{viper-use-replace-region-delimiters} is non-nil.
1830 @item vip-use-replace-region-delimiters 1830 @item viper-use-replace-region-delimiters
1831 If non-nil, Viper will always use @code{vip-replace-region-end-delimiter} and 1831 If non-nil, Viper will always use @code{viper-replace-region-end-delimiter} and
1832 @code{vip-replace-region-start-delimiter} to delimit replacement regions, 1832 @code{viper-replace-region-start-delimiter} to delimit replacement regions,
1833 even on color displays (where this is unnecessary). By default, this 1833 even on color displays (where this is unnecessary). By default, this
1834 variable is non-nil only on TTYs or monochrome displays. 1834 variable is non-nil only on TTYs or monochrome displays.
1835 @item vip-allow-multiline-replace-regions t 1835 @item viper-allow-multiline-replace-regions t
1836 If non-nil, multi-line text replacement regions, such as those produced by 1836 If non-nil, multi-line text replacement regions, such as those produced by
1837 commands @kbd{c55w}, @kbd{3C}, etc., will stay around until the user exits 1837 commands @kbd{c55w}, @kbd{3C}, etc., will stay around until the user exits
1838 the replacement mode. In this variable is set to @code{nil}, Viper will 1838 the replacement mode. In this variable is set to @code{nil}, Viper will
1839 emulate the standard Vi behavior, which supports only intra-line 1839 emulate the standard Vi behavior, which supports only intra-line
1840 replacement regions (and multi-line replacement regions are deleted). 1840 replacement regions (and multi-line replacement regions are deleted).
1841 @item vip-toggle-key "\C-z" 1841 @item viper-toggle-key "\C-z"
1842 Specifies the key used to switch from Emacs to Vi and back. 1842 Specifies the key used to switch from Emacs to Vi and back.
1843 Must be set in @file{.viper}. This variable can't be 1843 Must be set in @file{.viper}. This variable can't be
1844 changed interactively after Viper is loaded. 1844 changed interactively after Viper is loaded.
1845 1845
1846 In Insert state, this key acts as a temporary escape to Vi state, i.e., it 1846 In Insert state, this key acts as a temporary escape to Vi state, i.e., it
1847 will set Viper up so that the very next command will be executed as if it 1847 will set Viper up so that the very next command will be executed as if it
1848 were typed in Vi state. 1848 were typed in Vi state.
1849 @item vip-ESC-key "\e" 1849 @item viper-ESC-key "\e"
1850 Specifies the key used to escape from Insert/Replace states to Vi. 1850 Specifies the key used to escape from Insert/Replace states to Vi.
1851 Must be set in @file{.viper}. This variable cannot be 1851 Must be set in @file{.viper}. This variable cannot be
1852 changed interactively after Viper is loaded. 1852 changed interactively after Viper is loaded.
1853 @item vip-buffer-search-char nil 1853 @item viper-buffer-search-char nil
1854 Key used for buffer search. @xref{Viper Specials}, for details. 1854 Key used for buffer search. @xref{Viper Specials}, for details.
1855 @item vip-surrounding-word-function 'vip-surrounding-word 1855 @item viper-surrounding-word-function 'viper-surrounding-word
1856 The value of this variable is a function name that is used to determine 1856 The value of this variable is a function name that is used to determine
1857 what constitutes a word clicked upon by the mouse. This is used by mouse 1857 what constitutes a word clicked upon by the mouse. This is used by mouse
1858 search and insert. 1858 search and insert.
1859 @item vip-search-face 'vip-search-face 1859 @item viper-search-face 'viper-search-face
1860 Variable that controls how search patterns are highlighted when they are 1860 Variable that controls how search patterns are highlighted when they are
1861 found. 1861 found.
1862 @item vip-vi-state-hook nil 1862 @item viper-vi-state-hook nil
1863 List of parameterless functions to be run just after entering the Vi 1863 List of parameterless functions to be run just after entering the Vi
1864 command state. 1864 command state.
1865 @item vip-insert-state-hook nil 1865 @item viper-insert-state-hook nil
1866 Same for Insert state. This hook is also run after entering Replace state. 1866 Same for Insert state. This hook is also run after entering Replace state.
1867 @item vip-replace-state-hook nil 1867 @item viper-replace-state-hook nil
1868 List of (parameterless) functions called just after entering Replace state 1868 List of (parameterless) functions called just after entering Replace state
1869 (and after all @code{vip-insert-state-hook}). 1869 (and after all @code{viper-insert-state-hook}).
1870 @item vip-emacs-state-hook nil 1870 @item viper-emacs-state-hook nil
1871 List of (parameterless) functions called just after switching from Vi state 1871 List of (parameterless) functions called just after switching from Vi state
1872 to Emacs state. 1872 to Emacs state.
1873 @item vip-load-hook nil 1873 @item viper-load-hook nil
1874 List of (parameterless) functions called just after loading Viper. This is 1874 List of (parameterless) functions called just after loading Viper. This is
1875 the last chance to do customization before Viper is up and running. 1875 the last chance to do customization before Viper is up and running.
1876 @end table 1876 @end table
1877 @noindent 1877 @noindent
1878 You can reset some of these constants in Viper with the Ex command @kbd{:set} 1878 You can reset some of these constants in Viper with the Ex command @kbd{:set}
1879 (when so indicated in the table). Or you 1879 (when so indicated in the table). Or you
1880 can include a line like this in your @file{.viper} file: 1880 can include a line like this in your @file{.viper} file:
1881 @example 1881 @example
1882 (setq vip-case-fold-search t) 1882 (setq viper-case-fold-search t)
1883 @end example 1883 @end example
1884 @vindex @code{vip-auto-indent} 1884 @vindex @code{viper-auto-indent}
1885 @vindex @code{vip-electric-mode} 1885 @vindex @code{viper-electric-mode}
1886 @vindex @code{vip-case-fold-search} 1886 @vindex @code{viper-case-fold-search}
1887 @vindex @code{vip-re-search} 1887 @vindex @code{viper-re-search}
1888 @vindex @code{vip-shift-width} 1888 @vindex @code{viper-shift-width}
1889 @vindex @code{buffer-read-only} 1889 @vindex @code{buffer-read-only}
1890 @vindex @code{vip-search-wrap-around} 1890 @vindex @code{viper-search-wrap-around}
1891 @vindex @code{vip-search-scroll-threshold} 1891 @vindex @code{viper-search-scroll-threshold}
1892 @vindex @code{vip-search-face} 1892 @vindex @code{viper-search-face}
1893 @vindex @code{vip-tags-file-name} 1893 @vindex @code{viper-tags-file-name}
1894 @vindex @code{vip-re-query-replace} 1894 @vindex @code{viper-re-query-replace}
1895 @vindex @code{vip-want-ctl-h-help} 1895 @vindex @code{viper-want-ctl-h-help}
1896 @vindex @code{vip-vi-style-in-minibuffer} 1896 @vindex @code{viper-vi-style-in-minibuffer}
1897 @vindex @code{vip-no-multiple-ESC} 1897 @vindex @code{viper-no-multiple-ESC}
1898 @vindex @code{viper-always} 1898 @vindex @code{viper-always}
1899 @vindex @code{vip-ESC-keyseq-timeout} 1899 @vindex @code{viper-ESC-keyseq-timeout}
1900 @vindex @code{vip-fast-keyseq-timeout} 1900 @vindex @code{viper-fast-keyseq-timeout}
1901 @vindex @code{vip-ex-style-motion} 1901 @vindex @code{viper-ex-style-motion}
1902 @vindex @code{vip-ex-style-editing-in-insert} 1902 @vindex @code{viper-ex-style-editing-in-insert}
1903 @vindex @code{vip-ESC-moves-cursor-back} 1903 @vindex @code{viper-ESC-moves-cursor-back}
1904 @vindex @code{vip-custom-file-name} 1904 @vindex @code{viper-custom-file-name}
1905 @vindex @code{vip-spell-function} 1905 @vindex @code{viper-spell-function}
1906 @vindex @code{ex-cycle-other-window} 1906 @vindex @code{ex-cycle-other-window}
1907 @vindex @code{ex-cycle-through-non-files} 1907 @vindex @code{ex-cycle-through-non-files}
1908 @vindex @code{vip-automatic-iso-accents} 1908 @vindex @code{viper-automatic-iso-accents}
1909 @vindex @code{vip-want-emacs-keys-in-insert} 1909 @vindex @code{viper-want-emacs-keys-in-insert}
1910 @vindex @code{vip-want-emacs-keys-in-vi} 1910 @vindex @code{viper-want-emacs-keys-in-vi}
1911 @vindex @code{vip-keep-point-on-repeat} 1911 @vindex @code{viper-keep-point-on-repeat}
1912 @vindex @code{vip-keep-point-on-undo} 1912 @vindex @code{viper-keep-point-on-undo}
1913 @vindex @code{vip-delete-backwards-in-replace} 1913 @vindex @code{viper-delete-backwards-in-replace}
1914 @vindex @code{vip-replace-overlay-face} 1914 @vindex @code{viper-replace-overlay-face}
1915 @vindex @code{vip-replace-overlay-pixmap} 1915 @vindex @code{viper-replace-region-end-symbol}
1916 @vindex @code{vip-replace-region-end-symbol} 1916 @vindex @code{viper-replace-region-start-symbol}
1917 @vindex @code{vip-replace-region-start-symbol} 1917 @vindex @code{viper-allow-multiline-replace-regions}
1918 @vindex @code{vip-allow-multiline-replace-regions} 1918 @vindex @code{viper-toggle-key}
1919 @vindex @code{vip-toggle-key} 1919 @vindex @code{viper-ESC-key}
1920 @vindex @code{vip-ESC-key} 1920 @vindex @code{viper-buffer-search-char}
1921 @vindex @code{vip-buffer-search-char} 1921 @vindex @code{viper-surrounding-word-function}
1922 @vindex @code{vip-surrounding-word-function} 1922 @vindex @code{viper-vi-state-hook}
1923 @vindex @code{vip-vi-state-hook} 1923 @vindex @code{viper-insert-state-hook}
1924 @vindex @code{vip-insert-state-hook} 1924 @vindex @code{viper-replace-state-hook}
1925 @vindex @code{vip-replace-state-hook} 1925 @vindex @code{viper-emacs-state-hook}
1926 @vindex @code{vip-emacs-state-hook}
1927 1926
1928 @node Keybindings, Packages that Change Keymaps, Rudimentary Changes,Customization 1927 @node Keybindings, Packages that Change Keymaps, Rudimentary Changes,Customization
1929 @section Keybindings 1928 @section Keybindings
1930 1929
1931 @cindex keybindings 1930 @cindex keybindings
1972 defined by the major modes and by Viper itself. Therefore, if you wish to 1971 defined by the major modes and by Viper itself. Therefore, if you wish to
1973 change a binding set by a major mode or by Viper, read this. 1972 change a binding set by a major mode or by Viper, read this.
1974 1973
1975 Viper users who wish to specify their own key bindings should be concerned 1974 Viper users who wish to specify their own key bindings should be concerned
1976 only with the following three keymaps: 1975 only with the following three keymaps:
1977 @code{vip-vi-global-user-map} for Vi state commands, 1976 @code{viper-vi-global-user-map} for Vi state commands,
1978 @code{vip-insert-global-user-map} for Insert state commands, 1977 @code{viper-insert-global-user-map} for Insert state commands,
1979 and @code{vip-emacs-global-user-map} for Emacs state commands (note: 1978 and @code{viper-emacs-global-user-map} for Emacs state commands (note:
1980 customized bindings for Emacs state made to @code{vip-emacs-global-user-map} 1979 customized bindings for Emacs state made to @code{viper-emacs-global-user-map}
1981 are @emph{not} inherited by Insert state). 1980 are @emph{not} inherited by Insert state).
1982 1981
1983 For more information on Viper keymaps, see the header of the file 1982 For more information on Viper keymaps, see the header of the file
1984 @file{viper.el}. 1983 @file{viper.el}.
1985 If you wish to change a Viper binding, you can use the 1984 If you wish to change a Viper binding, you can use the
1986 @code{define-key} command, to modify @code{vip-vi-global-user-map}, 1985 @code{define-key} command, to modify @code{viper-vi-global-user-map},
1987 @code{vip-insert-global-user-map}, and @code{vip-emacs-global-user-map}, as 1986 @code{viper-insert-global-user-map}, and @code{viper-emacs-global-user-map}, as
1988 explained below. Each of these key maps affects the corresponding Viper state. 1987 explained below. Each of these key maps affects the corresponding Viper state.
1989 The keymap @code{vip-vi-global-user-map} also affects Viper's Replace state. 1988 The keymap @code{viper-vi-global-user-map} also affects Viper's Replace state.
1990 1989
1991 @noindent 1990 @noindent
1992 If you want to 1991 If you want to
1993 bind a key, say @kbd{C-v}, to the function that scrolls 1992 bind a key, say @kbd{C-v}, to the function that scrolls
1994 page down and to make @kbd{0} display information on the current buffer, 1993 page down and to make @kbd{0} display information on the current buffer,
1995 putting this in @file{.viper} will do the trick in Vi state: 1994 putting this in @file{.viper} will do the trick in Vi state:
1996 @example 1995 @example
1997 (define-key vip-vi-global-user-map "\C-v" 'scroll-down) 1996 (define-key viper-vi-global-user-map "\C-v" 'scroll-down)
1998 @end example 1997 @end example
1999 @noindent 1998 @noindent
2000 To set a key globally, 1999 To set a key globally,
2001 @example 2000 @example
2002 (define-key vip-emacs-global-user-map "\C-c m" 'smail) 2001 (define-key viper-emacs-global-user-map "\C-c m" 'smail)
2003 (define-key vip-vi-global-user-map "0" 'vip-info-on-file) 2002 (define-key viper-vi-global-user-map "0" 'viper-info-on-file)
2004 @end example 2003 @end example
2005 @noindent 2004 @noindent
2006 Note, however, that this binding may be overwritten by other keymaps, since 2005 Note, however, that this binding may be overwritten by other keymaps, since
2007 the global keymap has the lowest priority. 2006 the global keymap has the lowest priority.
2008 To make sure that nothing will override a binding in Emacs state, you 2007 To make sure that nothing will override a binding in Emacs state, you
2009 can write this: 2008 can write this:
2010 @example 2009 @example
2011 (define-key vip-emacs-global-user-map "\C-c m" 'smail) 2010 (define-key viper-emacs-global-user-map "\C-c m" 'smail)
2012 @end example 2011 @end example
2013 @noindent 2012 @noindent
2014 To customize the binding for @kbd{C-h} in Insert state: 2013 To customize the binding for @kbd{C-h} in Insert state:
2015 @example 2014 @example
2016 (define-key vip-insert-global-user-map "\C-h" 'my-del-backwards-function) 2015 (define-key viper-insert-global-user-map "\C-h" 'my-del-backwards-function)
2017 @end example 2016 @end example
2018 @noindent 2017 @noindent
2019 2018
2020 Each Emacs command key calls some lisp function. If you have enabled the 2019 Each Emacs command key calls some lisp function. If you have enabled the
2021 Help, (@xref{Rudimentary Changes}) @kbd{C-h k} will show you the function 2020 Help, (@xref{Rudimentary Changes}) @kbd{C-h k} will show you the function
2026 menu bar, if Emacs runs under X Windows). 2025 menu bar, if Emacs runs under X Windows).
2027 2026
2028 Viper users can also change bindings on a per major mode basis. As with 2027 Viper users can also change bindings on a per major mode basis. As with
2029 global bindings, this can be done separately for each of the three main Viper 2028 global bindings, this can be done separately for each of the three main Viper
2030 states. To this end, Viper provides the function 2029 states. To this end, Viper provides the function
2031 @code{vip-modify-major-mode}. 2030 @code{viper-modify-major-mode}.
2032 @findex @code{vip-modify-major-mode} 2031 @findex @code{viper-modify-major-mode}
2033 2032
2034 To modify keys in Emacs state for @code{my-favorite-major-mode}, the user 2033 To modify keys in Emacs state for @code{my-favorite-major-mode}, the user
2035 needs to create a sparse keymap, say, @code{my-fancy-map}, bind whatever 2034 needs to create a sparse keymap, say, @code{my-fancy-map}, bind whatever
2036 keys necessary in that keymap, and put 2035 keys necessary in that keymap, and put
2037 2036
2038 @example 2037 @example
2039 (vip-modify-major-mode 'dired-mode 'emacs-state my-fancy-map) 2038 (viper-modify-major-mode 'dired-mode 'emacs-state my-fancy-map)
2040 @end example 2039 @end example
2041 2040
2042 @noindent 2041 @noindent
2043 in @file{~/.viper}. To do the same in Vi and Insert states, one should use 2042 in @file{~/.viper}. To do the same in Vi and Insert states, one should use
2044 @code{vi-state} and @code{insert-state}. Changes in Insert state are also 2043 @code{vi-state} and @code{insert-state}. Changes in Insert state are also
2048 2047
2049 @example 2048 @example
2050 (setq my-dired-modifier-map (make-sparse-keymap)) 2049 (setq my-dired-modifier-map (make-sparse-keymap))
2051 (define-key my-dired-modifier-map "dd" 'dired-flag-file-deletion) 2050 (define-key my-dired-modifier-map "dd" 'dired-flag-file-deletion)
2052 (define-key my-dired-modifier-map "u" 'dired-unmark) 2051 (define-key my-dired-modifier-map "u" 'dired-unmark)
2053 (vip-modify-major-mode 'dired-mode 'vi-state my-dired-modifier-map) 2052 (viper-modify-major-mode 'dired-mode 'vi-state my-dired-modifier-map)
2054 @end example 2053 @end example
2055 2054
2056 A Vi purist may want to modify Emacs state under Dired mode so that 2055 A Vi purist may want to modify Emacs state under Dired mode so that
2057 @kbd{k}, @kbd{l}, etc., will move around in directory buffers, as in 2056 @kbd{k}, @kbd{l}, etc., will move around in directory buffers, as in
2058 Vi. Although this is not recommended, as these keys are bound to useful 2057 Vi. Although this is not recommended, as these keys are bound to useful
2059 Dired functions, the trick can be accomplished via the following code: 2058 Dired functions, the trick can be accomplished via the following code:
2060 2059
2061 @example 2060 @example
2062 (setq my-dired-vi-purist-map (make-sparse-keymap)) 2061 (setq my-dired-vi-purist-map (make-sparse-keymap))
2063 (define-key my-dired-vi-purist-map "k" 'vip-previous-line) 2062 (define-key my-dired-vi-purist-map "k" 'viper-previous-line)
2064 (define-key my-dired-vi-purist-map "l" 'vip-forward-char) 2063 (define-key my-dired-vi-purist-map "l" 'viper-forward-char)
2065 (vip-modify-major-mode 'dired-mode 'emacs-state my-dired-vi-purist-map) 2064 (viper-modify-major-mode 'dired-mode 'emacs-state my-dired-vi-purist-map)
2066 @end example 2065 @end example
2067 2066
2068 Similar effect can be achieved by defining Vi keyboard macros using the 2067 Similar effect can be achieved by defining Vi keyboard macros using the
2069 Ex commands @kbd{:map} and @kbd{:map!}. The difference is that multi-key 2068 Ex commands @kbd{:map} and @kbd{:map!}. The difference is that multi-key
2070 Vi macros do not override the keys they are bound to, unless these keys are 2069 Vi macros do not override the keys they are bound to, unless these keys are
2075 @xref{Vi Macros}, for details. 2074 @xref{Vi Macros}, for details.
2076 2075
2077 Note: in major modes that come up in @emph{Emacs state} by default, the 2076 Note: in major modes that come up in @emph{Emacs state} by default, the
2078 aforesaid modifications may not take place immediately (but only after the 2077 aforesaid modifications may not take place immediately (but only after the
2079 buffer switches to some other Viper state and then back to Emacs state). To 2078 buffer switches to some other Viper state and then back to Emacs state). To
2080 avoid this, one should add @code{vip-change-state-to-emacs} to an 2079 avoid this, one should add @code{viper-change-state-to-emacs} to an
2081 appropriate hook of that major mode. (Check the function 2080 appropriate hook of that major mode. (Check the function
2082 @code{vip-set-hooks} in @file{viper.el} for examples.) However, if you 2081 @code{viper-set-hooks} in @file{viper.el} for examples.) However, if you
2083 have set @code{viper-always} to @code{t}, chances are that you won't need to 2082 have set @code{viper-always} to @code{t}, chances are that you won't need to
2084 perform the above procedure, because Viper will take care of most useful 2083 perform the above procedure, because Viper will take care of most useful
2085 defaults. 2084 defaults.
2086 2085
2087 2086
2088 Finally, Viper has a facility that lets the user define per-buffer 2087 Finally, Viper has a facility that lets the user define per-buffer
2089 bindings, i.e., bindings that are in effect in some specific buffers 2088 bindings, i.e., bindings that are in effect in some specific buffers
2090 only. Unlike per-mode bindings described above, per-buffer bindings can be 2089 only. Unlike per-mode bindings described above, per-buffer bindings can be
2091 defined based on considerations other than the major mode. This is done 2090 defined based on considerations other than the major mode. This is done
2092 via the function @code{vip-add-local-keys}, which lets one specify bindings 2091 via the function @code{viper-add-local-keys}, which lets one specify bindings
2093 that should be in effect in the current buffer only and for a specific Viper 2092 that should be in effect in the current buffer only and for a specific Viper
2094 state. For instance, 2093 state. For instance,
2095 @lisp 2094 @lisp
2096 (vip-add-local-keys 'vi-state '(("ZZ" . TeX-command-master) 2095 (viper-add-local-keys 'vi-state '(("ZZ" . TeX-command-master)
2097 ("ZQ" . vip-save-kill-buffer))) 2096 ("ZQ" . viper-save-kill-buffer)))
2098 @end lisp 2097 @end lisp
2099 @noindent 2098 @noindent
2100 redefines @kbd{ZZ} to invoke @code{TeX-command-master} in @code{vi-state} 2099 redefines @kbd{ZZ} to invoke @code{TeX-command-master} in @code{vi-state}
2101 and @kbd{ZQ} to save-then-kill the current buffer. These bindings take 2100 and @kbd{ZQ} to save-then-kill the current buffer. These bindings take
2102 effect only in the buffer where this command is executed. The typical use 2101 effect only in the buffer where this command is executed. The typical use
2119 For instance, here is how to do this for @code{mh-e}, the Emacs interface 2118 For instance, here is how to do this for @code{mh-e}, the Emacs interface
2120 to MH: 2119 to MH:
2121 @lisp 2120 @lisp
2122 (defun mh-add-vi-keys () 2121 (defun mh-add-vi-keys ()
2123 "Set up ZZ for MH-e and XMH." 2122 "Set up ZZ for MH-e and XMH."
2124 (vip-add-local-keys 'vi-state '(("ZZ" . mh-send-letter)))) 2123 (viper-add-local-keys 'vi-state '(("ZZ" . mh-send-letter))))
2125 (add-hook 'mh-letter-mode-hook 'mh-add-vi-keys) 2124 (add-hook 'mh-letter-mode-hook 'mh-add-vi-keys)
2126 @end lisp 2125 @end lisp
2127 2126
2128 You can also use @code{vip-add-local-keys} to set per buffer 2127 You can also use @code{viper-add-local-keys} to set per buffer
2129 bindings in Insert state and Emacs state by passing as a parameter the 2128 bindings in Insert state and Emacs state by passing as a parameter the
2130 symbols @code{insert-state} and @code{emacs-state}, respectively. 2129 symbols @code{insert-state} and @code{emacs-state}, respectively.
2131 As with global bindings, customized local bindings done to Emacs state 2130 As with global bindings, customized local bindings done to Emacs state
2132 are not inherited by Insert state. 2131 are not inherited by Insert state.
2133 2132
2134 On rare occasions, local keys may be added by mistake. Usually this is done 2133 On rare occasions, local keys may be added by mistake. Usually this is done
2135 indirectly, by invoking a major mode that adds local keys (e.g., 2134 indirectly, by invoking a major mode that adds local keys (e.g.,
2136 @code{shell-mode} redefines @key{RET}). In such a case, exiting the wrong 2135 @code{shell-mode} redefines @key{RET}). In such a case, exiting the wrong
2137 major mode won't rid you from unwanted local keys, since these keys are 2136 major mode won't rid you from unwanted local keys, since these keys are
2138 local to Viper state and the current buffer, not to the major mode. 2137 local to Viper state and the current buffer, not to the major mode.
2139 In such situations, the remedy is to type @kbd{M-x vip-zap-local-keys}. 2138 In such situations, the remedy is to type @kbd{M-x viper-zap-local-keys}.
2140 2139
2141 So much about Viper-specific bindings. 2140 So much about Viper-specific bindings.
2142 @xref{Customization,,Customization,emacs,The GNU Emacs 2141 @xref{Customization,,Customization,emacs,The GNU Emacs
2143 Manual}, and the Emacs quick reference card for the general info on key 2142 Manual}, and the Emacs quick reference card for the general info on key
2144 bindings in Emacs. 2143 bindings in Emacs.
2145 2144
2146 @vindex @code{function-key-map} 2145 @vindex @code{function-key-map}
2147 @vindex @code{vip-vi-global-user-map} 2146 @vindex @code{viper-vi-global-user-map}
2148 @vindex @code{vip-insert-global-user-map} 2147 @vindex @code{viper-insert-global-user-map}
2149 @vindex @code{vip-emacs-global-user-map} 2148 @vindex @code{viper-emacs-global-user-map}
2150 @findex @code{vip-add-local-keys} 2149 @findex @code{viper-add-local-keys}
2151 @findex @code{vip-zap-local-keys} 2150 @findex @code{viper-zap-local-keys}
2152 2151
2153 @node Packages that Change Keymaps,Viper Specials,Keybindings,Customization 2152 @node Packages that Change Keymaps,Viper Specials,Keybindings,Customization
2154 @subsection Packages that Change Keymaps 2153 @subsection Packages that Change Keymaps
2155 @cindex C-c and Viper 2154 @cindex C-c and Viper
2156 @cindex Viper and C-c 2155 @cindex Viper and C-c
2157 2156
2158 Viper is designed to coexist with all major and minor modes of Emacs. This 2157 Viper is designed to coexist with all major and minor modes of Emacs. This
2159 means that bindings set by those modes are generally available with Viper 2158 means that bindings set by those modes are generally available with Viper
2160 (unless you explicitly prohibit them by setting 2159 (unless you explicitly prohibit them by setting
2161 @code{vip-want-emacs-keys-in-vi} and @code{vip-want-emacs-keys-in-insert} to 2160 @code{viper-want-emacs-keys-in-vi} and @code{viper-want-emacs-keys-in-insert} to
2162 @code{nil}). 2161 @code{nil}).
2163 If @code{viper-always} is set to @code{t}, Viper will try to bring each buffer 2162 If @code{viper-always} is set to @code{t}, Viper will try to bring each buffer
2164 in the Viper state that is most appropriate for that buffer. 2163 in the Viper state that is most appropriate for that buffer.
2165 Usually, this would be the Vi state, but sometimes it could be the Insert 2164 Usually, this would be the Vi state, but sometimes it could be the Insert
2166 state or the Emacs state. 2165 state or the Emacs state.
2191 (except for users at level 1). Instead, in Viper, the key 2190 (except for users at level 1). Instead, in Viper, the key
2192 @kbd{S-tab} (shift+ tab) is chosen to emulate Vi's @key{TAB}. 2191 @kbd{S-tab} (shift+ tab) is chosen to emulate Vi's @key{TAB}.
2193 2192
2194 We should note that on some non-windowing terminals, Shift doesn't modify 2193 We should note that on some non-windowing terminals, Shift doesn't modify
2195 the @key{TAB} key, so @kbd{S-tab} behaves as if it were @key{TAB}. In such 2194 the @key{TAB} key, so @kbd{S-tab} behaves as if it were @key{TAB}. In such
2196 a case, you will have to bind @code{vip-insert-tab} to some other 2195 a case, you will have to bind @code{viper-insert-tab} to some other
2197 convenient key. 2196 convenient key.
2198 2197
2199 Some packages, notably Dired, Gnus, Info, etc., attach special meaning to 2198 Some packages, notably Dired, Gnus, Info, etc., attach special meaning to
2200 common keys like @key{SPC}, @kbd{x}, @kbd{d}, @kbd{v}, and others. This 2199 common keys like @key{SPC}, @kbd{x}, @kbd{d}, @kbd{v}, and others. This
2201 means that Vi command state is inappropriate for working with these 2200 means that Vi command state is inappropriate for working with these
2210 plan to continue using these major modes productively. You can also switch 2209 plan to continue using these major modes productively. You can also switch
2211 to Vi temporarily, to execute just one command. This is done by typing 2210 to Vi temporarily, to execute just one command. This is done by typing
2212 @kbd{C-c \}. (In some of these modes, @kbd{/} and @kbd{:} are bound 2211 @kbd{C-c \}. (In some of these modes, @kbd{/} and @kbd{:} are bound
2213 Vi-style, unless these keys perform essential duties.) 2212 Vi-style, unless these keys perform essential duties.)
2214 2213
2214 If you would like certain major modes to come up in Emacs state rather than
2215 Vi state (but Viper thinks otherwise), you should put these major modes
2216 on the @code{viper-non-vi-major-modes} list and also add
2217 @code{viper-change-state-to-emacs} to these modes' hooks.
2218 @vindex @code{viper-non-vi-major-modes}
2219
2215 It is also possible to harness some major modes, even though they may bind 2220 It is also possible to harness some major modes, even though they may bind
2216 common keys to specialized commands. Harnessing can make sense for modes 2221 common keys to specialized commands. Harnessing can make sense for modes
2217 that bind only a small number of common keys. For instance, if 2222 that bind only a small number of common keys. For instance, if
2218 @code{viper-always} is set to @code{t} in your @file{~/.viper} file, Viper will 2223 @code{viper-always} is set to @code{t} in your @file{~/.viper} file, Viper will
2219 harness Shell mode by changing the bindings for @kbd{C-m} and @kbd{C-d} 2224 harness Shell mode by changing the bindings for @kbd{C-m} and @kbd{C-d}
2220 using @code{vip-add-local-keys} described in section on customization 2225 using @code{viper-add-local-keys} described in section on customization
2221 (@xref{Customization}). In general, there is no single recipe for 2226 (@xref{Customization}). In general, there is no single recipe for
2222 harnessing modes. It can be as simple as adding the function 2227 harnessing modes. It can be as simple as adding the function
2223 @code{viper-mode} to a hook associated with the mode, or it can be more 2228 @code{viper-mode} to a hook associated with the mode, or it can be more
2224 complex, as in the case of Shell mode and Emerge. Take a look at 2229 complex, as in the case of Shell mode and Emerge. Take a look at
2225 @code{vip-set-hooks} function for some examples. 2230 @code{viper-set-hooks} function for some examples.
2226 2231
2227 Conversely, it may be the case that most of the major modes harnessed 2232 Conversely, it may be the case that most of the major modes harnessed
2228 by @code{vip-set-hooks} function fit your working style, except one or two 2233 by @code{viper-set-hooks} function fit your working style, except one or two
2229 cases. In this case, you may still be able to set @code{viper-always} to 2234 cases. In this case, you may still be able to set @code{viper-always} to
2230 @code{t} and then remove a hook that forces Vi command state. For instance, 2235 @code{t} and then remove a hook that forces Vi command state. For instance,
2231 to unharness @code{lisp-interaction-mode}, you can execute the following line 2236 to unharness @code{lisp-interaction-mode}, you can execute the following line
2232 in @code{vip-load-hook}: 2237 in @code{viper-load-hook}:
2233 @lisp 2238 @lisp
2234 (remove-hook 'lisp-interaction-mode-hook 'viper-mode) 2239 (remove-hook 'lisp-interaction-mode-hook 'viper-mode)
2235 @end lisp 2240 @end lisp
2236 Note: this type of customization cannot be done in @code{.viper}! 2241 Note: this type of customization cannot be done in @code{.viper}!
2237 2242
2242 several such minor modes and takes care of them, so that the above trick 2247 several such minor modes and takes care of them, so that the above trick
2243 is usually not necessary. If you find that some minor mode, e.g., 2248 is usually not necessary. If you find that some minor mode, e.g.,
2244 @code{nasty-mode.el} interferes with Viper, putting the following in 2249 @code{nasty-mode.el} interferes with Viper, putting the following in
2245 @file{.viper} should fix the problem: 2250 @file{.viper} should fix the problem:
2246 @lisp 2251 @lisp
2247 (vip-harness-minor-mode "nasty-mode") 2252 (viper-harness-minor-mode "nasty-mode")
2248 @end lisp 2253 @end lisp
2249 @noindent 2254 @noindent
2250 The argument to @code{vip-harness-minor-mode} is the name of the file for the 2255 The argument to @code{viper-harness-minor-mode} is the name of the file for the
2251 offending minor mode with the suffixes @file{.el} and @file{.elc} removed. 2256 offending minor mode with the suffixes @file{.el} and @file{.elc} removed.
2252 2257
2253 It may be tricky, however, to find out which minor mode is at fault. The 2258 It may be tricky, however, to find out which minor mode is at fault. The
2254 only guidance here is to look into the file that defines the minor mode you 2259 only guidance here is to look into the file that defines the minor mode you
2255 are suspecting, say @code{nasty-mode.el}, and see if it has a variable 2260 are suspecting, say @code{nasty-mode.el}, and see if it has a variable
2261 that binds the misbehaving 2266 that binds the misbehaving
2262 keys. If so, use the above line to harness @code{nasty-mode}. If your 2267 keys. If so, use the above line to harness @code{nasty-mode}. If your
2263 suspicion is wrong, no harm is done if you harness a minor mode that 2268 suspicion is wrong, no harm is done if you harness a minor mode that
2264 doesn't need to be harnessed. 2269 doesn't need to be harnessed.
2265 2270
2266 @vindex @code{vip-want-emacs-keys-in-vi} 2271 @vindex @code{viper-want-emacs-keys-in-vi}
2267 @vindex @code{vip-want-emacs-keys-in-insert} 2272 @vindex @code{viper-want-emacs-keys-in-insert}
2268 @vindex @code{viper-always} 2273 @vindex @code{viper-always}
2269 @findex @code{vip-set-hooks} 2274 @findex @code{viper-set-hooks}
2270 @findex @code{viper-mode} 2275 @findex @code{viper-mode}
2271 @findex @code{vip-harness-minor-mode} 2276 @findex @code{viper-harness-minor-mode}
2272 @findex @code{remove-hook} 2277 @findex @code{remove-hook}
2273 @findex @code{add-hook} 2278 @findex @code{add-hook}
2274 2279
2275 @node Viper Specials,Vi Macros,Packages that Change Keymaps,Customization 2280 @node Viper Specials,Vi Macros,Packages that Change Keymaps,Customization
2276 @section Viper Specials 2281 @section Viper Specials
2281 and history, completion of Ex commands and variables, and many other 2286 and history, completion of Ex commands and variables, and many other
2282 features. Some of these features are explained in detail elsewhere in this 2287 features. Some of these features are explained in detail elsewhere in this
2283 document. Other features are explained here. 2288 document. Other features are explained here.
2284 2289
2285 @table @code 2290 @table @code
2286 @item (vip-buffer-search-enable) 2291 @item (viper-buffer-search-enable)
2287 @item vip-buffer-search-char nil 2292 @item viper-buffer-search-char nil
2288 Enable buffer search. Explicit call to @code{vip-buffer-search-enable} 2293 Enable buffer search. Explicit call to @code{viper-buffer-search-enable}
2289 sets @code{vip-buffer-search-char} to @kbd{g}. Alternatively, the user can 2294 sets @code{viper-buffer-search-char} to @kbd{g}. Alternatively, the user can
2290 set @code{vip-buffer-search-char} in @file{.viper} to a key sequence 2295 set @code{viper-buffer-search-char} in @file{.viper} to a key sequence
2291 to be used for buffer search. There is no need to call 2296 to be used for buffer search. There is no need to call
2292 @code{vip-buffer-search-enable} in that case. 2297 @code{viper-buffer-search-enable} in that case.
2293 @findex @code{vip-buffer-search-enable} 2298 @findex @code{viper-buffer-search-enable}
2294 @vindex @code{vip-buffer-search-char} 2299 @vindex @code{viper-buffer-search-char}
2295 @item vip-toggle-search-style 2300 @item viper-toggle-search-style
2296 This function, bound to @kbd{C-c /}, lets one toggle case-sensitive and 2301 This function, bound to @kbd{C-c /}, lets one toggle case-sensitive and
2297 case-insensitive search, and also switch between plain vanilla search and 2302 case-insensitive search, and also switch between plain vanilla search and
2298 search via regular expressions. Without the prefix argument, the user is 2303 search via regular expressions. Without the prefix argument, the user is
2299 asked which mode to toggle. With prefix argument 1, this toggles 2304 asked which mode to toggle. With prefix argument 1, this toggles
2300 case-sensitivity. With prefix argument 2, regular expression/vanilla search 2305 case-sensitivity. With prefix argument 2, regular expression/vanilla search
2312 usual prompt @kbd{/} and will wait for input, as usual in Vi. 2317 usual prompt @kbd{/} and will wait for input, as usual in Vi.
2313 If you don't like this behavior, you can ``unrecord'' these macros in your 2318 If you don't like this behavior, you can ``unrecord'' these macros in your
2314 @file{~/.viper} file. For instance, if you don't like the above feature, put 2319 @file{~/.viper} file. For instance, if you don't like the above feature, put
2315 this in @file{~/.viper}: 2320 this in @file{~/.viper}:
2316 @example 2321 @example
2317 (vip-set-searchstyle-toggling-macros 'undefine) 2322 (viper-set-searchstyle-toggling-macros 'undefine)
2318 @end example 2323 @end example
2319 @findex @code{vip-set-searchstyle-toggling-macros} 2324 @findex @code{viper-set-searchstyle-toggling-macros}
2320 2325
2321 @item Vi-isms in Emacs state 2326 @item Vi-isms in Emacs state
2322 Some people find it useful to use the Vi-style search key, `/', to invoke 2327 Some people find it useful to use the Vi-style search key, `/', to invoke
2323 search in modes which Viper leaves in emacs-state. These modes are: 2328 search in modes which Viper leaves in emacs-state. These modes are:
2324 @code{dired-mode}, @code{mh-folder-mode}, @code{gnus-group-mode}, 2329 @code{dired-mode}, @code{mh-folder-mode}, @code{gnus-group-mode},
2328 binds `:' to invoke ex-style commands, like in vi-state. And, as described 2333 binds `:' to invoke ex-style commands, like in vi-state. And, as described
2329 above, `//' and `///' get bound to Vi-style macros that toggle 2334 above, `//' and `///' get bound to Vi-style macros that toggle
2330 case-insensitivity and regexp-search. 2335 case-insensitivity and regexp-search.
2331 2336
2332 If you don't like these features---which I don't really understand---you 2337 If you don't like these features---which I don't really understand---you
2333 can unbind `/' and `:' in @code{vip-dired-modifier-map} (for Dired) or in 2338 can unbind `/' and `:' in @code{viper-dired-modifier-map} (for Dired) or in
2334 @code{vip-slash-and-colon-map}, for other modes. 2339 @code{viper-slash-and-colon-map}, for other modes.
2335 @vindex @code{vip-slash-and-colon-map} 2340 @vindex @code{viper-slash-and-colon-map}
2336 @vindex @code{vip-dired-modifier-map} 2341 @vindex @code{viper-dired-modifier-map}
2337 2342
2338 To unbind the macros `//' and `///' for a major mode where you feel they 2343 To unbind the macros `//' and `///' for a major mode where you feel they
2339 are undesirable, execute @code{vip-set-emacs-state-searchstyle-macros} with a 2344 are undesirable, execute @code{viper-set-emacs-state-searchstyle-macros} with a
2340 non-nil argument. This can be done either interactively, by supplying a 2345 non-nil argument. This can be done either interactively, by supplying a
2341 prefix argument, or by placing 2346 prefix argument, or by placing
2342 @example 2347 @example
2343 (vip-set-emacs-state-searchstyle-macros 'undefine) 2348 (viper-set-emacs-state-searchstyle-macros 'undefine)
2344 @end example 2349 @end example
2345 @findex @code{vip-set-emacs-state-searchstyle-macros} 2350 @findex @code{viper-set-emacs-state-searchstyle-macros}
2346 in the hook to the major mode (e.g., @code{dired-mode-hook}). 2351 in the hook to the major mode (e.g., @code{dired-mode-hook}).
2347 @xref{Vi Macros}, for more information on Vi macros. 2352 @xref{Vi Macros}, for more information on Vi macros.
2348 2353
2349 @item vip-heading-start 2354 @item viper-heading-start
2350 @item vip-heading-end 2355 @item viper-heading-end
2351 @cindex headings 2356 @cindex headings
2352 @cindex sections 2357 @cindex sections
2353 @cindex paragraphs 2358 @cindex paragraphs
2354 @cindex sentences 2359 @cindex sentences
2355 Regular Expressions for @kbd{[[} and @kbd{]]}. Note that Emacs defines 2360 Regular Expressions for @kbd{[[} and @kbd{]]}. Note that Emacs defines
2356 Regexps for paragraphs and sentences. @xref{Paragraphs,,Paragraphs and 2361 Regexps for paragraphs and sentences. @xref{Paragraphs,,Paragraphs and
2357 Sentences,emacs,The GNU Emacs Manual}, for details. 2362 Sentences,emacs,The GNU Emacs Manual}, for details.
2358 @item M-x viper-set-expert-level 2363 @item M-x viper-set-expert-level
2359 @findex @code{viper-set-expert-level} 2364 @findex @code{viper-set-expert-level}
2360 Change your user level interactively. 2365 Change your user level interactively.
2361 @item vip-smart-suffix-list '("" "tex" "c" "cc" "el" "p") 2366 @item viper-smart-suffix-list '("" "tex" "c" "cc" "el" "p")
2362 @vindex @code{vip-smart-suffix-list} 2367 @vindex @code{viper-smart-suffix-list}
2363 Viper supports Emacs-style file completion when it prompts the user for a 2368 Viper supports Emacs-style file completion when it prompts the user for a
2364 file name. However, in many cases, the same directory may contain files 2369 file name. However, in many cases, the same directory may contain files
2365 with identical prefix but different suffixes, e.g., prog.c, prog.o, 2370 with identical prefix but different suffixes, e.g., prog.c, prog.o,
2366 paper.tex, paper.dvi. In such cases, completion will stop at the `.'. 2371 paper.tex, paper.dvi. In such cases, completion will stop at the `.'.
2367 If the above variable is a list of strings representing suffixes, Viper will 2372 If the above variable is a list of strings representing suffixes, Viper will
2375 to complete the file name by typing the appropriate suffix. If `paper.' was 2380 to complete the file name by typing the appropriate suffix. If `paper.' was
2376 the intended file name, hitting return will accept it. 2381 the intended file name, hitting return will accept it.
2377 2382
2378 To turn this feature off, set the above variable to @code{nil}. 2383 To turn this feature off, set the above variable to @code{nil}.
2379 2384
2380 @item vip-insertion-ring-size 14 2385 @item viper-insertion-ring-size 14
2381 @vindex @code{vip-insertion-ring-size} 2386 @vindex @code{viper-insertion-ring-size}
2382 @cindex Insertion ring 2387 @cindex Insertion ring
2383 Viper remembers what was previously inserted in Insert and Replace states. 2388 Viper remembers what was previously inserted in Insert and Replace states.
2384 Several such recent insertions are kept in a special ring of strings of size 2389 Several such recent insertions are kept in a special ring of strings of size
2385 @code{vip-insertion-ring-size}. 2390 @code{viper-insertion-ring-size}.
2386 If you enter Insert or Replace state you can reinsert strings from this 2391 If you enter Insert or Replace state you can reinsert strings from this
2387 ring by typing @kbd{C-c M-p} or @kbd{C-c M-n}. The former will search the 2392 ring by typing @kbd{C-c M-p} or @kbd{C-c M-n}. The former will search the
2388 ring in 2393 ring in
2389 the direction of older insertions, and the latter will search in 2394 the direction of older insertions, and the latter will search in
2390 the direction of newer insertions. Hitting @kbd{C-c M-p} or @kbd{C-c M-n} 2395 the direction of newer insertions. Hitting @kbd{C-c M-p} or @kbd{C-c M-n}
2394 variable in the @file{~/.viper} file. 2399 variable in the @file{~/.viper} file.
2395 2400
2396 Since typing these sequences of keys may be tedious, it is suggested that the 2401 Since typing these sequences of keys may be tedious, it is suggested that the
2397 user should bind a function key, such as @kbd{f31}, as follows: 2402 user should bind a function key, such as @kbd{f31}, as follows:
2398 @example 2403 @example
2399 (define-key vip-insert-global-user-map [f31] 2404 (define-key viper-insert-global-user-map [f31]
2400 'vip-insert-prev-from-insertion-ring) 2405 'viper-insert-prev-from-insertion-ring)
2401 @end example 2406 @end example
2402 This binds @kbd{f31} (which is usually @kbd{R11} on a Sun workstation) 2407 This binds @kbd{f31} (which is usually @kbd{R11} on a Sun workstation)
2403 to the function that inserts the previous string in the insertion history. 2408 to the function that inserts the previous string in the insertion history.
2404 To rotate the history in the opposite 2409 To rotate the history in the opposite
2405 direction, you can either bind an unused key to 2410 direction, you can either bind an unused key to
2406 @code{vip-insert-next-from-insertion-ring} or hit any digit (1 to 9) then 2411 @code{viper-insert-next-from-insertion-ring} or hit any digit (1 to 9) then
2407 @kbd{f31}. 2412 @kbd{f31}.
2408 2413
2409 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since 2414 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
2410 this will interfere with the Minibuffer histories and, possibly, other 2415 this will interfere with the Minibuffer histories and, possibly, other
2411 major modes. 2416 major modes.
2412 2417
2413 @item vip-command-ring-size 14 2418 @item viper-command-ring-size 14
2414 @vindex @code{vip-command-ring-size} 2419 @vindex @code{viper-command-ring-size}
2415 @cindex Destructive command ring 2420 @cindex Destructive command ring
2416 @cindex Destructive command history 2421 @cindex Destructive command history
2417 Viper keeps track of the recent history of destructive 2422 Viper keeps track of the recent history of destructive
2418 commands, such as @kbd{dw}, @kbd{i}, etc. 2423 commands, such as @kbd{dw}, @kbd{i}, etc.
2419 In Vi state, 2424 In Vi state,
2425 opposite direction. 2430 opposite direction.
2426 Since typing @kbd{C-c M-p} may be tedious, it is more convenient to bind an 2431 Since typing @kbd{C-c M-p} may be tedious, it is more convenient to bind an
2427 appropriate function to an unused function key on the keyboard and use that 2432 appropriate function to an unused function key on the keyboard and use that
2428 key. For instance, the following 2433 key. For instance, the following
2429 @example 2434 @example
2430 (define-key vip-vi-global-user-map [f31] 2435 (define-key viper-vi-global-user-map [f31]
2431 'vip-prev-destructive-command) 2436 'viper-prev-destructive-command)
2432 @end example 2437 @end example
2433 binds the key @kbd{f31} (which is usually @kbd{R11} on a Sun workstation) 2438 binds the key @kbd{f31} (which is usually @kbd{R11} on a Sun workstation)
2434 to the function that searches the command history in the direction of older 2439 to the function that searches the command history in the direction of older
2435 commands. To search in the opposite 2440 commands. To search in the opposite
2436 direction, you can either bind an unused key to 2441 direction, you can either bind an unused key to
2437 @code{vip-next-destructive-command} or hit any digit (1 to 9) then @kbd{f31}. 2442 @code{viper-next-destructive-command} or hit any digit (1 to 9) then @kbd{f31}.
2438 2443
2439 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since 2444 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
2440 this will interfere with the Minibuffer histories and, possibly, other 2445 this will interfere with the Minibuffer histories and, possibly, other
2441 major modes. 2446 major modes.
2442 2447
2443 @item vip-minibuffer-vi-face 'vip-minibuffer-vi-face 2448 @item viper-minibuffer-vi-face 'viper-minibuffer-vi-face
2444 @item vip-minibuffer-insert-face 'vip-minibuffer-insert-face 2449 @item viper-minibuffer-insert-face 'viper-minibuffer-insert-face
2445 @item vip-minibuffer-emacs-face 'vip-minibuffer-emacs-face 2450 @item viper-minibuffer-emacs-face 'viper-minibuffer-emacs-face
2446 These faces control the appearance of the minibuffer text in the 2451 These faces control the appearance of the minibuffer text in the
2447 corresponding Viper states. For heavy-duty customization, consult 2452 corresponding Viper states. You can change the appearance of these faces
2448 the Lisp Reference to Emacs. You can also take a look how these faces are 2453 through Emacs' customization widget, which is accessible through the
2449 defined in @file{viper.el}. 2454 menubar.
2450 2455
2451 However, on a color workstation, the following method usually suffices: 2456 Viper is located in this widget under the @emph{Emulations} customization
2452 @example 2457 subgroup of the @emph{Editing} group. All Viper faces are grouped together
2453 (set-face-foreground vip-minibuffer-vi-face "blue") 2458 in Viper's @emph{Highlighting} customization subgroup.
2454 (set-face-background vip-minibuffer-emacs-face "orchid")
2455 @end example
2456 This will make a blue foreground in the Minibuffer when it is in Vi
2457 state; its background will turn to orchid when it switches to Emacs state.
2458 2459
2459 Note that only the text you type in is affected by the above faces. 2460 Note that only the text you type in is affected by the above faces.
2460 Prompts and Minibuffer messages are not affected. 2461 Prompts and Minibuffer messages are not affected.
2461 2462
2462 Purists who do not like adornments in the minibuffer can always zap them by 2463 Purists who do not like adornments in the minibuffer can always zap them by
2463 putting 2464 putting
2464 @example 2465 @example
2465 (copy-face 'default 'vip-minibuffer-vi-face) 2466 (copy-face 'default 'viper-minibuffer-vi-face)
2466 (copy-face 'default 'vip-minibuffer-insert-face) 2467 (copy-face 'default 'viper-minibuffer-insert-face)
2467 (copy-face 'default 'vip-minibuffer-emacs-face) 2468 (copy-face 'default 'viper-minibuffer-emacs-face)
2468 @end example 2469 @end example
2469 in the @file{~/.viper} file. However, in that case, the user will not have any 2470 in the @file{~/.viper} file or through the customization widget, as
2471 described above. However, in that case, the user will not have any
2470 indication of the current Viper state in the minibuffer. (This is important 2472 indication of the current Viper state in the minibuffer. (This is important
2471 if the user accidentally switches to another Viper state by typing @key{ESC} or 2473 if the user accidentally switches to another Viper state by typing @key{ESC} or
2472 @kbd{C-z}). 2474 @kbd{C-z}).
2473 @item M-x viper-go-away 2475 @item M-x viper-go-away
2474 @findex @code{viper-go-away} 2476 @findex @code{viper-go-away}
2475 Make Viper disappear from the face of your running Emacs instance. If your 2477 Make Viper disappear from the face of your running Emacs instance. If your
2476 fingers start aching again, @kbd{M-x viper-mode} might save your day. 2478 fingers start aching again, @kbd{M-x viper-mode} might save your day.
2479 @item M-x toggle-viper-mode
2480 @findex @code{toggle-viper-mode}
2481 Toggle Viperization of Emacs on and off.
2477 @end table 2482 @end table
2478 2483
2479 @cindex Multifile documents and programs 2484 @cindex Multifile documents and programs
2480 2485
2481 Viper provides some support for multi-file documents and programs. 2486 Viper provides some support for multi-file documents and programs.
2482 If a document consists of several files we can designate one of them as a 2487 If a document consists of several files we can designate one of them as a
2483 master and put the following at the end of that file: 2488 master and put the following at the end of that file:
2484 @lisp 2489 @lisp
2485 ;;; Local Variables: 2490 ;;; Local Variables:
2486 ;;; eval: (vip-setup-master-buffer "file1" "file2" "file3" "file5" "file5") 2491 ;;; eval: (viper-setup-master-buffer "file1" "file2" "file3" "file5" "file5")
2487 ;;; End: 2492 ;;; End:
2488 @end lisp 2493 @end lisp
2489 @noindent 2494 @noindent
2490 where @code{file1} to @code{file5} are names of files related to the master 2495 where @code{file1} to @code{file5} are names of files related to the master
2491 file. Next time, when the master file is visited, the command 2496 file. Next time, when the master file is visited, the command
2492 @code{vip-setup-master-buffer} will be evaluated and the above files will 2497 @code{viper-setup-master-buffer} will be evaluated and the above files will
2493 be associated with the master file. Then, the new Ex command 2498 be associated with the master file. Then, the new Ex command
2494 @kbd{:RelatedFile} (abbr. @kbd{:R}) will display files 1 to 5 one after 2499 @kbd{:RelatedFile} (abbr. @kbd{:R}) will display files 1 to 5 one after
2495 another, so you can edit them. If a file is not in any Emacs buffer, it 2500 another, so you can edit them. If a file is not in any Emacs buffer, it
2496 will be visited. The command @kbd{PreviousRelatedFile} (abbr., @kbd{:P}) 2501 will be visited. The command @kbd{PreviousRelatedFile} (abbr., @kbd{:P})
2497 goes through the file list in the opposite direction. 2502 goes through the file list in the opposite direction.
2512 in a primitive interface to Emacs tags. @xref{Tags,Tags,Tags,emacs, 2517 in a primitive interface to Emacs tags. @xref{Tags,Tags,Tags,emacs,
2513 The Gnu Emacs Manual}, for more information on tags. 2518 The Gnu Emacs Manual}, for more information on tags.
2514 2519
2515 The following two commands are normally bound to a mouse click and are part 2520 The following two commands are normally bound to a mouse click and are part
2516 of Viper. They work only if Emacs runs as an application under X 2521 of Viper. They work only if Emacs runs as an application under X
2517 Windows (or under some other window system for which a port of GNU Emacs 19 2522 Windows (or under some other window system for which a port of GNU Emacs 20
2518 is available). Clicking the mouse when Emacs is invoked in an Xterm window 2523 is available). Clicking the mouse when Emacs is invoked in an Xterm window
2519 (using @code{emacs -nw}) will do no good. 2524 (using @code{emacs -nw}) will do no good.
2520 2525
2521 @table @code 2526 @table @code
2522 @cindex mouse 2527 @cindex mouse
2523 @item M-S-mouse-1 (Emacs) 2528 @cindex mouse-search
2524 @item meta shift button1up (XEmacs) 2529 @item viper-mouse-search-key (meta shift 1)
2525 Holding Meta and Shift while clicking mouse button 1 2530 @vindex @code{viper-mouse-insert-key}
2526 will initiate search for a region under the 2531 This variable controls the @emph{mouse-search} feature of Viper. The
2527 mouse pointer (defined below). This command can take a prefix argument, 2532 default value
2528 which indicates the occurrence of the pattern to search for. 2533 states that holding Meta and Shift keys while clicking mouse button 1
2529 2534 should initiate search for a region under the mouse pointer (defined
2530 Note: Viper binds this mouse action only if it is not already bound to 2535 below). This command can take a prefix argument, which indicates the
2531 something else. If you want to use this feature and @kbd{M-S-mouse-1} 2536 occurrence of the pattern to search for.
2532 is already used for something else, you can rebind mouse-search as, for 2537
2533 example, in the following example: 2538 Note: while loading initially, Viper binds this mouse action only if it is
2539 not already bound to something else. If you want to use the mouse-seatch
2540 feature and the Meta-Shift-button-1 mouse action is already bound to
2541 something else you can rebind the mouse-search feature by setting
2542 @code{viper-mouse-search-key} to something else in your @code{~/.viper}
2543 file:
2534 @lisp 2544 @lisp
2535 (global-set-key [M-mouse-1] 'vip-mouse-click-search-word) 2545 (setq viper-mouse-search-key '(meta 1))
2536 (global-set-key [M-down-mouse-1] 'vip-mouse-catch-frame-switch)
2537 @end lisp 2546 @end lisp
2538 This would bind mouse search to the action invoked by pressing the 2547 This would bind mouse search to the action invoked by pressing the
2539 Meta key and clicking mouse button 1. Note: if 2548 Meta key and clicking mouse button 1. The allowed values of
2540 @code{vip-mouse-click-search-word} is bound to an action, then 2549 @code{viper-mouse-search-key} are lists that contain a mouse-button number
2541 @code{vip-mouse-catch-frame-switch} must be bound to a down-action, as 2550 (1,2, or 3) and any combination of the words `control', `meta', and
2542 shown in the above example. 2551 `shift'.
2543 2552
2544 In XEmacs, you can change bindings as follows: 2553 If the requested mouse action (e.g., (meta 1)) is already taken for other
2554 purposes then you have to confirm your intention by placing the following
2555 command in @code{~/.viper} after setting @code{viper-mouse-search-key}:
2545 @lisp 2556 @lisp
2546 (global-set-key [(meta control button1up)] 2557 (viper-bind-mouse-search-key 'force)
2547 'vip-mouse-click-search-word)
2548 (global-set-key [(meta control button1)]
2549 'vip-mouse-catch-frame-switch)
2550 @end lisp 2558 @end lisp
2551 if, say, you prefer to hold both meta and control while clicking. 2559
2552 2560 You can also change this setting interactively, through the customization
2553 Like in Emacs, there are special rules for binding these functions: the 2561 widget of Emacs (choose option "Customize.Customize Group" from the
2554 first must be bound to a button-up event while the second must be bound to 2562 menubar).
2555 a button-event (which is XEmacs' equivalent of a down-mouse event). Also,
2556 in Emacs, the double-click and triple-click actions for the same button
2557 (@code{double-S-mouse-1}, etc., if the above default binding is used)
2558 should not be bound (or it should be bound to the same function,
2559 @code{vip-mouse-click-search-word}).
2560 2563
2561 The region that is chosen as a pattern to search for is determined as 2564 The region that is chosen as a pattern to search for is determined as
2562 follows. If search is invoked via a single click, Viper chooses the region 2565 follows. If search is invoked via a single click, Viper chooses the region
2563 that lies between the beginning of the ``word'' under the pointer (``word'' 2566 that lies between the beginning of the ``word'' under the pointer (``word''
2564 is understood in Vi sense) and the end of that word. The only difference 2567 is understood in Vi sense) and the end of that word. The only difference
2575 of that ``Word'' (as determined by the @kbd{E} command). 2578 of that ``Word'' (as determined by the @kbd{E} command).
2576 2579
2577 On a triple-click, the region consists of the entire line where the click 2580 On a triple-click, the region consists of the entire line where the click
2578 occurred with all leading and trailing spaces and tabs removed. 2581 occurred with all leading and trailing spaces and tabs removed.
2579 2582
2580 @item M-S-mouse-2 (Emacs) 2583 @cindex mouse-insert
2581 @item meta shift button2up (XEmacs) 2584 @item viper-mouse-insert-key (meta shift 2)
2582 Holding Meta and Shift while clicking mouse button 2 2585 @vindex @code{viper-mouse-insert-key}
2583 will insert the region surrounding the 2586 This variable controls the @emph{mouse-insert} feature of Viper.
2587 The above default value states that
2588 holding Meta and Shift keys while clicking mouse button 2
2589 should insert the region surrounding the
2584 mouse pointer. The rules defining this region are the same as for 2590 mouse pointer. The rules defining this region are the same as for
2585 mouse-search. This command takes an optional prefix argument, which 2591 mouse-search. This command takes an optional prefix argument, which
2586 indicates how many such regions to snarf from the buffer and insert. (In 2592 indicates how many such regions to snarf from the buffer and insert. (In
2587 case of a triple-click, the prefix argument is ignored.) 2593 case of a triple-click, the prefix argument is ignored.)
2588 2594
2589 Note: Viper binds this mouse action only if it not already bound to 2595 Note: while loading initially, Viper binds this mouse action only if it not
2590 something else. If you want to use this feature and @kbd{S-mouse-2} 2596 already bound to something else. If you want to use this feature and the
2591 is already used for something else, you can rebind mouse-insert as follows: 2597 default mouse action is already bound, you can rebind mouse-insert by
2598 placing this command in @code{~/.viper}:
2592 @lisp 2599 @lisp
2593 (global-set-key [M-mouse-2] 'vip-mouse-click-insert-word) 2600 (setq viper-mouse-insert-key '(meta 2))
2594 (global-set-key [M-down-mouse-2] 'vip-mouse-catch-frame-switch)
2595 @end lisp 2601 @end lisp
2596 In XEmacs, you can change the bindings as follows: 2602 If you want to bind mouse-insert to an action even if this action is
2603 already taked for other purposes in Emacs, then you should add this command
2604 to @code{~/.viper}, after setting @code{viper-mouse-insert-key}:
2597 @lisp 2605 @lisp
2598 (global-set-key [(meta control button2up)] 2606 (viper-bind-mouse-insert-key 'force)
2599 'vip-mouse-click-insert-word)
2600 (global-set-key [(meta control button2)]
2601 'vip-mouse-catch-frame-switch)
2602 @end lisp 2607 @end lisp
2603 2608
2604 @item vip-multiclick-timeout 2609 This value can also be changed via the Emacs customization widget at the
2610 menubar.
2611
2612 @item viper-multiclick-timeout
2605 This variable controls the rate at which double-clicking must occur for the 2613 This variable controls the rate at which double-clicking must occur for the
2606 purpose of mouse search and mouse insert. By default, this is set to 2614 purpose of mouse search and mouse insert. By default, this is set to
2607 @code{double-click-time} in Emacs and to 2615 @code{double-click-time} in Emacs and to
2608 @code{mouse-track-multi-click-time} milliseconds in XEmacs. 2616 @code{mouse-track-multi-click-time} milliseconds in XEmacs.
2609 @end table 2617 @end table
2610 @kindex @kbd{S-mouse-1} 2618 @kindex @kbd{S-mouse-1}
2611 @kindex @kbd{S-mouse-2} 2619 @kindex @kbd{S-mouse-2}
2612 @kindex @kbd{meta shift button1up} 2620 @kindex @kbd{meta shift button1up}
2613 @kindex @kbd{meta shift button2up} 2621 @kindex @kbd{meta shift button2up}
2614 @vindex @code{vip-multiclick-timeout} 2622 @vindex @code{viper-multiclick-timeout}
2615 @findex @code{vip-mouse-click-insert-word} 2623 @findex @code{viper-mouse-click-insert-word}
2616 @findex @code{vip-mouse-click-search-word} 2624 @findex @code{viper-mouse-click-search-word}
2617 2625
2618 Note: The above functions search and insert in the selected window of 2626 Note: The above functions search and insert in the selected window of
2619 the latest active frame. This means that you can click in another window or 2627 the latest active frame. This means that you can click in another window or
2620 another frame and have search or insertion done in the frame and window you 2628 another frame and have search or insertion done in the frame and window you
2621 just left. This lets one use these functions in a multi-frame 2629 just left. This lets one use these functions in a multi-frame
2628 XEmacs, to shift focus to frame B, you will have to select this frame with 2636 XEmacs, to shift focus to frame B, you will have to select this frame with
2629 a mouse, by clicking. 2637 a mouse, by clicking.
2630 2638
2631 If you decide that you don't like the above feature and always want 2639 If you decide that you don't like the above feature and always want
2632 search/insertion be performed in the frame where the click occurs, don't 2640 search/insertion be performed in the frame where the click occurs, don't
2633 bind (and unbind, if necessary) @code{vip-mouse-catch-frame-switch} from 2641 bind (and unbind, if necessary) @code{viper-mouse-catch-frame-switch} from
2634 the mouse event it is bound to. 2642 the mouse event it is bound to.
2635 2643
2636 Mouse search is integrated with Vi-style search, so you can 2644 Mouse search is integrated with Vi-style search, so you can
2637 repeat it with @kbd{n} and @kbd{N}. It should be also noted that, while 2645 repeat it with @kbd{n} and @kbd{N}. It should be also noted that, while
2638 case-sensitivity of search in Viper is controlled by the variable 2646 case-sensitivity of search in Viper is controlled by the variable
2639 @code{vip-case-fold-search}, the case of mouse search is 2647 @code{viper-case-fold-search}, the case of mouse search is
2640 controlled by the Emacs variable @code{case-fold-search}, which may be set 2648 controlled by the Emacs variable @code{case-fold-search}, which may be set
2641 differently from @code{vip-case-fold-search}. Therefore, case-sensitivity 2649 differently from @code{viper-case-fold-search}. Therefore, case-sensitivity
2642 of mouse search may be different from that of the usual Vi-style search. 2650 of mouse search may be different from that of the usual Vi-style search.
2643 2651
2644 Finally, if the way Viper determines the word to be searched for or to be 2652 Finally, if the way Viper determines the word to be searched for or to be
2645 inserted is not what you want, there is a variable, 2653 inserted is not what you want, there is a variable,
2646 @code{vip-surrounding-word-function}, which can be changed to indicate 2654 @code{viper-surrounding-word-function}, which can be changed to indicate
2647 another function for snarfing words out of the buffer. The catch is that 2655 another function for snarfing words out of the buffer. The catch is that
2648 you will then have to write such a function and make it known to your 2656 you will then have to write such a function and make it known to your
2649 Emacs. The function @code{vip-surrounding-word} in @file{viper.el} can be 2657 Emacs. The function @code{viper-surrounding-word} in @file{viper.el} can be
2650 used as a guiding example. 2658 used as a guiding example.
2651 2659
2652 @node Vi Macros, ,Viper Specials,Customization 2660 @node Vi Macros, ,Viper Specials,Customization
2653 @section Vi Macros 2661 @section Vi Macros
2654 2662
2736 here is how Viper saves the above macro so that it will be 2744 here is how Viper saves the above macro so that it will be
2737 available in Viper's Insert state (and Replace state) in buffer @code{my-buf} 2745 available in Viper's Insert state (and Replace state) in buffer @code{my-buf}
2738 only: 2746 only:
2739 2747
2740 @example 2748 @example
2741 (vip-record-kbd-macro "gg" 'insert-state 2749 (viper-record-kbd-macro "gg" 'insert-state
2742 [l up (meta x) n e x t - l i n e return] 2750 [l up (meta x) n e x t - l i n e return]
2743 "my-buf") 2751 "my-buf")
2744 @end example 2752 @end example
2745 2753
2746 @noindent 2754 @noindent
2747 To do the same for Vi state and all buffers with the major mode 2755 To do the same for Vi state and all buffers with the major mode
2748 @code{cc-mode}, use: 2756 @code{cc-mode}, use:
2749 2757
2750 @example 2758 @example
2751 (vip-record-kbd-macro "gg" 'vi-state 2759 (viper-record-kbd-macro "gg" 'vi-state
2752 [l up (meta x) n e x t - l i n e return] 2760 [l up (meta x) n e x t - l i n e return]
2753 'cc-mode) 2761 'cc-mode)
2754 @end example 2762 @end example
2755 2763
2756 @noindent 2764 @noindent
2762 If all members of a vectors are printable characters (or sequences, such as 2770 If all members of a vectors are printable characters (or sequences, such as
2763 @kbd{\e}, @kbd{\t}, for @key{ESC} and @key{TAB}), then they can also be represented as 2771 @kbd{\e}, @kbd{\t}, for @key{ESC} and @key{TAB}), then they can also be represented as
2764 strings: 2772 strings:
2765 2773
2766 @example 2774 @example
2767 (vip-record-kbd-macro "aa" 'vi-state "aaa\e" "my-buffer") 2775 (viper-record-kbd-macro "aa" 'vi-state "aaa\e" "my-buffer")
2768 @end example 2776 @end example
2769 2777
2770 @noindent 2778 @noindent
2771 Thus, typing @kbd{aa} fast in Vi state will switch Viper to Insert state 2779 Thus, typing @kbd{aa} fast in Vi state will switch Viper to Insert state
2772 (due to the first @kbd{a}), insert @kbd{aa}, and then it will switch back to Vi 2780 (due to the first @kbd{a}), insert @kbd{aa}, and then it will switch back to Vi
2773 state. All this will take effect only in the buffer named @code{my-buffer}. 2781 state. All this will take effect only in the buffer named @code{my-buffer}.
2774 2782
2775 Note that the last argument to @code{vip-record-kbd-macro} must be either a 2783 Note that the last argument to @code{viper-record-kbd-macro} must be either a
2776 string (a buffer name), a symbol representing a major mode, or @code{t}; 2784 string (a buffer name), a symbol representing a major mode, or @code{t};
2777 the latter says that the macro is to be defined for all buffers 2785 the latter says that the macro is to be defined for all buffers
2778 (which is how macros are defined in original Vi). 2786 (which is how macros are defined in original Vi).
2779 2787
2780 For convenience, Viper also lets you define Vi-style macros in its Emacs 2788 For convenience, Viper also lets you define Vi-style macros in its Emacs
2781 state. There is no Ex command, like @kbd{:map} and @kbd{:map!} for doing 2789 state. There is no Ex command, like @kbd{:map} and @kbd{:map!} for doing
2782 this, but the user can include such a macro in the @file{~/.viper} file. The 2790 this, but the user can include such a macro in the @file{~/.viper} file. The
2783 only thing is that the @code{vip-record-kbd-macro} command should specify 2791 only thing is that the @code{viper-record-kbd-macro} command should specify
2784 @code{emacs-state} instead of @code{vi-state} or @code{insert-state}. 2792 @code{emacs-state} instead of @code{vi-state} or @code{insert-state}.
2785 2793
2786 The user can get rid of a macro either by using the Ex commands @kbd{:unmap} 2794 The user can get rid of a macro either by using the Ex commands @kbd{:unmap}
2787 and @kbd{:unmap!} or by issuing a call to @code{vip-unrecord-kbd-macro}. 2795 and @kbd{:unmap!} or by issuing a call to @code{viper-unrecord-kbd-macro}.
2788 The latter is more powerful, since it can delete macros even in 2796 The latter is more powerful, since it can delete macros even in
2789 @code{emacs-state}. However, @code{vip-unrecord-kbd-macro} is usually 2797 @code{emacs-state}. However, @code{viper-unrecord-kbd-macro} is usually
2790 needed only when the user needs to get rid of the macros that are already 2798 needed only when the user needs to get rid of the macros that are already
2791 predefined in Viper. 2799 predefined in Viper.
2792 The syntax is: 2800 The syntax is:
2793 @findex @code{vip-unrecord-kbd-macro} 2801 @findex @code{viper-unrecord-kbd-macro}
2794 @example 2802 @example
2795 (vip-unrecord-kbd-macro macro state) 2803 (viper-unrecord-kbd-macro macro state)
2796 @end example 2804 @end example
2797 @noindent 2805 @noindent
2798 The second argument must be @code{vi-state}, @code{insert-state}, or 2806 The second argument must be @code{vi-state}, @code{insert-state}, or
2799 @code{emacs-state}. The first argument is a name of a macro. To avoid 2807 @code{emacs-state}. The first argument is a name of a macro. To avoid
2800 mistakes in specifying names of existing macros, type @kbd{M-x 2808 mistakes in specifying names of existing macros, type @kbd{M-x
2801 vip-describe-kbd-macros} and use a name from the list displayed by this 2809 viper-describe-kbd-macros} and use a name from the list displayed by this
2802 command. 2810 command.
2803 2811
2804 If an error occurs during macro definition, Emacs 2812 If an error occurs during macro definition, Emacs
2805 aborts the process, and it must be repeated. This is analogous to Vi, 2813 aborts the process, and it must be repeated. This is analogous to Vi,
2806 except that in Vi the user doesn't know there is an error until the macro is 2814 except that in Vi the user doesn't know there is an error until the macro is
2846 can type @kbd{M-x eval-last-sexp} followed by @kbd{C-x )}. 2854 can type @kbd{M-x eval-last-sexp} followed by @kbd{C-x )}.
2847 If you answer positively to Viper's offer to save this macro in @file{~/.viper} 2855 If you answer positively to Viper's offer to save this macro in @file{~/.viper}
2848 for future uses, the following will be inserted in that file: 2856 for future uses, the following will be inserted in that file:
2849 2857
2850 @example 2858 @example
2851 (vip-record-kbd-macro [f16 f16] 'vi-state 2859 (viper-record-kbd-macro [f16 f16] 'vi-state
2852 [(meta x) e v a l - l a s t - s e x p] 2860 [(meta x) e v a l - l a s t - s e x p]
2853 'lisp-interaction-mode) 2861 'lisp-interaction-mode)
2854 @end example 2862 @end example
2855 2863
2856 To illustrate the above point, Viper provides two canned macros, which, by 2864 To illustrate the above point, Viper provides two canned macros, which, by
2863 If you need to go deeper into the command history, you will have to use 2871 If you need to go deeper into the command history, you will have to use
2864 other commands, as described earlier in this section; or you can bind, 2872 other commands, as described earlier in this section; or you can bind,
2865 say, @kbd{f12 \3} like this: 2873 say, @kbd{f12 \3} like this:
2866 2874
2867 @example 2875 @example
2868 (vip-record-kbd-macro [f12 \3] 'vi-state 2876 (viper-record-kbd-macro [f12 \3] 'vi-state
2869 [(meta x) r e p e a t - f r o m - h i s t o r y] 2877 [(meta x) r e p e a t - f r o m - h i s t o r y]
2870 t) 2878 t)
2871 @end example 2879 @end example
2872 2880
2873 2881
2911 We should also note that Vi macros are disabled in the Minibuffer, which 2919 We should also note that Vi macros are disabled in the Minibuffer, which
2912 helps keep some potential troubles away. 2920 helps keep some potential troubles away.
2913 2921
2914 The rate at which the user must type keys in order for them to be 2922 The rate at which the user must type keys in order for them to be
2915 recognized as a timeout macro is controlled by the variable 2923 recognized as a timeout macro is controlled by the variable
2916 @code{vip-fast-keyseq-timeout}, which defaults to 200 milliseconds. 2924 @code{viper-fast-keyseq-timeout}, which defaults to 200 milliseconds.
2917 2925
2918 For the most part, Viper macros defined in @file{~/.viper} can be shared 2926 For the most part, Viper macros defined in @file{~/.viper} can be shared
2919 between Emacs, XEmacs, and X and TTY modes. However, macros defined via 2927 between Emacs, XEmacs, and X and TTY modes. However, macros defined via
2920 function keys may need separate definitions when XEmacs and Emacs have 2928 function keys may need separate definitions when XEmacs and Emacs have
2921 different names for the same keyboard key. For instance, the `Page Up' key 2929 different names for the same keyboard key. For instance, the `Page Up' key
2928 Macros that are bound to key sequences that contain such unmapped function 2936 Macros that are bound to key sequences that contain such unmapped function
2929 keys have to be redefined for TTY's (and possibly for every type of TTY you 2937 keys have to be redefined for TTY's (and possibly for every type of TTY you
2930 may be using). To do this, start Emacs on an appropriate TTY device and 2938 may be using). To do this, start Emacs on an appropriate TTY device and
2931 define the macro using @kbd{:map}, as usual. 2939 define the macro using @kbd{:map}, as usual.
2932 2940
2933 @findex @code{vip-describe-kbd-macros} 2941 @findex @code{viper-describe-kbd-macros}
2934 Finally, Viper provides a function that conveniently displays all macros 2942 Finally, Viper provides a function that conveniently displays all macros
2935 currently defined. To see all macros along with their definitions, type 2943 currently defined. To see all macros along with their definitions, type
2936 @kbd{M-x vip-describe-kbd-macros}. 2944 @kbd{M-x viper-describe-kbd-macros}.
2937 2945
2938 @node Commands,,Customization,Top,Top 2946 @node Commands,,Customization,Top,Top
2939 @chapter Commands 2947 @chapter Commands
2940 2948
2941 This section is a semi-automatically bowdlerized version of the Vi 2949 This section is a semi-automatically bowdlerized version of the Vi
3089 alphanumeric in a symbol table can automatically be made part of the Viper 3097 alphanumeric in a symbol table can automatically be made part of the Viper
3090 word. This is useful when, for instance, editing text containing European, 3098 word. This is useful when, for instance, editing text containing European,
3091 Cyrillic, etc., letters. 3099 Cyrillic, etc., letters.
3092 3100
3093 Second, Viper lets you depart from Vi's idea of a word by changing the 3101 Second, Viper lets you depart from Vi's idea of a word by changing the
3094 value of @code{vip-syntax-preference}. By default, this variable is set to 3102 value of @code{viper-syntax-preference}. By default, this variable is set to
3095 @code{strict-vi}, which means that alphanumeric symbols are exactly as 3103 @code{strict-vi}, which means that alphanumeric symbols are exactly as
3096 in Vi. 3104 in Vi.
3097 However, if the value is @code{reformed-vi} then alphanumeric 3105 However, if the value is @code{reformed-vi} then alphanumeric
3098 symbols will be those specified by the current Emacs syntax table (which 3106 symbols will be those specified by the current Emacs syntax table (which
3099 may be different for different major modes) plus the underscore symbol 3107 may be different for different major modes) plus the underscore symbol
3100 @kbd{_}. The user can also specify the value @code{emacs}, which would 3108 @kbd{_}. The user can also specify the value @code{emacs}, which would
3101 make Viper use exactly the Emacs notion of word. In particular, the 3109 make Viper use exactly the Emacs notion of word. In particular, the
3102 underscore may not be part of a word. Finally, if 3110 underscore may not be part of a word. Finally, if
3103 @code{vip-syntax-preference} is set to @code{extended}, Viper words would 3111 @code{viper-syntax-preference} is set to @code{extended}, Viper words would
3104 consist of characters that are classified as alphanumeric @emph{or} as 3112 consist of characters that are classified as alphanumeric @emph{or} as
3105 parts of symbols. This is convenient for writing programs and in many other 3113 parts of symbols. This is convenient for writing programs and in many other
3106 situations. 3114 situations.
3107 3115
3108 @vindex @code{vip-syntax-preference} 3116 @vindex @code{viper-syntax-preference}
3109 @cindex syntax table 3117 @cindex syntax table
3110 3118
3111 @code{vip-syntax-preference} is a local variable, so it can have different 3119 @code{viper-syntax-preference} is a local variable, so it can have different
3112 values for different major modes. For instance, in programming modes it can 3120 values for different major modes. For instance, in programming modes it can
3113 have the value @code{extended}. In text modes where words contain special 3121 have the value @code{extended}. In text modes where words contain special
3114 characters, such as European (non-English) letters, Cyrillic letters, etc., 3122 characters, such as European (non-English) letters, Cyrillic letters, etc.,
3115 the value can be @code{reformed-vi} or @code{emacs}. 3123 the value can be @code{reformed-vi} or @code{emacs}.
3116 3124
3117 Changes to @code{vip-syntax-preference} should be done in the hooks to 3125 Changes to @code{viper-syntax-preference} should be done in the hooks to
3118 various major modes. Furthermore, for these changes to take effect, you 3126 various major modes. Furthermore, for these changes to take effect, you
3119 should execute @code{(vip-update-alphanumeric-class)} right after changing 3127 should execute @code{(viper-update-alphanumeric-class)} right after changing
3120 the value of @code{vip-syntax-preference}. 3128 the value of @code{viper-syntax-preference}.
3121 3129
3122 The above discussion concerns only the movement commands. In regular 3130 The above discussion concerns only the movement commands. In regular
3123 expressions, words remain the same as in Emacs. That is, the expressions 3131 expressions, words remain the same as in Emacs. That is, the expressions
3124 @code{\w}, @code{\>}, @code{\<}, etc., use Emacs' idea of what is a word, 3132 @code{\w}, @code{\>}, @code{\<}, etc., use Emacs' idea of what is a word,
3125 and they don't look into the value of variable 3133 and they don't look into the value of variable
3126 @code{vip-syntax-preference}. This is because Viper doesn't change syntax 3134 @code{viper-syntax-preference}. This is because Viper doesn't change syntax
3127 tables in order to not thwart the various major modes that set these 3135 tables in order to not thwart the various major modes that set these
3128 tables. 3136 tables.
3129 3137
3130 The usual Emacs convention is used to indicate Control Characters, i.e 3138 The usual Emacs convention is used to indicate Control Characters, i.e
3131 C-h for Control-h. @emph{Do not confuse this to mean the separate 3139 C-h for Control-h. @emph{Do not confuse this to mean the separate
3271 @cindex case-insensitive search 3279 @cindex case-insensitive search
3272 @item % 3280 @item %
3273 Find the next bracket/parenthesis/brace and go to its match. 3281 Find the next bracket/parenthesis/brace and go to its match.
3274 By default, Viper ignores brackets/parentheses/braces that occur inside 3282 By default, Viper ignores brackets/parentheses/braces that occur inside
3275 parentheses. You can change this by setting 3283 parentheses. You can change this by setting
3276 @code{vip-parse-sexp-ignore-comments} to nil in your @file{.viper} fipe. 3284 @code{viper-parse-sexp-ignore-comments} to nil in your @file{.viper} fipe.
3277 This option can also be toggled interactively if you quickly hit @kbd{%%%}. 3285 This option can also be toggled interactively if you quickly hit @kbd{%%%}.
3278 3286
3279 This latter feature is implemented as a vi-style keyboard macro. If you 3287 This latter feature is implemented as a vi-style keyboard macro. If you
3280 don't want this macro, put 3288 don't want this macro, put
3281 3289
3282 @example 3290 @example
3283 (vip-set-parsing-style-toggling-macro 'undefine) 3291 (viper-set-parsing-style-toggling-macro 'undefine)
3284 @end example 3292 @end example
3285 @findex @code{vip-set-parsing-style-toggling-macro} 3293 @findex @code{viper-set-parsing-style-toggling-macro}
3286 3294
3287 in your @file{~/.viper} file. 3295 in your @file{~/.viper} file.
3288 3296
3289 @end table 3297 @end table
3290 @kindex @kbd{%} 3298 @kindex @kbd{%}
3339 @kindex @kbd{C-h} 3347 @kindex @kbd{C-h}
3340 @kindex @kbd{h} 3348 @kindex @kbd{h}
3341 @kindex @kbd{j} 3349 @kindex @kbd{j}
3342 @kindex @kbd{k} 3350 @kindex @kbd{k}
3343 @kindex @kbd{l} 3351 @kindex @kbd{l}
3344 @vindex @code{vip-parse-sexp-ignore-comments} 3352 @vindex @code{viper-parse-sexp-ignore-comments}
3345 3353
3346 @node Marking,Appending Text,Move Commands,Text Handling 3354 @node Marking,Appending Text,Move Commands,Text Handling
3347 @subsection Marking 3355 @subsection Marking
3348 3356
3349 Emacs mark is referred to in the region specifiers @kbd{r} and @kbd{R}. 3357 Emacs mark is referred to in the region specifiers @kbd{r} and @kbd{R}.
3475 @subsection Editing in Insert State 3483 @subsection Editing in Insert State
3476 3484
3477 Minibuffer can be edited similarly to Insert state, and you can switch 3485 Minibuffer can be edited similarly to Insert state, and you can switch
3478 between Insert/Replace/Vi states at will. 3486 between Insert/Replace/Vi states at will.
3479 Some users prefer plain Emacs feel in the Minibuffer. To this end, set 3487 Some users prefer plain Emacs feel in the Minibuffer. To this end, set
3480 @var{vip-vi-style-in-minibuffer} to @code{nil}. 3488 @var{viper-vi-style-in-minibuffer} to @code{nil}.
3481 3489
3482 @cindex Insert state 3490 @cindex Insert state
3483 3491
3484 @table @kbd 3492 @table @kbd
3485 @item C-v 3493 @item C-v
3577 non-overlapping occurrence of <p>) and @samp{c} for 3585 non-overlapping occurrence of <p>) and @samp{c} for
3578 @samp{confirm} (type @samp{y} to confirm a particular 3586 @samp{confirm} (type @samp{y} to confirm a particular
3579 substitution, else @samp{n} ). Instead of @kbd{/} any 3587 substitution, else @samp{n} ). Instead of @kbd{/} any
3580 punctuation CHAR unequal to <space> <tab> and <lf> can be used as 3588 punctuation CHAR unequal to <space> <tab> and <lf> can be used as
3581 delimiter. 3589 delimiter.
3590
3591 In Emacs, @samp{\&} stands for the last matched expression, so
3592 @kbd{s/[ab]+/\&\&/} will double the string matched by @kbd{[ab]}.
3593 Viper doesn't treat @samp{&} specially, unlike Vi: use @samp{\&} instead.
3582 @item :[x,y]copy [z] 3594 @item :[x,y]copy [z]
3583 Copy text between @kbd{x} and @kbd{y} to the position after @kbd{z}. 3595 Copy text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
3584 @item :[x,y]t [z] 3596 @item :[x,y]t [z]
3585 Same as @kbd{:copy}. 3597 Same as @kbd{:copy}.
3586 @item :[x,y]move [z] 3598 @item :[x,y]move [z]
3587 Move text between @kbd{x} and @kbd{y} to the position after @kbd{z}. 3599 Move text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
3588 @item & 3600 @item &
3589 Repeat latest Ex substitute command, e.g. 3601 Repeat latest Ex substitute command, e.g.
3590 @kbd{:s/wrong/good}. 3602 @kbd{:s/wrong/right}.
3591 @item C-c / 3603 @item C-c /
3592 Toggle case-sensitive search. With prefix argument, toggle vanilla/regular 3604 Toggle case-sensitive search. With prefix argument, toggle vanilla/regular
3593 expression search. 3605 expression search.
3594 @item #c<move> 3606 @item #c<move>
3595 Change upper-case characters in the region to lower-case. 3607 Change upper-case characters in the region to lower-case.
3613 @kindex @kbd{C-c M-n} 3625 @kindex @kbd{C-c M-n}
3614 @kindex @kbd{#q<move> } 3626 @kindex @kbd{#q<move> }
3615 @kindex @kbd{#C<move>} 3627 @kindex @kbd{#C<move>}
3616 @kindex @kbd{#c<move>} 3628 @kindex @kbd{#c<move>}
3617 @kindex @kbd{&} 3629 @kindex @kbd{&}
3630 @kindex @kbd{\&}
3618 @findex @kbd{:substitute/<p>/<r>/<f>} 3631 @findex @kbd{:substitute/<p>/<r>/<f>}
3619 @findex @kbd{:s/<p>/<r>/<f>} 3632 @findex @kbd{:s/<p>/<r>/<f>}
3620 @findex @kbd{:copy [z]} 3633 @findex @kbd{:copy [z]}
3621 @findex @kbd{:t [z]} 3634 @findex @kbd{:t [z]}
3622 @findex @kbd{:move [z]} 3635 @findex @kbd{:move [z]}
3672 @samp{confirm} (type @samp{y} to confirm a particular 3685 @samp{confirm} (type @samp{y} to confirm a particular
3673 substitution, else @samp{n}). Instead of @kbd{/} any 3686 substitution, else @samp{n}). Instead of @kbd{/} any
3674 punctuation character other than <space> <tab> and <lf> can be used as 3687 punctuation character other than <space> <tab> and <lf> can be used as
3675 delimiter. 3688 delimiter.
3676 @item & 3689 @item &
3677 Repeat latest Ex substitute command, e.g. @kbd{:s/wrong/good}. 3690 Repeat latest Ex substitute command, e.g. @kbd{:s/wrong/right}.
3678 @item :global /<pattern>/<ex-command> 3691 @item :global /<pattern>/<ex-command>
3679 @itemx :g /<pattern>/<ex-command> 3692 @itemx :g /<pattern>/<ex-command>
3680 Execute <ex-command> on all lines that match <pattern>. 3693 Execute <ex-command> on all lines that match <pattern>.
3681 @item :vglobal /<pattern>/<ex-command> 3694 @item :vglobal /<pattern>/<ex-command>
3682 @itemx :v /<pattern>/<ex-command> 3695 @itemx :v /<pattern>/<ex-command>
4333 mrb@@Eng.Sun.COM (Martin Buchholz), 4346 mrb@@Eng.Sun.COM (Martin Buchholz),
4334 kwzh@@gnu.ai.mit.edu (Karl Heuer), 4347 kwzh@@gnu.ai.mit.edu (Karl Heuer),
4335 sudish@@MindSpring.COM (Sudish Joseph), 4348 sudish@@MindSpring.COM (Sudish Joseph),
4336 paulk@@summit.esg.apertus.com (Paul Keusemann), 4349 paulk@@summit.esg.apertus.com (Paul Keusemann),
4337 roderick@@argon.org (Roderick Schertler), 4350 roderick@@argon.org (Roderick Schertler),
4338 johnw@@borland.com (John Wiegley) 4351 johnw@@borland.com (John Wiegley),
4352 zapman@@cc.gatech.edu (Jason Zapman II)
4339 @end example 4353 @end example
4340 4354
4341 4355
4342 @node Key Index,Function Index,,Top 4356 @node Key Index,Function Index,,Top
4343 @comment node-name, next, previous, up 4357 @comment node-name, next, previous, up