comparison man/viper.texi @ 78:c7528f8e288d r20-0b34

Import from CVS: tag r20-0b34
author cvs
date Mon, 13 Aug 2007 09:05:42 +0200
parents 131b0175ea99
children 1ce6082ce73f
comparison
equal deleted inserted replaced
77:6cb4f478e7bc 78:c7528f8e288d
2 2
3 % 3 %
4 \input texinfo 4 \input texinfo
5 5
6 @comment Using viper.info instead of viper in setfilename breaks DOS. 6 @comment Using viper.info instead of viper in setfilename breaks DOS.
7 @setfilename ../info/viper.info 7 @setfilename viper
8 @comment @setfilename ../info/viper
8 @comment @setfilename viper.info 9 @comment @setfilename viper.info
9 10
10 @iftex 11 @iftex
11 @finalout 12 @finalout
12 @end iftex 13 @end iftex
286 The Meta key is usually located on each side of the Space bar; it is used 287 The Meta key is usually located on each side of the Space bar; it is used
287 in a manner similar to the Control key, e.g., @kbd{M-x} means typing 288 in a manner similar to the Control key, e.g., @kbd{M-x} means typing
288 @kbd{x} while holding the Meta key down. 289 @kbd{x} while holding the Meta key down.
289 For keyboards that do not have a Meta key, @key{ESC} is used as Meta. 290 For keyboards that do not have a Meta key, @key{ESC} is used as Meta.
290 Thus @kbd{M-x} is typed as @kbd{ESC x}. Viper uses @key{ESC} to switch 291 Thus @kbd{M-x} is typed as @kbd{ESC x}. Viper uses @key{ESC} to switch
291 from Insert state to Vi state. Therefore Viper defines @kbd{_} as its Meta 292 from Insert state to Vi state. Therefore Viper defines @kbd{C-\} as its Meta
292 key in Vi state. @xref{Vi State}, for more info.@refill 293 key in Vi state. @xref{Vi State}, for more info.@refill
293 294
294 Emacs is structured as a lisp interpreter around a C core. Emacs keys 295 Emacs is structured as a lisp interpreter around a C core. Emacs keys
295 cause lisp functions to be called. It is possible to call these 296 cause lisp functions to be called. It is possible to call these
296 functions directly, by typing @kbd{M-x function-name}. 297 functions directly, by typing @kbd{M-x function-name}.
374 @kbd{:vi}, and similar old-style Vi commands.)@refill 375 @kbd{:vi}, and similar old-style Vi commands.)@refill
375 376
376 @node States in Viper, The Minibuffer, Loading Viper,Overview 377 @node States in Viper, The Minibuffer, Loading Viper,Overview
377 @section States in Viper 378 @section States in Viper
378 379
379 @kindex @kbd{C-z}
380 @kindex @kbd{C-z} 380 @kindex @kbd{C-z}
381 @kindex @kbd{ESC} 381 @kindex @kbd{ESC}
382 @kindex @kbd{i} 382 @kindex @kbd{i}
383 @cindex Emacs state 383 @cindex Emacs state
384 @cindex Vi state 384 @cindex Vi state
440 browse directories, read mail, etc., from Emacs (which you should start 440 browse directories, read mail, etc., from Emacs (which you should start
441 doing soon!), you should learn about the meaning of the various keys in 441 doing soon!), you should learn about the meaning of the various keys in
442 those special modes (typing @kbd{C-h m} in a buffer provides 442 those special modes (typing @kbd{C-h m} in a buffer provides
443 help with key bindings for the major mode of that buffer). 443 help with key bindings for the major mode of that buffer).
444 444
445 If you switch to Vi in Dired or similar modes---no harm is 445 If you switch to Vi in Dired or similar modes---no harm is done. It is just
446 done. It is just that 446 that the special keybindings provided by those modes will be temporarily
447 the special keybindings provided by those modes will be temporarily 447 overshadowed by Viper's bindings. Switching back to Viper's Emacs state
448 overshadowed by Viper's bindings. Switching back to Viper's 448 will revive the environment provided by the current major mode.
449 Emacs state will revive the environment provided by the current major mode.
450 449
451 States in Viper are orthogonal to Emacs major modes, such as C mode or Dired 450 States in Viper are orthogonal to Emacs major modes, such as C mode or Dired
452 mode. You can turn Viper on and off for any Emacs state. When Viper is turned 451 mode. You can turn Viper on and off for any Emacs state. When Viper is turned
453 on, Vi state can be used to move around. In Insert state, the bindings for 452 on, Vi state can be used to move around. In Insert state, the bindings for
454 these modes can be accessed. For beginners (users at Viper levels 1 and 2), 453 these modes can be accessed. For beginners (users at Viper levels 1 and 2),
478 @cindex Emacs state 477 @cindex Emacs state
479 478
480 479
481 You will be in this mode only by accident (hopefully). This is the state 480 You will be in this mode only by accident (hopefully). This is the state
482 Emacs is normally in (imagine!!). Now leave it as soon as possible by 481 Emacs is normally in (imagine!!). Now leave it as soon as possible by
483 typing @kbd{C-z}. The you will be in Vi state (sigh of relief) :-). 482 typing @kbd{C-z}. Then you will be in Vi state (sigh of relief) :-).
484 483
485 Emacs state is actually a Viperism to denote all the major and minor modes 484 Emacs state is actually a Viperism to denote all the major and minor modes
486 (@xref{Emacs Preliminaries}) other than Viper that Emacs can be in. Emacs 485 (@xref{Emacs Preliminaries}) other than Viper that Emacs can be in. Emacs
487 can have several modes, such as C mode for editing C programs, LaTeX mode 486 can have several modes, such as C mode for editing C programs, LaTeX mode
488 for editing LaTeX documents, Dired for directory editing, etc. These are 487 for editing LaTeX documents, Dired for directory editing, etc. These are
497 @kbd{C-c} are also available in Vi state. This is important because major 496 @kbd{C-c} are also available in Vi state. This is important because major
498 modes designed for editing files, such as cc-mode or latex-mode, use key 497 modes designed for editing files, such as cc-mode or latex-mode, use key
499 sequences that begin with @kbd{C-x} and @kbd{C-c}. 498 sequences that begin with @kbd{C-x} and @kbd{C-c}.
500 499
501 There is also a key that lets you temporarily escape to Vi command state 500 There is also a key that lets you temporarily escape to Vi command state
502 from Emacs state: typing @kbd{M-C-z} (or @kbd{ESC C-z}) will let 501 from Emacs or Insert states: typing @kbd{C-c \} will let you execute a
503 you execute a single Vi command while staying in Viper's Emacs state. 502 single Vi command while staying in Viper's Emacs or Insert state.
504 At present, this works only for 1-character Vi commands (and for some 503 In Insert state, the same can also be achieved by typing @kbd{C-z}.
505 complex commands). 504
506 505
507 @node Vi State, Insert State, Emacs State, States in Viper 506 @node Vi State, Insert State, Emacs State, States in Viper
508 @subsection Vi State 507 @subsection Vi State
509 508
510 @cindex Vi state 509 @cindex Vi state
542 @xref{Recursive Edit,Recursive 541 @xref{Recursive Edit,Recursive
543 Edit,Recursive Edit,emacs,The GNU Emacs Manual}. 542 Edit,Recursive Edit,emacs,The GNU Emacs Manual}.
544 At user level 1, @kbd{C-g} is bound to @code{vip-info-on-file} 543 At user level 1, @kbd{C-g} is bound to @code{vip-info-on-file}
545 function instead. 544 function instead.
546 @refill 545 @refill
547 @item Underscore 546 @item C-\
548 @kindex @kbd{_} 547 @kindex @kbd{C-\}
549 @cindex Meta key 548 @cindex Meta key
550 549
551 Viper uses @kbd{ESC} as a switch between Insert and Vi states. Emacs uses 550 Viper uses @kbd{ESC} as a switch between Insert and Vi states. Emacs uses
552 @kbd{ESC} for Meta. We need a Meta key to call the Meta key functions 551 @kbd{ESC} for Meta. We need a Meta key to call the Meta key functions
553 such as @kbd{M-x function name}. The underscore key, @kbd{_}, was chosen, 552 such as @kbd{M-x function name}. This role is played by the key @kbd{C-\}.
554 since it is the only reasonable, free Vi key left. Thus, in Vi state, to 553 Thus, to
555 get @kbd{M-x}, you should type @kbd{_x} (if the keyboard has no Meta key). 554 get @kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no Meta key).
555 This works both in the Vi state and the Insert state.
556 Alternatively, you can use @kbd{\ ESC} in Vi state to simulate the meta
557 key.
556 It is possible to use @kbd{ESC} as Meta, but then you cannot 558 It is possible to use @kbd{ESC} as Meta, but then you cannot
557 press @kbd{ESC} multiple times in Vi state. @xref{Customization}, to find 559 press @kbd{ESC} multiple times in Vi state. @xref{Customization}, to find
558 out how to rebind ESC to be Meta.@refill 560 out how to rebind ESC to be Meta.@refill
559 @end table 561 @end table
560 @noindent 562 @noindent
696 which are more appropriate in the minibuffer.) 698 which are more appropriate in the minibuffer.)
697 699
698 700
699 @cindex Meta key 701 @cindex Meta key
700 702
701 You can call Meta functions from Insert state. The Vi-to-Emacs toggle key, 703 You can call Meta functions from Insert state. As in Vi state, the Meta key
702 normally @kbd{C-z}, is bound to Meta in Insert state. Thus @kbd{M-x} is 704 is @kbd{C-\}. Thus @kbd{M-x} is typed as @kbd{C-\ x}.
703 typed as @kbd{C-zx}. The key @kbd{_} will now insert itself---it is not a
704 Meta key in Insert state. (It is well understood that switching Meta keys
705 around is inconvenient. However, there seems to be no way around this
706 problem, short of changing Vi ESC key to something
707 else. @xref{Customization}, for the information on @code{vip-ESC-key}, which
708 can be used to free up @kbd{ESC} and designate some other key to do escape
709 from Insert state to Vi state.)
710 705
711 Other Emacs commands that are useful in Insert state are @kbd{C-e} 706 Other Emacs commands that are useful in Insert state are @kbd{C-e}
712 and @kbd{C-a}, which move the cursor to the end and the beginning of the 707 and @kbd{C-a}, which move the cursor to the end and the beginning of the
713 current line, respectively. You can also use @kbd{M-f} and @kbd{M-b}, 708 current line, respectively. You can also use @kbd{M-f} and @kbd{M-b},
714 which move the cursor forward (or backward) one word. 709 which move the cursor forward (or backward) one word.
715 If your display has a Meta key, these functions are invoked by holding the 710 If your display has a Meta key, these functions are invoked by holding the
716 Meta key and then typing @kbd{f} and @kbd{b}, respectively. On displays 711 Meta key and then typing @kbd{f} and @kbd{b}, respectively. On displays
717 without the Meta key, these functions are invoked by typing 712 without the Meta key, these functions are invoked by typing
718 @kbd{C-z f} and @kbd{C-z b} (@kbd{C-z} simulates the Meta key in Insert 713 @kbd{C-\ f} and @kbd{C-\ b} (@kbd{C-\} simulates the Meta key in Insert
719 state, as explained above). 714 state, as explained above).
720 715
721 When Viper is in Insert state, you will see <I> in the mode line. 716 When Viper is in Insert state, you will see <I> in the mode line.
722 717
723 @node Replace State,, Insert State, States in Viper 718 @node Replace State,, Insert State, States in Viper
1171 them. This is done through what is known as @emph{faces} in Emacs. The 1166 them. This is done through what is known as @emph{faces} in Emacs. The
1172 variable that controls how search patterns are highlighted is 1167 variable that controls how search patterns are highlighted is
1173 @code{vip-search-face}. 1168 @code{vip-search-face}.
1174 If you don't want any highlighting at all, put 1169 If you don't want any highlighting at all, put
1175 @example 1170 @example
1176 (copy-face 'default 'vip-search-face) 1171 (setq vip-search-face 'default)
1177 @end example 1172 @end example
1178 @vindex @code{vip-search-face} 1173 @vindex @code{vip-search-face}
1179 @noindent 1174 @noindent
1180 in @file{~/.vip}. If you want to change how patterns are highlighted, you 1175 in @file{~/.vip}. If you want to change how patterns are highlighted, you
1181 will have to set the variable @code{vip-search-face} to some other face, 1176 will have to set the variable @code{vip-search-face} to some other face,
1182 such as @code{highlight}. If none of the existing faces fits the bill, you 1177 such as @code{highlight}. If none of the existing faces fits the bill, you
1183 may have to create your own. Further details on faces can be found 1178 would have to create your own. Further details on faces can be found
1184 in the Emacs Lisp Manual. 1179 in the Emacs Lisp Manual.
1185 1180
1186 @node Abbreviation Facilities,Movement and Markers,Improved Search,Improvements over Vi 1181 @node Abbreviation Facilities,Movement and Markers,Improved Search,Improvements over Vi
1187 @section Abbreviation Facilities 1182 @section Abbreviation Facilities
1188 1183
1254 the value can be @code{'reformed-vi} or @code{'emacs}. 1249 the value can be @code{'reformed-vi} or @code{'emacs}.
1255 1250
1256 Changes to @code{vip-syntax-preference} should be done in the hooks to 1251 Changes to @code{vip-syntax-preference} should be done in the hooks to
1257 various major modes. Furthermore, for these changes to take effect, you 1252 various major modes. Furthermore, for these changes to take effect, you
1258 should execute @code{(vip-update-alphanumeric-class)} right after changing 1253 should execute @code{(vip-update-alphanumeric-class)} right after changing
1254 the value of @code{vip-syntax-preference}.
1259 1255
1260 The above discussion of the meaning of Viper's words concerns only Viper's 1256 The above discussion of the meaning of Viper's words concerns only Viper's
1261 movement commands. In regular expressions, words remain the same as in 1257 movement commands. In regular expressions, words remain the same as in
1262 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use 1258 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use
1263 Emacs' idea of what is a word, and they don't look into the value of 1259 Emacs' idea of what is a word, and they don't look into the value of
1280 @table @kbd 1276 @table @kbd
1281 @item C-x, C-c 1277 @item C-x, C-c
1282 @kindex @kbd{C-x} 1278 @kindex @kbd{C-x}
1283 @kindex @kbd{C-c} 1279 @kindex @kbd{C-c}
1284 @kbd{C-x} will exit from Vi state and return to Emacs state 1280 @kbd{C-x} will exit from Vi state and return to Emacs state
1285 @emph{temporarily}. If 1281 @emph{temporarily}. If you hit one of these keys, Emacs will believe
1286 you hit one of these keys, Emacs will believe
1287 that you hit that key in Emacs state. For example, if you hit @kbd{C-x} 1282 that you hit that key in Emacs state. For example, if you hit @kbd{C-x}
1288 followed by @kbd{2}, then the current window will be split into 2 and you 1283 followed by @kbd{2}, then the current window will be split into 2 and you
1289 will be in Vi state again. Except for novice users, @kbd{C-c} is also set 1284 will be in Vi state again. Except for novice users, @kbd{C-c} is also set
1290 to temporarily escape to Emacs and execute a command from the current 1285 to temporarily escape to Emacs and execute a command from the current
1291 major mode. 1286 major mode.
1292 @kbd{ESC} will do the same, if 1287 @kbd{ESC} will do the same, if
1293 you configure @key{ESC} as Meta by setting @code{vip-no-multiple-ESC} to nil 1288 you configure @key{ESC} as Meta by setting @code{vip-no-multiple-ESC} to nil
1294 in @file{.vip}. @xref{Customization}. @kbd{C-z} 1289 in @file{.vip}. @xref{Customization}. @kbd{C-\}
1295 in Insert state will make Emacs think @kbd{Meta} has been hit.@refill 1290 in Insert or Vi states will make Emacs think @kbd{Meta} has been hit.@refill
1296 @item \ 1291 @item \
1297 @kindex @kbd{\} 1292 @kindex @kbd{\}
1298 Escape to Emacs to execute a single Emacs command. For instance, @kbd{\ 1293 Escape to Emacs to execute a single Emacs command. For instance, @kbd{\
1299 ESC} will act like a Meta key. 1294 ESC} will act like a Meta key.
1300 @item Q 1295 @item Q
1383 Go to end of heading. 1378 Go to end of heading.
1384 @item g <@emph{movement command}> 1379 @item g <@emph{movement command}>
1385 Search buffer for text delimited by movement command. The canonical 1380 Search buffer for text delimited by movement command. The canonical
1386 example is @kbd{gw} to search for the word under the cursor. 1381 example is @kbd{gw} to search for the word under the cursor.
1387 @xref{Improved Search}, for details.@refill 1382 @xref{Improved Search}, for details.@refill
1388 @item _
1389 @kindex @kbd{_}
1390 Meta key when in Vi state.@xref{Vi State}, for an explanation.
1391 @item C-g and C-] 1383 @item C-g and C-]
1392 @kindex @kbd{C-g} 1384 @kindex @kbd{C-g}
1393 @kindex @kbd{C-]} 1385 @kindex @kbd{C-]}
1394 Quit and Abort Recursive edit. These may be necessary on occasion. 1386 Quit and Abort Recursive edit. These may be necessary on occasion.
1395 @xref{Vi State}, for a reason. 1387 @xref{Vi State}, for a reason.
1519 @item Syntactic Highlighting 1511 @item Syntactic Highlighting
1520 @cindex hilit19 1512 @cindex hilit19
1521 @pindex hilit19.el 1513 @pindex hilit19.el
1522 @cindex font-lock 1514 @cindex font-lock
1523 @pindex font-lock.el 1515 @pindex font-lock.el
1524 @code{hilit19.el} and @code{font-lock.el} for automatic highlighting 1516 @code{font-lock.el} for automatic highlighting various parts of a buffer
1525 various parts of a buffer
1526 using different fonts and colors. 1517 using different fonts and colors.
1527 @item Saving Emacs Configuration 1518 @item Saving Emacs Configuration
1528 @cindex desktop 1519 @cindex desktop
1529 @pindex desktop.el 1520 @pindex desktop.el
1530 @code{desktop.el} for saving/restoring configuration on Emacs exit/startup. 1521 @code{desktop.el} for saving/restoring configuration on Emacs exit/startup.
1618 appropriate major modes. 1609 appropriate major modes.
1619 1610
1620 @kbd{:se ai} changes the value of @code{vip-auto-indent} in the current 1611 @kbd{:se ai} changes the value of @code{vip-auto-indent} in the current
1621 buffer only; @kbd{:se gai} does the same globally. 1612 buffer only; @kbd{:se gai} does the same globally.
1622 @item vip-electric-mode t 1613 @item vip-electric-mode t
1623 If @code{t}, auto-indentation becomes electric, which means that @kbd{RET}, 1614 If not @code{nil}, auto-indentation becomes electric, which means that
1624 @kbd{O}, and @kbd{o} indent cursor according to the current major mode. In 1615 @kbd{RET}, @kbd{O}, and @kbd{o} indent cursor according to the current
1625 the future, this variable may control additional electric features. 1616 major mode. In the future, this variable may control additional electric
1617 features.
1626 1618
1627 This is a local variable: @code{setq} changes the value of this variable 1619 This is a local variable: @code{setq} changes the value of this variable
1628 in the current buffer only. Use @code{setq-default} to change the value in 1620 in the current buffer only. Use @code{setq-default} to change the value in
1629 all buffers. 1621 all buffers.
1630 @item vip-case-fold-search nil 1622 @item vip-case-fold-search nil
1631 @itemx :se ic (:se ignorecase) 1623 @itemx :se ic (:se ignorecase)
1632 If @code{t}, search ignores cases. 1624 If not @code{nil}, search ignores cases.
1633 This can also be toggled by quickly hitting @kbd{/} twice. 1625 This can also be toggled by quickly hitting @kbd{/} twice.
1634 @item vip-re-search nil 1626 @item vip-re-search nil
1635 @itemx :se magic 1627 @itemx :se magic
1636 If @code{t} then search is reg-exp search, if @code{nil} then vanilla 1628 If not @code{nil}, search will use regular expressions; if @code{nil} then
1637 search. 1629 use vanilla search.
1638 This behavior can also be toggled by quickly hitting @kbd{/} trice. 1630 This behavior can also be toggled by quickly hitting @kbd{/} trice.
1639 @item buffer-read-only 1631 @item buffer-read-only
1640 @itemx :se ro (:se readonly) 1632 @itemx :se ro (:se readonly)
1641 Set current buffer to read only. To change globally put 1633 Set current buffer to read only. To change globally put
1642 @code{(setq-default buffer-read-only t)} in your @file{.emacs} file. 1634 @code{(setq-default buffer-read-only t)} in your @file{.emacs} file.
1671 @item vip-shift-width 8 1663 @item vip-shift-width 8
1672 @itemx :se sw=value (:se shiftwidth=value) 1664 @itemx :se sw=value (:se shiftwidth=value)
1673 The number of columns shifted by @kbd{>} and @kbd{<} commands. 1665 The number of columns shifted by @kbd{>} and @kbd{<} commands.
1674 @item vip-search-wrap-around t 1666 @item vip-search-wrap-around t
1675 @itemx :se ws (:se wrapscan) 1667 @itemx :se ws (:se wrapscan)
1676 If @code{t}, search wraps around the end/beginning of buffer. 1668 If not @code{nil}, search wraps around the end/beginning of buffer.
1669 @item vip-adjust-window-after-search t
1670 If not @code{nil}, window will be pulled up or down, as appropriate, if
1671 search lands near the first (or last) line of the window.
1677 @item vip-tags-file-name "TAGS" 1672 @item vip-tags-file-name "TAGS"
1678 The name of the file used as the tag table. 1673 The name of the file used as the tag table.
1679 @item vip-re-query-replace nil 1674 @item vip-re-query-replace nil
1680 If @code{t}, use reg-exp replace in query replace. 1675 If not @code{nil}, use reg-exp replace in query replace.
1681 @item vip-want-ctl-h-help nil 1676 @item vip-want-ctl-h-help nil
1682 If @code{t}, @kbd{C-h} is bound to @code{help-command}; 1677 If not @code{nil}, @kbd{C-h} is bound to @code{help-command};
1683 if @code{nil}, it is bound to @code{delete-backward-char}. 1678 if @code{nil}, it is bound to @code{delete-backward-char}.
1684 @item vip-vi-style-in-minibuffer t 1679 @item vip-vi-style-in-minibuffer t
1685 If @code{t}, Viper provides a high degree of compatibility with Vi insert mode 1680 If not @code{nil}, Viper provides a high degree of compatibility with Vi
1686 when you type text in the Minibuffer; if @code{nil}, typing in the 1681 insert mode when you type text in the Minibuffer; if @code{nil}, typing in
1687 Minibuffer feels like plain Emacs. 1682 the Minibuffer feels like plain Emacs.
1688 @item vip-no-multiple-ESC t 1683 @item vip-no-multiple-ESC t
1689 If you set this to @code{nil}, you can use @kbd{ESC} as Meta in Vi state. 1684 If you set this to @code{nil}, you can use @kbd{ESC} as Meta in Vi state.
1690 Normally, this is not necessary, since graphical displays have separate 1685 Normally, this is not necessary, since graphical displays have separate
1691 Meta keys (usually on each side of the space bar). On a dumb terminal, Viper 1686 Meta keys (usually on each side of the space bar). On a dumb terminal, Viper
1692 sets this variable to @code{twice}, which is almost like @code{nil}, except 1687 sets this variable to @code{twice}, which is almost like @code{nil}, except
1701 Making this value too large will slow you down, so exercise restraint. 1696 Making this value too large will slow you down, so exercise restraint.
1702 @item vip-ex-style-motion t 1697 @item vip-ex-style-motion t
1703 Set this to @code{nil}, if you want @kbd{l,h} to cross 1698 Set this to @code{nil}, if you want @kbd{l,h} to cross
1704 lines, etc. @xref{Movement and Markers}, for more info. 1699 lines, etc. @xref{Movement and Markers}, for more info.
1705 @item vip-ex-style-editing-in-insert t 1700 @item vip-ex-style-editing-in-insert t
1706 Set this to @code{nil}, if you want @kbd{ESC} to not move back and 1701 Set this to to @code{nil}, if you want @kbd{ESC} to not move back and
1707 @kbd{C-h} to not stop 1702 @kbd{C-h} to not stop
1708 at the beginning of a line in Insert state. 1703 at the beginning of a line in Insert state.
1709 @item vip-always t 1704 @item vip-always t
1710 Leave it to Viper to decide when a buffer must be brought up in Vi state, 1705 Leave it to Viper to decide when a buffer must be brought up in Vi state,
1711 Insert state, or Emacs state. This heuristics works well in virtually all 1706 Insert state, or Emacs state. This heuristics works well in virtually all
1732 @code{vip-ex-nontrivial-find-file-ms} as examples. 1727 @code{vip-ex-nontrivial-find-file-ms} as examples.
1733 @vindex @code{ex-nontrivial-find-file-function}. 1728 @vindex @code{ex-nontrivial-find-file-function}.
1734 @findex @code{vip-ex-nontrivial-find-file-ms} 1729 @findex @code{vip-ex-nontrivial-find-file-ms}
1735 @findex @code{vip-ex-nontrivial-find-file-unix} 1730 @findex @code{vip-ex-nontrivial-find-file-unix}
1736 @item ex-cycle-other-window t 1731 @item ex-cycle-other-window t
1737 If @code{t}, @kbd{:n} and @kbd{:b} will cycle through files in another 1732 If not @code{nil}, @kbd{:n} and @kbd{:b} will cycle through files in another
1738 window, if one exists. 1733 window, if one exists.
1739 @item ex-cycle-through-non-files nil 1734 @item ex-cycle-through-non-files nil
1740 @kbd{:n} does not normally cycle through buffers. Set this to get 1735 @kbd{:n} does not normally cycle through buffers. Set this to get
1741 buffers also. 1736 buffers also.
1742 @item vip-automatic-iso-accents nil 1737 @item vip-automatic-iso-accents nil
1760 If set to @code{nil}, complete Vi compatibility is provided 1755 If set to @code{nil}, complete Vi compatibility is provided
1761 in Vi command state. Setting this to @code{nil} is really a bad idea, 1756 in Vi command state. Setting this to @code{nil} is really a bad idea,
1762 unless you are a novice, as this precludes the use 1757 unless you are a novice, as this precludes the use
1763 of language-specific features provided by the major modes. 1758 of language-specific features provided by the major modes.
1764 @item vip-keep-point-on-repeat t 1759 @item vip-keep-point-on-repeat t
1765 If @code{t}, point is not moved when the user repeats the previous command 1760 If not @code{nil}, point is not moved when the user repeats the previous
1766 by typing `.' This is very useful for doing repeated changes with the 1761 command by typing `.' This is very useful for doing repeated changes with
1767 @kbd{.} key. 1762 the @kbd{.} key.
1768 @item vip-repeat-from-history-key 'f12 1763 @item vip-repeat-from-history-key 'f12
1769 Prefix key used to invoke the macros @kbd{f12 1} and @kbd{f12 2} that repeat 1764 Prefix key used to invoke the macros @kbd{f12 1} and @kbd{f12 2} that repeat
1770 the second-last and the third-last destructive command. 1765 the second-last and the third-last destructive command.
1771 Both these macros are bound (as Viper macros) to 1766 Both these macros are bound (as Viper macros) to
1772 @code{vip-repeat-from-history}, 1767 @code{vip-repeat-from-history},
1773 which checks the second key by which it is invoked to see which of the 1768 which checks the second key by which it is invoked to see which of the
1774 previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only, 1769 previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only,
1775 but the user can bind more in @file{~/.vip}. @xref{Vi Macros}, for how to do 1770 but the user can bind more in @file{~/.vip}. @xref{Vi Macros}, for how to do
1776 this. 1771 this.
1777 @item vip-keep-point-on-undo nil 1772 @item vip-keep-point-on-undo nil
1778 If @code{t}, Viper tries to not move point when undoing commands. 1773 If not @code{nil}, Viper tries to not move point when undoing commands.
1779 Instead, it will briefly move the cursor to the place where change has 1774 Instead, it will briefly move the cursor to the place where change has
1780 taken place. However, if the undone piece of text is not seen in window, 1775 taken place. However, if the undone piece of text is not seen in window,
1781 then point will be moved to the place where the change took place. 1776 then point will be moved to the place where the change took place.
1782 Set it to @code{t} and see if you like it better. 1777 Set it to @code{t} and see if you like it better.
1783 @item vip-delete-backwards-in-replace nil 1778 @item vip-delete-backwards-in-replace nil
1784 If @code{t}, DEL key will delete characters while moving the cursor backwards. 1779 If not @code{nil}, DEL key will delete characters while moving the cursor
1785 If @code{nil}, the cursor will move backwards without deleting anything. 1780 backwards. If @code{nil}, the cursor will move backwards without deleting
1781 anything.
1786 @item vip-replace-overlay-face 'vip-replace-overlay-face 1782 @item vip-replace-overlay-face 'vip-replace-overlay-face
1783 @itemx vip-replace-overlay-pixmap "grey3"
1787 On a graphical display, Viper highlights replacement regions instead of 1784 On a graphical display, Viper highlights replacement regions instead of
1788 putting a @samp{$} at the end. This variable controls the so called 1785 putting a @samp{$} at the end. This variable controls the so called
1789 @dfn{face} used to highlight the region. 1786 @dfn{face} used to highlight the region.
1790 1787
1791 By default, @code{vip-replace-overlay-face} underlines the replacement 1788 By default, @code{vip-replace-overlay-face} underlines the replacement on
1792 on monochrome displays and highlights it with color on color displays. 1789 monochrome displays and also lays a pixmap over them (as specified in the
1793 If you know something about Emacs 1790 variable @code{vip-replace-overlay-pixmap}. On color displays, replacement
1794 faces and don't like how Viper highlights replacement regions, you can change 1791 regions are highlighted with color.
1795 this variable to specify a new face name. (Emacs faces are described in the 1792
1796 Emacs Lisp reference.) 1793 If you know something about Emacs faces and don't like how Viper highlights
1797 On a color display, the following customization method is usually 1794 replacement regions, you can change @code{vip-replace-overlay-face} by
1798 most effective: 1795 specifying a new face. (Emacs faces are described in the Emacs Lisp
1796 reference.) On a color display, the following customization method is
1797 usually most effective:
1799 @example 1798 @example
1800 (set-face-foreground vip-replace-overlay-face "DarkSlateBlue") 1799 (set-face-foreground vip-replace-overlay-face "DarkSlateBlue")
1801 (set-face-background vip-replace-overlay-face "yellow") 1800 (set-face-background vip-replace-overlay-face "yellow")
1802 @end example 1801 @end example
1803 For a complete list of colors available to you, evaluate the 1802 For a complete list of colors available to you, evaluate the expression
1804 expression @code{(x-defined-colors)}. (Type it in the buffer @code{*scratch*} 1803 @code{(x-defined-colors)}. (Type it in the buffer @code{*scratch*} and then
1805 and then hit the @kbd{C-j} key. 1804 hit the @kbd{C-j} key.
1805
1806 On a monochrome display, you can change the value of the variable
1807 @code{vip-replace-overlay-pixmap} to specify the pixmap of your choice
1808 (which should be a string denoting the file name of the pixmap). Emacs
1809 takes pixmaps from the directory specified in the variable
1810 @code{x-bitmap-file-path}.
1806 @item vip-replace-overlay-cursor-color "Red" 1811 @item vip-replace-overlay-cursor-color "Red"
1812 @vindex @code{vip-replace-overlay-cursor-color}
1807 Cursor color when it is inside the replacement region. 1813 Cursor color when it is inside the replacement region.
1808 This has effect only on color displays and only when Emacs runs as an X 1814 This has effect only on color displays and only when Emacs runs as an X
1809 application. 1815 application.
1816 @item vip-insert-state-cursor-color nil
1817 @vindex @code{vip-insert-state-cursor-color}
1818 If set to a valid color, this will be the cursor color when Viper is in
1819 insert state.
1810 @item vip-replace-region-end-delimiter "$" 1820 @item vip-replace-region-end-delimiter "$"
1811 A string used to mark the end of replacement regions. It is used only with 1821 A string used to mark the end of replacement regions. It is used only on
1812 TTYs or if @code{vip-use-replace-region-delimiters} is non-nil. 1822 TTYs or if @code{vip-use-replace-region-delimiters} is non-nil.
1813 @item vip-replace-region-start-delimiter "" 1823 @item vip-replace-region-start-delimiter ""
1814 A string used to mark the beginning of replacement regions. It is used 1824 A string used to mark the beginning of replacement regions. It is used
1815 only with TTYs or if @code{vip-use-replace-region-delimiters} is non-nil. 1825 only on TTYs or if @code{vip-use-replace-region-delimiters} is non-nil.
1816 @item vip-use-replace-region-delimiters 1826 @item vip-use-replace-region-delimiters
1817 If non-nil, Viper will always use @code{vip-replace-region-end-delimiter} and 1827 If non-nil, Viper will always use @code{vip-replace-region-end-delimiter} and
1818 @code{vip-replace-region-start-delimiter} to delimit replacement regions, 1828 @code{vip-replace-region-start-delimiter} to delimit replacement regions,
1819 even on color displays (where this is unnecessary). By default, this 1829 even on color displays (where this is unnecessary). By default, this
1820 variable is non-nil only on TTYs or monochrome displays. 1830 variable is non-nil only on TTYs or monochrome displays.
1821 @item vip-toggle-key "\C-z" 1831 @item vip-toggle-key "\C-z"
1822 Specifies the key used to switch from Emacs to Vi and back. 1832 Specifies the key used to switch from Emacs to Vi and back.
1823 Must be set in @file{.vip} or prior to loading Viper. This variable can't be 1833 Must be set in @file{.vip} or prior to loading Viper. This variable can't be
1824 changed interactively after Viper is loaded. 1834 changed interactively after Viper is loaded.
1835
1836 In Insert state, this key acts as a temporary escape to Vi state, i.e., it
1837 will set Viper up so that the very next command will be executed as if it
1838 were typed in Vi state.
1825 @item vip-ESC-key "\e" 1839 @item vip-ESC-key "\e"
1826 Specifies the key used to escape from Insert/Replace states to Vi. 1840 Specifies the key used to escape from Insert/Replace states to Vi.
1827 Must be set in @file{.vip} or prior to loading Viper. This variable cannot be 1841 Must be set in @file{.vip} or prior to loading Viper. This variable cannot be
1828 changed interactively after Viper is loaded. 1842 changed interactively after Viper is loaded.
1829 @item vip-buffer-search-char nil 1843 @item vip-buffer-search-char nil
1862 @vindex @code{vip-case-fold-search} 1876 @vindex @code{vip-case-fold-search}
1863 @vindex @code{vip-re-search} 1877 @vindex @code{vip-re-search}
1864 @vindex @code{vip-shift-width} 1878 @vindex @code{vip-shift-width}
1865 @vindex @code{buffer-read-only} 1879 @vindex @code{buffer-read-only}
1866 @vindex @code{vip-search-wrap-around} 1880 @vindex @code{vip-search-wrap-around}
1881 @vindex @code{vip-adjust-window-after-search}
1867 @vindex @code{vip-search-face} 1882 @vindex @code{vip-search-face}
1868 @vindex @code{vip-tags-file-name} 1883 @vindex @code{vip-tags-file-name}
1869 @vindex @code{vip-re-query-replace} 1884 @vindex @code{vip-re-query-replace}
1870 @vindex @code{vip-want-ctl-h-help} 1885 @vindex @code{vip-want-ctl-h-help}
1871 @vindex @code{vip-vi-style-in-minibuffer} 1886 @vindex @code{vip-vi-style-in-minibuffer}
1883 @vindex @code{vip-want-emacs-keys-in-vi} 1898 @vindex @code{vip-want-emacs-keys-in-vi}
1884 @vindex @code{vip-keep-point-on-repeat} 1899 @vindex @code{vip-keep-point-on-repeat}
1885 @vindex @code{vip-keep-point-on-undo} 1900 @vindex @code{vip-keep-point-on-undo}
1886 @vindex @code{vip-delete-backwards-in-replace} 1901 @vindex @code{vip-delete-backwards-in-replace}
1887 @vindex @code{vip-replace-overlay-face} 1902 @vindex @code{vip-replace-overlay-face}
1903 @vindex @code{vip-replace-overlay-pixmap}
1888 @vindex @code{vip-replace-region-end-symbol} 1904 @vindex @code{vip-replace-region-end-symbol}
1889 @vindex @code{vip-replace-region-start-symbol} 1905 @vindex @code{vip-replace-region-start-symbol}
1890 @vindex @code{vip-toggle-key} 1906 @vindex @code{vip-toggle-key}
1891 @vindex @code{vip-ESC-key} 1907 @vindex @code{vip-ESC-key}
1892 @vindex @code{vip-buffer-search-char} 1908 @vindex @code{vip-buffer-search-char}
2165 We should note that on some non-windowing terminals, Shift doesn't modify 2181 We should note that on some non-windowing terminals, Shift doesn't modify
2166 the @kbd{TAB} key, so @kbd{S-tab} behaves as if it were @kbd{TAB}. In such 2182 the @kbd{TAB} key, so @kbd{S-tab} behaves as if it were @kbd{TAB}. In such
2167 a case, you will have to bind @code{vip-insert-tab} to some other 2183 a case, you will have to bind @code{vip-insert-tab} to some other
2168 convenient key. 2184 convenient key.
2169 2185
2170 Some packages, notably Dired, Gnus, Info, etc., attach special meaning 2186 Some packages, notably Dired, Gnus, Info, etc., attach special meaning to
2171 to common keys like @kbd{SPC}, @kbd{x}, @kbd{d}, @kbd{v}, and others. This 2187 common keys like @kbd{SPC}, @kbd{x}, @kbd{d}, @kbd{v}, and others. This
2172 means that Vi command state is inappropriate for working with these 2188 means that Vi command state is inappropriate for working with these
2173 packages. Fortunately, these modes operate on read-only buffers and are 2189 packages. Fortunately, these modes operate on read-only buffers and are
2174 designed not for editing files, but for special-purpose browsing, reading 2190 designed not for editing files, but for special-purpose browsing, reading
2175 news, mail, etc., and Vi commands are meaningless in these situations. For 2191 news, mail, etc., and Vi commands are meaningless in these situations. For
2176 this reason, Viper doesn't force Vi state on such major modes. Rather, it 2192 this reason, Viper doesn't force Vi state on such major modes. Rather, it
2177 brings them in Emacs state. You can switch to Vi state by typing @kbd{C-z} 2193 brings them in Emacs state. You can switch to Vi state by typing @kbd{C-z}
2178 if, for instance, you want to do Vi-style search in a buffer (although, 2194 if, for instance, you want to do Vi-style search in a buffer (although,
2179 usually, incremental search, which is bound to @kbd{C-s}, is sufficient in 2195 usually, incremental search, which is bound to @kbd{C-s}, is sufficient in
2180 these situations). But you should then switch back to Emacs state if you 2196 these situations). But you should then switch back to Emacs state if you
2181 plan to continue using these major modes productively. You can also switch 2197 plan to continue using these major modes productively. You can also switch
2182 to Vi temporarily, to execute one 1-character command. This is done by 2198 to Vi temporarily, to execute just one command. This is done by typing
2183 typing @kbd{M-C-z} (or @kbd{ESC C-z}). 2199 @kbd{C-c \}. (In some of these modes, @kbd{/} and @kbd{:} are bound
2184 This facility cannot execute several complex Vi commands, such as @kbd{dw}, 2200 Vi-style, unless these keys perform essential duties.)
2185 @kbd{de}, etc.
2186 2201
2187 It is also possible to harness some major modes, even though they may bind 2202 It is also possible to harness some major modes, even though they may bind
2188 common keys to specialized commands. Harnessing can make sense for modes 2203 common keys to specialized commands. Harnessing can make sense for modes
2189 that bind only a small number of common keys. For instance, if 2204 that bind only a small number of common keys. For instance, if
2190 @code{vip-always} is set to @code{t} in your @file{~/.vip} file, Viper will 2205 @code{vip-always} is set to @code{t} in your @file{~/.vip} file, Viper will
2280 will switch you from vanilla-style search to search via regular expressions. 2295 will switch you from vanilla-style search to search via regular expressions.
2281 If you hit something other than @kbd{/} after the first @kbd{/} or if the 2296 If you hit something other than @kbd{/} after the first @kbd{/} or if the
2282 second @kbd{/} doesn't follow quickly enough, then Viper will issue the 2297 second @kbd{/} doesn't follow quickly enough, then Viper will issue the
2283 usual prompt @kbd{/} and will wait for input, as usual in Vi. 2298 usual prompt @kbd{/} and will wait for input, as usual in Vi.
2284 If you don't like this behavior, you can ``unrecord'' these macros in your 2299 If you don't like this behavior, you can ``unrecord'' these macros in your
2285 @file{~/.vip} file. For instance, if u don't like the above feature, put 2300 @file{~/.vip} file. For instance, if you don't like the above feature, put
2286 this in @file{~/.vip}: 2301 this in @file{~/.vip}:
2287 @example 2302 @example
2288 (vip-unrecord-kbd-macro "//" 'vi-state) 2303 (vip-set-vi-search-style-macros 'undefine)
2289 (vip-unrecord-kbd-macro "///" 'vi-state) 2304 @end example
2290 @end example 2305 @findex @code{vip-set-vi-search-style-macros}
2291 @findex @code{vip-unrecord-kbd-macro} 2306
2292 2307 @item Vi-isms in Emacs state
2308 Some people find it useful to use the Vi-style search key, `/', to invoke
2309 search in modes which Viper leaves in emacs-state. These modes are:
2310 @code{dired-mode}, @code{mh-folder-mode}, @code{gnus-group-mode},
2311 @code{gnus-summary-mode}, @code{Info-mode}, and @code{Buffer-menu-mode}
2312 (more may be added in the future). So, in the above modes, Viper binds `/'
2313 so that it will behave Vi-style. Furthermore, in those major modes, Viper
2314 binds `:' to invoke ex-style commands, like in vi-state. And, as described
2315 above, `//' and `///' get bound to Vi-style macros that toggle
2316 case-insensitivity and regexp-search.
2317
2318 If you don't like these features---which I don't really understand---you
2319 can unbind `/' and `:' in @code{vip-dired-modifier-map} (for Dired) or in
2320 @code{vip-slash-and-colon-map}, for other modes.
2321 @vindex @code{vip-slash-and-colon-map}
2322 @vindex @code{vip-dired-modifier-map}
2323
2324 To unbind the macros `//' and `///' for a major mode where you feel they
2325 are undesirable, execute @code{vip-set-emacs-search-style-macros} with a
2326 non-nil argument. This can be done either interactively, by supplying a
2327 prefix argument, or by placing
2328 @example
2329 (vip-set-emacs-search-style-macros 'undefine)
2330 @end example
2331 @findex @code{vip-set-emacs-search-style-macros}
2332 in the hook to the major mode (e.g., @code{dired-mode-hook}).
2293 @xref{Vi Macros}, for more information on Vi macros. 2333 @xref{Vi Macros}, for more information on Vi macros.
2334
2294 @item vip-heading-start 2335 @item vip-heading-start
2295 @item vip-heading-end 2336 @item vip-heading-end
2296 @cindex headings 2337 @cindex headings
2297 @cindex sections 2338 @cindex sections
2298 @cindex paragraphs 2339 @cindex paragraphs
2411 (copy-face 'default 'vip-minibuffer-emacs-face) 2452 (copy-face 'default 'vip-minibuffer-emacs-face)
2412 @end example 2453 @end example
2413 in the @file{~/.vip} file. However, in that case, the user will not have any 2454 in the @file{~/.vip} file. However, in that case, the user will not have any
2414 indication of the current Viper state in the minibuffer. (This is important 2455 indication of the current Viper state in the minibuffer. (This is important
2415 if the user accidentally switches to another Viper state by typing @kbd{ESC} or 2456 if the user accidentally switches to another Viper state by typing @kbd{ESC} or
2416 @kbd{C-z}. 2457 @kbd{C-z}).
2417 @end table 2458 @end table
2418 2459
2419 @cindex Multifile documents and programs 2460 @cindex Multifile documents and programs
2420 2461
2421 Viper provides some support for multi-file documents and programs. 2462 Viper provides some support for multi-file documents and programs.
2915 terra@@diku.dk (Morten Welinder), 2956 terra@@diku.dk (Morten Welinder),
2916 kanze@@gabi-soft.fr (James Kanze), 2957 kanze@@gabi-soft.fr (James Kanze),
2917 hatazaki@@bach.convex.com (Takao Hatazaki), 2958 hatazaki@@bach.convex.com (Takao Hatazaki),
2918 sawdey@@lcse.umn.edu (Aaron Sawdey), 2959 sawdey@@lcse.umn.edu (Aaron Sawdey),
2919 jobrien@@hchp.org (John O'Brien), 2960 jobrien@@hchp.org (John O'Brien),
2920 mrb@@Eng.Sun.COM (Martin Buchholz) 2961 mrb@@Eng.Sun.COM (Martin Buchholz),
2962 kwzh@@gnu.ai.mit.edu (Karl Heuer),
2963 sudish@@MindSpring.COM (Sudish Joseph)
2921 @end example 2964 @end example
2922 2965
2923 2966
2924 @node Key Index,Function Index,,Top 2967 @node Key Index,Function Index,,Top
2925 @comment node-name, next, previous, up 2968 @comment node-name, next, previous, up