comparison man/viper.texi @ 70:131b0175ea99 r20-0b30

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