comparison man/viper.texi @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents bfd6434d15b3
children acd284d43ca1
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
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 20 and XEmacs 20 17 @subtitle a Vi emulator for GNU Emacs 20 and XEmacs 20
18 @subtitle August 1997, Viper Version 2.96 18 @subtitle August 1997, Viper Version 3.0 (Polyglot)
19 19
20 @author Michael Kifer (Viper) 20 @author Michael Kifer (Viper)
21 @author Aamod Sane (VIP 4.4) 21 @author Aamod Sane (VIP 4.4)
22 @author Masahiko Sato (VIP 3.5) 22 @author Masahiko Sato (VIP 3.5)
23 23
531 @item C-\ 531 @item C-\
532 @kindex @kbd{C-\} 532 @kindex @kbd{C-\}
533 @cindex Meta key 533 @cindex Meta key
534 534
535 Viper uses @key{ESC} as a switch between Insert and Vi states. Emacs uses 535 Viper uses @key{ESC} as a switch between Insert and Vi states. Emacs uses
536 @key{ESC} for Meta. We need a Meta key to call the Meta key functions such 536 @key{ESC} for Meta. The Meta key is very important in Emacs since many
537 as @kbd{M-x function name}. This role is played by the key @kbd{C-\}. 537 finctions are accessible only via that key as @kbd{M-x function-name}.
538 Thus, to get @kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no 538 Therefore, we need to simulate it somehow. In Viper's Vi, Insert, and
539 Meta key). This works both in the Vi state and the Insert state. 539 Replace states, the meta key is set to be @kbd{C-\}. Thus, to get
540 Alternatively, you can use @kbd{\ @key{ESC}} in Vi state to simulate the 540 @kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no Meta key).
541 meta key. It is possible to use @key{ESC} as Meta, but then you cannot 541 This works both in the Vi command state and in the Insert and Replace
542 press @key{ESC} multiple times in Vi state. @xref{Customization}, to find 542 states. In Vi command state, you can also use @kbd{\ @key{ESC}} as the
543 out how to rebind @key{ESC} to be Meta.@refill 543 meta key.
544
545 Note: Emacs binds @kbd{C-\} to a function that offers to change the
546 keyboard input method in the multilingual environment. Viper overrides this
547 binding. However, it is still possible to switch the input method by typing
548 @kbd{\ C-\} in the Vi command state and @kbd{C-z \ C-\} in the Insert state.
549 Or you can use the MULE menu in the menubar.
544 @end table 550 @end table
545 @noindent 551 @noindent
546 Other differences are mostly improvements. The ones you should know 552 Other differences are mostly improvements. The ones you should know
547 about are: 553 about are:
548 554
693 If your display has a Meta key, these functions are invoked by holding the 699 If your display has a Meta key, these functions are invoked by holding the
694 Meta key and then typing @kbd{f} and @kbd{b}, respectively. On displays 700 Meta key and then typing @kbd{f} and @kbd{b}, respectively. On displays
695 without the Meta key, these functions are invoked by typing 701 without the Meta key, these functions are invoked by typing
696 @kbd{C-\ f} and @kbd{C-\ b} (@kbd{C-\} simulates the Meta key in Insert 702 @kbd{C-\ f} and @kbd{C-\ b} (@kbd{C-\} simulates the Meta key in Insert
697 state, as explained above). 703 state, as explained above).
704
705 The key @kbd{C-z} is sometimes also useful in Insert state: it allows you
706 to execute a single command in Vi state without leaving the Insert state!
707 For instance, @kbd{C-z d2w} will delete the next two words without leaving
708 the Insert state.
698 709
699 When Viper is in Insert state, you will see <I> in the mode line. 710 When Viper is in Insert state, you will see <I> in the mode line.
700 711
701 @node Replace State,, Insert State, States in Viper 712 @node Replace State,, Insert State, States in Viper
702 @subsection Replace State 713 @subsection Replace State
1213 @cindex syntax table 1224 @cindex syntax table
1214 1225
1215 The word-movement commands @kbd{w}, @kbd{e}, etc., and the associated 1226 The word-movement commands @kbd{w}, @kbd{e}, etc., and the associated
1216 deletion/yanking commands, @kbd{dw}, @kbd{yw}, etc., can be made to 1227 deletion/yanking commands, @kbd{dw}, @kbd{yw}, etc., can be made to
1217 understand Emacs syntax tables. If the variable 1228 understand Emacs syntax tables. If the variable
1218 @code{viper-syntax-preference} is set to @code{strict-vi} (the default) then 1229 @code{viper-syntax-preference} is set to @code{strict-vi} then
1219 the meaning of @emph{word} is the same as in 1230 the meaning of @emph{word} is the same as in
1220 Vi. However, if the value is @code{reformed-vi} then the alphanumeric 1231 Vi. However, if the value is @code{reformed-vi} (the default) then the
1221 symbols will be those specified by the current Emacs syntax table (which 1232 alphanumeric symbols will be those specified by the current Emacs syntax
1222 may be different for different major modes) plus the underscore symbol 1233 table (which may be different for different major modes) plus the
1223 @kbd{_}. The user can also specify the value @code{emacs}, which would 1234 underscore symbol @kbd{_}, minus some non-word symbols, like '.;,|, etc.
1235 Both @code{strict-vi} and @code{reformed-vi} work close to Vi in
1236 traditional cases, but @code{reformed-vi} does a better job when editing
1237 text in non-Latin alphabets.
1238
1239 The user can also specify the value @code{emacs}, which would
1224 make Viper use exactly the Emacs notion of word. In particular, the 1240 make Viper use exactly the Emacs notion of word. In particular, the
1225 underscore may not be part of a word. Finally, if 1241 underscore may not be part of a word. Finally, if
1226 @code{viper-syntax-preference} is set to @code{extended}, Viper words would 1242 @code{viper-syntax-preference} is set to @code{extended}, Viper words would
1227 consist of characters that are classified as alphanumeric @emph{or} as 1243 consist of characters that are classified as alphanumeric @emph{or} as
1228 parts of symbols. This is convenient for writing programs and in many other 1244 parts of symbols. This is convenient for writing programs and in many other
1233 have the value @code{extended}. In text modes where words contain special 1249 have the value @code{extended}. In text modes where words contain special
1234 characters, such as European (non-English) letters, Cyrillic letters, etc., 1250 characters, such as European (non-English) letters, Cyrillic letters, etc.,
1235 the value can be @code{reformed-vi} or @code{emacs}. 1251 the value can be @code{reformed-vi} or @code{emacs}.
1236 1252
1237 Changes to @code{viper-syntax-preference} should be done in the hooks to 1253 Changes to @code{viper-syntax-preference} should be done in the hooks to
1238 various major modes. Furthermore, for these changes to take effect, you 1254 various major modes by executing @code{viper-set-syntax-preference} as in
1239 should execute @code{(viper-update-alphanumeric-class)} right after changing 1255 the following example:
1240 the value of @code{viper-syntax-preference}. 1256
1257 @example
1258 (viper-set-syntax-preference nil "emacs")
1259 @end example
1260
1261 @findex @code{viper-set-syntax-preference}
1241 1262
1242 The above discussion of the meaning of Viper's words concerns only Viper's 1263 The above discussion of the meaning of Viper's words concerns only Viper's
1243 movement commands. In regular expressions, words remain the same as in 1264 movement commands. In regular expressions, words remain the same as in
1244 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use 1265 Emacs. That is, the expressions @code{\w}, @code{\>}, @code{\<}, etc., use
1245 Emacs' idea of what is a word, and they don't look into the value of 1266 Emacs' idea of what is a word, and they don't look into the value of
1261 1282
1262 @table @kbd 1283 @table @kbd
1263 @item C-x, C-c 1284 @item C-x, C-c
1264 @kindex @kbd{C-x} 1285 @kindex @kbd{C-x}
1265 @kindex @kbd{C-c} 1286 @kindex @kbd{C-c}
1266 @kbd{C-x} will exit from Vi state and return to Emacs state 1287 These two keys invoke many important Emacs functions. For example, if you
1267 @emph{temporarily}. If you hit one of these keys, Emacs will believe 1288 hit @kbd{C-x} followed by @kbd{2}, then the current window will be split
1268 that you hit that key in Emacs state. For example, if you hit @kbd{C-x} 1289 into 2. Except for novice users, @kbd{C-c} is also set to execute an Emacs
1269 followed by @kbd{2}, then the current window will be split into 2 and you 1290 command from the current major mode. @key{ESC} will do the same, if you
1270 will be in Vi state again. Except for novice users, @kbd{C-c} is also set 1291 configure @key{ESC} as Meta by setting @code{viper-no-multiple-ESC} to nil
1271 to temporarily escape to Emacs and execute a command from the current 1292 in @file{.viper}. @xref{Customization}. @kbd{C-\} in Insert, Replace, or Vi
1272 major mode. 1293 states will make Emacs think @kbd{Meta} has been hit.@refill
1273 @key{ESC} will do the same, if
1274 you configure @key{ESC} as Meta by setting @code{viper-no-multiple-ESC} to nil
1275 in @file{.viper}. @xref{Customization}. @kbd{C-\}
1276 in Insert or Vi states will make Emacs think @kbd{Meta} has been hit.@refill
1277 @item \ 1294 @item \
1278 @kindex @kbd{\} 1295 @kindex @kbd{\}
1279 Escape to Emacs to execute a single Emacs command. For instance, 1296 Escape to Emacs to execute a single Emacs command. For instance,
1280 @kbd{\ @key{ESC}} will act like a Meta key. 1297 @kbd{\ @key{ESC}} will act like a Meta key.
1281 @item Q 1298 @item Q
1699 Setting this variable too high may slow down your typing. Setting it too 1716 Setting this variable too high may slow down your typing. Setting it too
1700 low may make it hard to type macros quickly enough. 1717 low may make it hard to type macros quickly enough.
1701 @item viper-ex-style-motion t 1718 @item viper-ex-style-motion t
1702 Set this to @code{nil}, if you want @kbd{l,h} to cross 1719 Set this to @code{nil}, if you want @kbd{l,h} to cross
1703 lines, etc. @xref{Movement and Markers}, for more info. 1720 lines, etc. @xref{Movement and Markers}, for more info.
1704 @item viper-ex-style-editing-in-insert t 1721 @item viper-ex-style-editing t
1705 Set this to to @code{nil}, if you want 1722 Set this to to @code{nil}, if you want
1706 @kbd{C-h} and @key{DEL} to not stop 1723 @kbd{C-h} and @key{DEL} to not stop
1707 at the beginning of a line in Insert state. 1724 at the beginning of a line in Insert state, @key{X} and @key{x} to delete
1725 characters across lines in Vi command state, etc.
1708 @item viper-ESC-moves-cursor-back t 1726 @item viper-ESC-moves-cursor-back t
1709 It t, cursor moves back 1 character when switching from insert state to vi 1727 It t, cursor moves back 1 character when switching from insert state to vi
1710 state. If nil, the cursor stays where it was before the switch. 1728 state. If nil, the cursor stays where it was before the switch.
1711 @item viper-always t 1729 @item viper-always t
1712 @code{t} means: leave it to Viper to decide when a buffer must be brought 1730 @code{t} means: leave it to Viper to decide when a buffer must be brought
1743 If not @code{nil}, @kbd{:n} and @kbd{:b} will cycle through files in another 1761 If not @code{nil}, @kbd{:n} and @kbd{:b} will cycle through files in another
1744 window, if one exists. 1762 window, if one exists.
1745 @item ex-cycle-through-non-files nil 1763 @item ex-cycle-through-non-files nil
1746 @kbd{:n} does not normally cycle through buffers. Set this to get 1764 @kbd{:n} does not normally cycle through buffers. Set this to get
1747 buffers also. 1765 buffers also.
1748 @item viper-automatic-iso-accents nil
1749 If @kbd{t}, ISO accents will be turned on in insert/replace Viper states
1750 and turned off in Vi state. This is useful for editing text in European
1751 languages. This variable is buffer-local. If used, it should be set in the
1752 hooks to the appropriate major modes (usually setting it in
1753 @code{text-mode-hook} is enough).
1754 @item viper-want-emacs-keys-in-insert 1766 @item viper-want-emacs-keys-in-insert
1755 This is set to @code{nil} for user levels 1 and 2 and to @code{t} for user 1767 This is set to @code{nil} for user levels 1 and 2 and to @code{t} for user
1756 levels 3 and 4. Users who specify level 5 are allowed to set this variable 1768 levels 3 and 4. Users who specify level 5 are allowed to set this variable
1757 as they please (the default for this level is @code{t}). If set to 1769 as they please (the default for this level is @code{t}). If set to
1758 @code{nil}, complete Vi compatibility is provided in Insert state. This is 1770 @code{nil}, complete Vi compatibility is provided in Insert state. This is
1897 @vindex @code{viper-no-multiple-ESC} 1909 @vindex @code{viper-no-multiple-ESC}
1898 @vindex @code{viper-always} 1910 @vindex @code{viper-always}
1899 @vindex @code{viper-ESC-keyseq-timeout} 1911 @vindex @code{viper-ESC-keyseq-timeout}
1900 @vindex @code{viper-fast-keyseq-timeout} 1912 @vindex @code{viper-fast-keyseq-timeout}
1901 @vindex @code{viper-ex-style-motion} 1913 @vindex @code{viper-ex-style-motion}
1902 @vindex @code{viper-ex-style-editing-in-insert} 1914 @vindex @code{viper-ex-style-editing}
1903 @vindex @code{viper-ESC-moves-cursor-back} 1915 @vindex @code{viper-ESC-moves-cursor-back}
1904 @vindex @code{viper-custom-file-name} 1916 @vindex @code{viper-custom-file-name}
1905 @vindex @code{viper-spell-function} 1917 @vindex @code{viper-spell-function}
1906 @vindex @code{ex-cycle-other-window} 1918 @vindex @code{ex-cycle-other-window}
1907 @vindex @code{ex-cycle-through-non-files} 1919 @vindex @code{ex-cycle-through-non-files}
1908 @vindex @code{viper-automatic-iso-accents}
1909 @vindex @code{viper-want-emacs-keys-in-insert} 1920 @vindex @code{viper-want-emacs-keys-in-insert}
1910 @vindex @code{viper-want-emacs-keys-in-vi} 1921 @vindex @code{viper-want-emacs-keys-in-vi}
1911 @vindex @code{viper-keep-point-on-repeat} 1922 @vindex @code{viper-keep-point-on-repeat}
1912 @vindex @code{viper-keep-point-on-undo} 1923 @vindex @code{viper-keep-point-on-undo}
1913 @vindex @code{viper-delete-backwards-in-replace} 1924 @vindex @code{viper-delete-backwards-in-replace}
1957 first). Then you can bind those sequences to their preferred forms using 1968 first). Then you can bind those sequences to their preferred forms using
1958 @code{function-key-map} as follows: 1969 @code{function-key-map} as follows:
1959 1970
1960 @lisp 1971 @lisp
1961 (cond ((string= (getenv "TERM") "xterm") 1972 (cond ((string= (getenv "TERM") "xterm")
1962 (define-key function-key-map "\e[192z" [f11]) ; L1 1973 (define-key function-key-map "\e[192z" [f11]) ; L1
1963 (define-key function-key-map "\e[195z" [f14]) ; L4, Undo 1974 (define-key function-key-map "\e[195z" [f14]) ; L4, Undo
1964 @end lisp 1975 @end lisp
1965 1976
1966 The above illustrates how to do this for Xterm. On VT100, you would have to 1977 The above illustrates how to do this for Xterm. On VT100, you would have to
1967 replace "xterm" with "vt100" and also change the key sequences (the same 1978 replace "xterm" with "vt100" and also change the key sequences (the same
1968 key may emit different sequences on different types of terminals). 1979 key may emit different sequences on different types of terminals).
2091 via the function @code{viper-add-local-keys}, which lets one specify bindings 2102 via the function @code{viper-add-local-keys}, which lets one specify bindings
2092 that should be in effect in the current buffer only and for a specific Viper 2103 that should be in effect in the current buffer only and for a specific Viper
2093 state. For instance, 2104 state. For instance,
2094 @lisp 2105 @lisp
2095 (viper-add-local-keys 'vi-state '(("ZZ" . TeX-command-master) 2106 (viper-add-local-keys 'vi-state '(("ZZ" . TeX-command-master)
2096 ("ZQ" . viper-save-kill-buffer))) 2107 ("ZQ" . viper-save-kill-buffer)))
2097 @end lisp 2108 @end lisp
2098 @noindent 2109 @noindent
2099 redefines @kbd{ZZ} to invoke @code{TeX-command-master} in @code{vi-state} 2110 redefines @kbd{ZZ} to invoke @code{TeX-command-master} in @code{vi-state}
2100 and @kbd{ZQ} to save-then-kill the current buffer. These bindings take 2111 and @kbd{ZQ} to save-then-kill the current buffer. These bindings take
2101 effect only in the buffer where this command is executed. The typical use 2112 effect only in the buffer where this command is executed. The typical use
2744 here is how Viper saves the above macro so that it will be 2755 here is how Viper saves the above macro so that it will be
2745 available in Viper's Insert state (and Replace state) in buffer @code{my-buf} 2756 available in Viper's Insert state (and Replace state) in buffer @code{my-buf}
2746 only: 2757 only:
2747 2758
2748 @example 2759 @example
2749 (viper-record-kbd-macro "gg" 'insert-state 2760 (viper-record-kbd-macro "gg" 'insert-state
2750 [l up (meta x) n e x t - l i n e return] 2761 [l up (meta x) n e x t - l i n e return]
2751 "my-buf") 2762 "my-buf")
2752 @end example 2763 @end example
2753 2764
2754 @noindent 2765 @noindent
2755 To do the same for Vi state and all buffers with the major mode 2766 To do the same for Vi state and all buffers with the major mode
2756 @code{cc-mode}, use: 2767 @code{cc-mode}, use:
2757 2768
2758 @example 2769 @example
2759 (viper-record-kbd-macro "gg" 'vi-state 2770 (viper-record-kbd-macro "gg" 'vi-state
2760 [l up (meta x) n e x t - l i n e return] 2771 [l up (meta x) n e x t - l i n e return]
2761 'cc-mode) 2772 'cc-mode)
2762 @end example 2773 @end example
2763 2774
2764 @noindent 2775 @noindent
2765 Both macro names and macro definitions are vectors of symbols that denote 2776 Both macro names and macro definitions are vectors of symbols that denote
2766 keys on the keyboard. Some keys, like @kbd{\}, @kbd{ }, or digit-keys must 2777 keys on the keyboard. Some keys, like @kbd{\}, @kbd{ }, or digit-keys must
2770 If all members of a vectors are printable characters (or sequences, such as 2781 If all members of a vectors are printable characters (or sequences, such as
2771 @kbd{\e}, @kbd{\t}, for @key{ESC} and @key{TAB}), then they can also be represented as 2782 @kbd{\e}, @kbd{\t}, for @key{ESC} and @key{TAB}), then they can also be represented as
2772 strings: 2783 strings:
2773 2784
2774 @example 2785 @example
2775 (viper-record-kbd-macro "aa" 'vi-state "aaa\e" "my-buffer") 2786 (viper-record-kbd-macro "aa" 'vi-state "aaa\e" "my-buffer")
2776 @end example 2787 @end example
2777 2788
2778 @noindent 2789 @noindent
2779 Thus, typing @kbd{aa} fast in Vi state will switch Viper to Insert state 2790 Thus, typing @kbd{aa} fast in Vi state will switch Viper to Insert state
2780 (due to the first @kbd{a}), insert @kbd{aa}, and then it will switch back to Vi 2791 (due to the first @kbd{a}), insert @kbd{aa}, and then it will switch back to Vi
3094 3105
3095 Viper's idea of Vi's words is slightly different from Vi. First, Viper 3106 Viper's idea of Vi's words is slightly different from Vi. First, Viper
3096 words understand Emacs symbol tables. Therefore, all symbols declared to be 3107 words understand Emacs symbol tables. Therefore, all symbols declared to be
3097 alphanumeric in a symbol table can automatically be made part of the Viper 3108 alphanumeric in a symbol table can automatically be made part of the Viper
3098 word. This is useful when, for instance, editing text containing European, 3109 word. This is useful when, for instance, editing text containing European,
3099 Cyrillic, etc., letters. 3110 Cyrillic, Japanese, etc., texts.
3100 3111
3101 Second, Viper lets you depart from Vi's idea of a word by changing the 3112 Second, Viper lets you depart from Vi's idea of a word by changing the a
3102 value of @code{viper-syntax-preference}. By default, this variable is set to 3113 syntax preference via the customization widget (the variable
3103 @code{strict-vi}, which means that alphanumeric symbols are exactly as 3114 @code{viper-syntax-preference}) or by executing
3104 in Vi. 3115 @code{viper-set-syntax-preference} interactively.
3105 However, if the value is @code{reformed-vi} then alphanumeric 3116
3106 symbols will be those specified by the current Emacs syntax table (which 3117 By default, Viper syntax preference is @code{reformed-vi}, which means that
3107 may be different for different major modes) plus the underscore symbol 3118 Viper considers only those symbols to be part of a word that are specified
3108 @kbd{_}. The user can also specify the value @code{emacs}, which would 3119 as word-symbols by the current Emacs syntax table (which may be different
3109 make Viper use exactly the Emacs notion of word. In particular, the 3120 for different major modes) plus the underscore symbol @kbd{_}, minus the
3110 underscore may not be part of a word. Finally, if 3121 symbols that are not considered words in Vi (e.g., `,',;, etc.), but may be
3111 @code{viper-syntax-preference} is set to @code{extended}, Viper words would 3122 considered as word-symbols by various Emacs major modes. Reformed-Vi works
3112 consist of characters that are classified as alphanumeric @emph{or} as 3123 very close to Vi, and it also recognizes words in other
3113 parts of symbols. This is convenient for writing programs and in many other 3124 alphabets. Therefore, this is the most appropriate mode for editing text
3114 situations. 3125 and is likely to fit all your needs.
3115 3126
3116 @vindex @code{viper-syntax-preference} 3127 You can also set Viper syntax preference to @code{strict-vi}, which would
3117 @cindex syntax table 3128 cause Viper to view all non-English letters as non-word-symbols.
3129
3130 You can also specify @code{emacs} as your preference, which would
3131 make Viper use exactly the same notion of a word as Emacs does. In
3132 particular, the underscore may not be part of a word in some major modes.
3133
3134 Finally, if @code{viper-syntax-preference} is set to @code{extended}, Viper
3135 words would consist of characters that are classified as alphanumeric
3136 @emph{or} as parts of symbols. This is convenient for editing programs.
3118 3137
3119 @code{viper-syntax-preference} is a local variable, so it can have different 3138 @code{viper-syntax-preference} is a local variable, so it can have different
3120 values for different major modes. For instance, in programming modes it can 3139 values for different major modes. For instance, in programming modes it can
3121 have the value @code{extended}. In text modes where words contain special 3140 have the value @code{extended}. In text modes where words contain special
3122 characters, such as European (non-English) letters, Cyrillic letters, etc., 3141 characters, such as European (non-English) letters, Cyrillic letters, etc.,
3123 the value can be @code{reformed-vi} or @code{emacs}. 3142 the value can be @code{reformed-vi} or @code{emacs}.
3124 3143 If you consider using different syntactic preferences for different major
3125 Changes to @code{viper-syntax-preference} should be done in the hooks to 3144 modes, you should execute, for example,
3126 various major modes. Furthermore, for these changes to take effect, you 3145
3127 should execute @code{(viper-update-alphanumeric-class)} right after changing 3146 @example
3128 the value of @code{viper-syntax-preference}. 3147 (viper-set-syntax-preference nil "extended")
3148 @end example
3149
3150 in the appropriate major mode hooks.
3151
3152 @vindex @code{viper-syntax-preference}
3153 @findex @code{viper-set-syntax-preference}
3154 @cindex syntax table
3155
3156
3129 3157
3130 The above discussion concerns only the movement commands. In regular 3158 The above discussion concerns only the movement commands. In regular
3131 expressions, words remain the same as in Emacs. That is, the expressions 3159 expressions, words remain the same as in Emacs. That is, the expressions
3132 @code{\w}, @code{\>}, @code{\<}, etc., use Emacs' idea of what is a word, 3160 @code{\w}, @code{\>}, @code{\<}, etc., use Emacs' idea of what is a word,
3133 and they don't look into the value of variable 3161 and they don't look into the value of variable
3371 @item m > 3399 @item m >
3372 Set the Emacs mark at end of buffer. 3400 Set the Emacs mark at end of buffer.
3373 @item m , 3401 @item m ,
3374 Jump to the Emacs mark. 3402 Jump to the Emacs mark.
3375 @item :mark <char> 3403 @item :mark <char>
3376 Mark position with text marker named <char>. This is an Ex command. 3404 Mark position with text marker named <char>. This is an Ex command.
3377 @item :k <char> 3405 @item :k <char>
3378 Same as @kbd{:mark}. 3406 Same as @kbd{:mark}.
3379 @item `` 3407 @item ``
3380 Exchange point and mark. 3408 Exchange point and mark.
3381 @item '' 3409 @item ''
3382 Exchange point and mark and go to the first CHAR on line. 3410 Exchange point and mark and go to the first CHAR on line.
3383 @item '<a-z> 3411 @item '<a-z>
3590 3618
3591 In Emacs, @samp{\&} stands for the last matched expression, so 3619 In Emacs, @samp{\&} stands for the last matched expression, so
3592 @kbd{s/[ab]+/\&\&/} will double the string matched by @kbd{[ab]}. 3620 @kbd{s/[ab]+/\&\&/} will double the string matched by @kbd{[ab]}.
3593 Viper doesn't treat @samp{&} specially, unlike Vi: use @samp{\&} instead. 3621 Viper doesn't treat @samp{&} specially, unlike Vi: use @samp{\&} instead.
3594 @item :[x,y]copy [z] 3622 @item :[x,y]copy [z]
3595 Copy text between @kbd{x} and @kbd{y} to the position after @kbd{z}. 3623 Copy text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
3596 @item :[x,y]t [z] 3624 @item :[x,y]t [z]
3597 Same as @kbd{:copy}. 3625 Same as @kbd{:copy}.
3598 @item :[x,y]move [z] 3626 @item :[x,y]move [z]
3599 Move text between @kbd{x} and @kbd{y} to the position after @kbd{z}. 3627 Move text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
3600 @item & 3628 @item &
3601 Repeat latest Ex substitute command, e.g. 3629 Repeat latest Ex substitute command, e.g.
3602 @kbd{:s/wrong/right}. 3630 @kbd{:s/wrong/right}.
3603 @item C-c / 3631 @item C-c /
3604 Toggle case-sensitive search. With prefix argument, toggle vanilla/regular 3632 Toggle case-sensitive search. With prefix argument, toggle vanilla/regular
3685 @samp{confirm} (type @samp{y} to confirm a particular 3713 @samp{confirm} (type @samp{y} to confirm a particular
3686 substitution, else @samp{n}). Instead of @kbd{/} any 3714 substitution, else @samp{n}). Instead of @kbd{/} any
3687 punctuation character other than <space> <tab> and <lf> can be used as 3715 punctuation character other than <space> <tab> and <lf> can be used as
3688 delimiter. 3716 delimiter.
3689 @item & 3717 @item &
3690 Repeat latest Ex substitute command, e.g. @kbd{:s/wrong/right}. 3718 Repeat latest Ex substitute command, e.g. @kbd{:s/wrong/right}.
3691 @item :global /<pattern>/<ex-command> 3719 @item :global /<pattern>/<ex-command>
3692 @itemx :g /<pattern>/<ex-command> 3720 @itemx :g /<pattern>/<ex-command>
3693 Execute <ex-command> on all lines that match <pattern>. 3721 Execute <ex-command> on all lines that match <pattern>.
3694 @item :vglobal /<pattern>/<ex-command> 3722 @item :vglobal /<pattern>/<ex-command>
3695 @itemx :v /<pattern>/<ex-command> 3723 @itemx :v /<pattern>/<ex-command>
3989 @cindex keybindings 4017 @cindex keybindings
3990 @cindex keymapping 4018 @cindex keymapping
3991 4019
3992 @table @kbd 4020 @table @kbd
3993 @item :map <string> 4021 @item :map <string>
3994 Start defining a Vi-style keyboard macro. 4022 Start defining a Vi-style keyboard macro.
3995 For instance, typing 4023 For instance, typing
3996 @kbd{:map www} followed by @kbd{:!wc %} and then typing @kbd{C-x )} 4024 @kbd{:map www} followed by @kbd{:!wc %} and then typing @kbd{C-x )}
3997 will cause @kbd{www} to run wc on 4025 will cause @kbd{www} to run wc on
3998 current file (Vi replaces @samp{%} with the current file name). 4026 current file (Vi replaces @samp{%} with the current file name).
3999 @item C-x ) 4027 @item C-x )
4000 Finish defining a keyboard macro. 4028 Finish defining a keyboard macro.
4001 In Viper, this command completes the process of defining all keyboard 4029 In Viper, this command completes the process of defining all keyboard
4002 macros, whether they are Emacs-style or Vi-style. 4030 macros, whether they are Emacs-style or Vi-style.
4003 This is a departure from Vi, needed to allow WYSIWYG mapping of 4031 This is a departure from Vi, needed to allow WYSIWYG mapping of
4004 keyboard macros and to permit the use of function keys and arbitrary Emacs 4032 keyboard macros and to permit the use of function keys and arbitrary Emacs
4005 functions in the macros. 4033 functions in the macros.
4006 @item :unmap <string> 4034 @item :unmap <string>
4007 Deprive <string> of its mappings in Vi state. 4035 Deprive <string> of its mappings in Vi state.
4008 @item :map! <string> 4036 @item :map! <string>
4009 Map a macro for Insert state. 4037 Map a macro for Insert state.
4010 @item :unmap! <string> 4038 @item :unmap! <string>
4011 Deprive <string> of its mapping in Insert state (see @kbd{:unmap}). 4039 Deprive <string> of its mapping in Insert state (see @kbd{:unmap}).
4012 @item @@<a-z> 4040 @item @@<a-z>
4013 In Vi state, 4041 In Vi state,
4014 execute the contents of register as a command. 4042 execute the contents of register as a command.
4015 @item @@@@ 4043 @item @@@@
4016 In Vi state, 4044 In Vi state,
4017 repeat last register command. 4045 repeat last register command.
4018 @item @@# 4046 @item @@#
4019 In Vi state, 4047 In Vi state,
4020 begin keyboard macro. End with @@<a-z>. This will 4048 begin keyboard macro. End with @@<a-z>. This will
4021 put the macro in the proper register. Register will 4049 put the macro in the proper register. Register will
4022 be automatically downcased. 4050 be automatically downcased.
4023 @xref{Macros and Registers}, for more info. 4051 @xref{Macros and Registers}, for more info.
4024 @item @@!<a-z> 4052 @item @@!<a-z>
4025 In Vi state, 4053 In Vi state,
4026 yank anonymous macro to register 4054 yank anonymous macro to register
4027 @item * 4055 @item *
4028 In Vi state, 4056 In Vi state,
4029 execute anonymous macro (defined by C-x( and C-x )). 4057 execute anonymous macro (defined by C-x( and C-x )).
4030 @item C-x e 4058 @item C-x e
4031 Like @kbd{*}, but works in all Viper states. 4059 Like @kbd{*}, but works in all Viper states.
4032 @item #g<move> 4060 @item #g<move>
4033 Execute the last keyboard macro for each line in the region. 4061 Execute the last keyboard macro for each line in the region.
4034 @xref{Macros and Registers}, for more info. 4062 @xref{Macros and Registers}, for more info.
4035 @item [<a-z> 4063 @item [<a-z>
4036 Show contents of textmarker. 4064 Show contents of textmarker.
4037 @item ]<a-z> 4065 @item ]<a-z>
4038 Show contents of register. 4066 Show contents of register.
4039 @end table 4067 @end table
4040 @kindex @kbd{]<a-z>} 4068 @kindex @kbd{]<a-z>}
4041 @kindex @kbd{[<a-z>} 4069 @kindex @kbd{[<a-z>}
4042 @kindex @kbd{#g<move>} 4070 @kindex @kbd{#g<move>}
4043 @kindex @kbd{*} 4071 @kindex @kbd{*}
4233 @section Emacs Related Commands 4261 @section Emacs Related Commands
4234 4262
4235 @table @kbd 4263 @table @kbd
4236 @item C-\ 4264 @item C-\
4237 Begin Meta command in Vi or Insert states. Most often used as C-\ x (M-x). 4265 Begin Meta command in Vi or Insert states. Most often used as C-\ x (M-x).
4266
4267 Note: Emacs binds @kbd{C-\} to a function that offers to change the
4268 keyboard input method in the multilingual environment. Viper overrides this
4269 binding. However, it is still possible to switch the input method by typing
4270 @kbd{\ C-\} in the Vi command state and @kbd{C-z \ C-\} in the Insert state.
4271 Or you can use the MULE menu on the menubar.
4238 @item C-z 4272 @item C-z
4239 In Insert and Replace states, prepare Viper to accept the next command and 4273 In Insert and Replace states, prepare Viper to accept the next command and
4240 execute it as if Viper was in Vi state. Then return to Insert state. 4274 execute it as if Viper was in Vi state. Then return to Insert state.
4241 4275
4242 In Vi state, switch to Emacs state; in Emacs state, switch to Vi state. 4276 In Vi state, switch to Emacs state; in Emacs state, switch to Vi state.