Lines Matching +refs:switch +refs:to +refs:minibuffer

15 Permission is granted to copy, distribute and/or modify this document
22 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
69 conventions to the one that departs from many of them. It has many
70 customizable options, which can be used to tailor Viper to the work habits
79 Viper is intended to be usable without reading this manual; the defaults
80 are set to make Viper as close to Vi as possible. At startup, Viper will
81 try to set the most appropriate default environment for you, based on
83 management commands to help you start immediately.
85 Although this manual explains how to customize Viper, some basic
101 * Customization:: How to customize Viper
134 Viper is intended to be usable out of the box, without reading this manual;
135 the defaults are set to make Viper as close to Vi as possible. At
136 startup, Viper will attempt to set the most appropriate default environment
138 basic GNU Emacs window management commands to help you start immediately.
140 Although this manual explains how to customize Viper, some basic
146 You should also learn to use the Info on-line hypertext manual system that
160 virtually unrestricted access to Emacs facilities. Perfect compatibility
162 Emacs ideas that you should know about, how to use Viper within Emacs and
166 user who wants to switch to Emacs while retaining the ability to edit files
179 * States in Viper:: Viper has four states orthogonal to Emacs
183 * Unimplemented Features:: That are unlikely to be implemented.
211 The default settings of Viper try to mimic the behavior of Vi, preventing
213 Emacs commands directly (such as those bound to arrow keys), it is possible
214 to get the cursor beyond the end-of-line. However, this won't (or
215 shouldn't) happen if you restrict yourself to standard Vi keys, unless you
218 In addition to the @dfn{point}, there is another distinguished buffer
222 user, this simply means that in addition to the Vi textmarkers a--z, there
223 is another marker called @dfn{mark}. This is similar to the unnamed Vi
225 cursor to the position of the last absolute jump. Viper provides access to
227 to commands that operate on text regions, e.g., @kbd{dr} to delete region,
230 Furthermore, Viper lets Ex-style commands to work on the current region.
234 135. There is no need to type the line numbers, since Viper inserts them
253 a buffer to a file, then the buffer will become not modified. Also if
258 in a minibuffer window. The minibuffer window is used for command input
259 output. Viper uses minibuffer window for @kbd{/} and @kbd{:}
273 functions. The @dfn{global keymap} is common to all the
275 @dfn{mode} of the buffer. If a function is bound to some key in the local
277 If no function is bound to a key in the
278 local map, however, the function bound to the key in the global map
303 similar to the Control key, e.g., @kbd{M-x} means typing @kbd{x} while
306 x}. Viper uses @key{ESC} to switch from Insert state to Vi state. Therefore
311 cause Lisp functions to be called. It is possible to call these
317 The most common way to load it automatically is to include the following
334 variable @code{viper-custom-file-name} in @file{.emacs} @emph{prior} to loading
338 which allows you to (mostly) bypass the use of the @file{.emacs} and
343 Once invoked, Viper will arrange to bring up Emacs buffers in Vi state
345 @xref{Packages that Change Keymaps}, to find out when forcing Vi command state
364 Finally, if at some point you would want to de-Viperize your running
388 Viper, @kbd{C-z} will normally take you to Vi command state. Another
389 @kbd{C-z} will take you back to Emacs state. This toggle key can be
390 changed, @pxref{Customization} You can also type @kbd{M-x viper-mode} to
391 change to Vi state.
394 For users who chose to set their user level to 1 at Viper setup time,
395 switching to Emacs state is deliberately made harder in order to not
402 @dots{}, will take you to Insert state. All Vi commands may
407 (if it is installed). Then typing @kbd{i} will prompt you for a topic to
408 search in the index. Note: to search for Ex commands in the index, you
411 In Viper, Ex commands can be made to work on the current Emacs region.
415 ends at line 135. There is no need to type the line numbers, since Viper
419 Insert state is the Vi insertion mode. @key{ESC} will take you back to
426 it will automatically change to Insert state. You do not have to worry
428 state. If you type @key{ESC}, Viper will switch to Vi command mode, terminating the
436 done in Vi and Insert states. Viper will try to make all new buffers be in Vi
438 will take you to Vi state in such a case. In some major modes, like Dired,
439 Info, Gnus, etc., you should not switch to Vi state (and Viper will not
440 attempt to do so) because these modes are not intended for text editing and
441 many of the Vi keys have special meaning there. If you plan to read news,
447 If you switch to Vi in Dired or similar modes, no harm is done. It is just
449 overshadowed by Viper's bindings. Switching back to Viper's Emacs state
452 States in Viper are orthogonal to Emacs major modes, such as C mode or Dired
454 on, Vi state can be used to move around. In Insert state, the bindings for
462 major mode bindings are unsupported. @xref{Customization}, to find out how
463 to allow Emacs keys in Insert state.
467 you get up to speed with Viper.
486 Emacs state is actually a Viperism to denote all the major and minor modes
491 orthogonal to these Emacs major modes. The presence of these language
502 There is also a key that lets you temporarily escape to Vi command state
519 @kbd{C-x} is used to invoke Emacs commands, mainly those that do window
521 window. @kbd{C-x 1} will close all other windows. @kbd{C-xb} is used to
522 switch buffers in a window, and @kbd{C-xo} to move through windows.
537 There will be cases where you will have to
538 use @kbd{C-g} to quit. Similarly, @kbd{C-]} is used to exit
544 At user level 1, @kbd{C-g} is bound to @code{viper-info-on-file}
550 Viper uses @key{ESC} as a switch between Insert and Vi states. Emacs uses
553 Therefore, we need to simulate it somehow. In Viper's Vi, Insert, and
554 Replace states, the meta key is set to be @kbd{C-\}. Thus, to get
561 Note: Emacs binds @kbd{C-\} to a function that offers to change the
563 binding. However, it is still possible to switch the input method by typing
585 @comment ]] Just to balance parens
592 Files specified to @kbd{:e} use @code{csh} regular expressions
594 However, the function @code{viper-toggle-search-style}, bound to @kbd{C-c /},
595 lets the user switch from search with regular expressions to plain vanilla
596 search and vice versa. It also lets one switch from case-sensitive search
597 to case-insensitive and back.
608 minibuffer if you type @kbd{:e} then space. Absolute filenames are
610 is slightly different from other programs. It is designed to minimize the
613 name for you.) If you see a prompt @kbd{/usr/foo/} and you wish to edit the
614 file @kbd{~/.file}, you don't have to erase the prompt. Instead, simply
616 correctly. Similarly, if the prompt is @kbd{~/foo/} and you need to get to
619 @kbd{~/foo/} is to be discarded.
624 want to change the default shell.
632 to complete the name or it will offer a menu of possible completions.
633 This works similarly to Tcsh and extends the behavior of Csh. While Emacs
634 is waiting for a file name, you can type @kbd{M-p} to get the previous file
641 typing @kbd{M-p} and @kbd{M-n}. Viper tries to rationalize when it puts Ex
645 @kbd{: @key{RET}}. If @kbd{:w!@: foo} were placed on the list, it would be all to
646 easy to override valuable data in another file. Reconstructing the full
649 @kbd{:w!} in the minibuffer. Then, repeated @kbd{M-p} will get you through
652 In contrast to @kbd{:w!@: foo}, if the command were @kbd{:r foo}, the entire
675 Emacs state bindings visible (by changing your user level to 3 or higher).
677 to see how to do this.
679 Once this is done, it is possible to do quite a bit of editing in
681 which is similar to Vi's @kbd{p}. However, unlike @kbd{p}, @kbd{C-y} can be
684 used to delete the text previously put back by Emacs's @kbd{C-y} or by Vi's
688 In Vi state, @kbd{M-y} is a much better alternative to the usual Vi's way
692 to re-insert it while editing in Insert mode. The key @kbd{C-y} will put
700 in the minibuffer: the above keys are usually bound to other histories,
701 which are more appropriate in the minibuffer.)
710 and @kbd{C-a}, which move the cursor to the end and the beginning of the
720 to execute a single command in Vi state without leaving the Insert state!
733 the mode line to let you know which state is in effect. If Replace state is
738 changes its state from Replace to Insert (which you will notice by the
741 Since Viper runs under Emacs, it is possible to switch between buffers
744 unattainable in regular Vi), it is possible to take the cursor outside the
746 the need to enable text selection and region-setting with the mouse.)
748 The issue then arises as to what to do when the user
750 the end of the replacement region to be deleted. But what if, as is
763 The minibuffer is where commands are entered in. Editing can be done
781 These keys are bound to functions that peruse minibuffer history. The
782 precise history to be perused depends on the context. It may be the history
785 If the minibuffer is entered via the Viper search commands @kbd{/} or
788 (which is bound to @kbd{C-s} everywhere except in this case).
791 Most of the Emacs keys are functional in the minibuffer. While in the
792 minibuffer, Viper tries to make editing resemble Vi's behavior when the
793 latter is waiting for the user to type an Ex command. In particular, you
794 can use the regular Vi commands to edit the minibuffer. You can switch
796 Initially, the minibuffer comes up in Insert state.
798 Some users prefer plain Emacs bindings in the minibuffer. To this end, set
799 @code{viper-vi-style-in-minibuffer} to @code{nil} in
800 your Viper customization file. @xref{Customization}, to learn how to do this.
802 When the minibuffer changes Viper states, you will notice that the appearance
803 of the text there changes as well. This is useful because the minibuffer
804 has no mode line to tell which Vi state it is in.
805 The appearance of the text in the minibuffer can be changed.
815 to suffer through @code{No write since last change} errors.
827 textmarkers, e.g., @kbd{[a} to view marker @samp{a} .
838 Registers are common to files. Also, text yanked with @kbd{y} can be
840 the registers, can be used to look at the contents of a register, e.g.,
841 type @kbd{]a} to view register @samp{a}.
850 as one chunk. If you want to break a sequence of deletions so that the
856 The current directory name for a file is automatically prepended to the
860 This directory is inserted in the minibuffer once you type space after
868 @kbd{/bla} and @kbd{/foo/~/bar} as @kbd{~/bar}. This is designed to
875 want to change this.
880 command @kbd{:n} can be given counts from the @kbd{:ar} list to switch to
881 other files. For example, use @samp{:n3} to move to the third file in
896 @kbd{:set} can also be used to set Emacs variables.
902 back to normal tabs.
961 If a point command is given as an argument to a modifying command, the
963 command. On the other hand, if a line command is given as an argument to a
971 use these commands to describe a region of text to operate on.
972 Thus, type @kbd{dw} to delete a word, @kbd{>@}} to shift a paragraph, or
973 @kbd{!'afmt} to format a region from @samp{point} to textmarker
988 Viper also adds counts to most commands for which it would make sense.
991 (@pxref{Multiple Files in Viper}). In addition to the files, Emacs has
1014 to have numbered backups, etc. For details, @pxref{Backup,,Backup and
1024 registers, as in Vi. The extra goody is the ability to @emph{view} these
1025 registers, in addition to being able to access them through @kbd{p} and
1044 or pieces of text that need to be inserted frequently.
1045 At the @kbd{:} or @kbd{/} prompts in the minibuffer, you can do the following:
1049 To move to previous and next history items. This causes the history
1050 items to appear on the command line, where you can edit them, or
1051 simply type Return to execute.
1055 Type @key{RET} to accept a default (which is displayed in the prompt).
1068 Similarly, commands that have to do with switching buffers
1086 possible to yank some text into a register and execute it using
1093 @kbd{"Ayy} will append to @emph{register a}. For @kbd{[,],',`}, it
1094 is an error to use a Uppercase register name.
1113 @kbd{/pattern} or @kbd{n} to go to the next pattern (the query), followed by a
1136 Viper provides buffer search, the ability to search the buffer for a region
1137 under the cursor. You have to turn this on in your Viper customization file
1145 or by setting @code{viper-buffer-search-char} to, say, @kbd{f3}:
1152 method), then @code{viper-buffer-search-char} will be set to @kbd{g}.
1155 @kbd{w,/,e}, to find a region and then search for the contents of that
1162 cursor will move to the next match. You can snarf words from the buffer
1163 as you go along. Incremental Search is normally bound to @kbd{C-s} and
1164 @kbd{C-r}. @xref{Customization}, to find out how to change the bindings
1172 minibuffer. It is invoked by the @kbd{Q} key in Vi state.
1188 in your Viper customization file. If you want to change how patterns are
1189 highlighted, you will have to change @code{viper-search-face} to your liking.
1190 The easiest way to do this is to use Emacs customization widget, which is
1204 It is possible in Emacs to define abbrevs based on the contents of the
1213 will search the buffer to find an extension for this word. For instance,
1215 that completed the @samp{A} to @samp{Abbreviations}. Repeated typing
1218 keystroke, which appears earlier in the text. Emacs binds this to
1219 @kbd{@key{ESC} /}, so you will have to find a key and bind the function
1220 @code{dabbrev-expand} to that key.
1230 refusing to move beyond the line, @key{ESC} moving one character back,
1240 watch out for is that it is possible to be on the end-of-line character.
1248 deletion/yanking commands, @kbd{dw}, @kbd{yw}, etc., can be made to
1250 @code{viper-syntax-preference} is set to @code{strict-vi} then
1256 Both @code{strict-vi} and @code{reformed-vi} work close to Vi in
1263 @code{viper-syntax-preference} is set to @code{extended}, Viper words would
1274 Changes to @code{viper-syntax-preference} should be done in the hooks to
1295 switch files by simply doing @kbd{'a}. If you set up a regimen for using
1310 into 2. Except for novice users, @kbd{C-c} is also set to execute an Emacs
1312 configure @key{ESC} as Meta by setting @code{viper-no-multiple-ESC} to
1318 Escape to Emacs to execute a single Emacs command. For instance,
1324 each string to be replaced is treated as a regular expression. You can use
1325 @code{(setq viper-re-query-replace nil)} in your @file{.emacs} file to
1334 These keys are used to visit files. @kbd{v} will switch to a buffer
1335 visiting file whose name can be entered in the minibuffer. @kbd{V} is
1346 prepend this string to each line in the buffer.
1350 Change upper-case characters in the region to lower-case
1355 Change lower-case characters in the region to upper-case. For instance,
1383 Jump to mark and pop mark off the ring. @xref{Mark,,Mark,emacs,The GNU
1404 Go to end of heading.
1407 example is @kbd{gw} to search for the word under the cursor.
1426 regular expressions. @xref{Viper Specials}, for alternative ways to invoke
1435 In the minibuffer, these commands navigate through the minibuffer
1440 If the minibuffer is entered via a Viper search commands @kbd{/} or @kbd{?},
1442 Emacs incremental search command (that is bound to @kbd{C-s} everywhere
1455 commands. Try to hit @kbd{C-c M-p} or @kbd{C-c M-n} repeatedly and see what
1465 Since typing @kbd{C-c M-p} is tedious, it is more convenient to bind an
1466 appropriate function to a function key on the keyboard and use that key.
1475 differently. @kbd{:pwd} exists to get current directory.
1476 The commands @kbd{:b} and @kbd{:B} switch buffers around. @xref{File and
1479 @kbd{PreviousRelatedFile} (which abbreviate to @kbd{R} and @kbd{P},
1492 Some Emacs packages are mentioned here as an aid to the new Viper user, to
1509 parsed and you can move to the error lines.
1513 You can talk to Shells from inside the editor. Your entire shell session
1532 @code{ange-ftp.el} can ftp from the editor to files on other machines
1533 transparent to the user.
1589 @code{viper-custom-file-name}, are supposed to be customized in @file{.emacs},
1590 prior to loading Viper (i.e., prior to @code{(require 'viper)} command.
1593 By executing the @kbd{:customize} Ex command. This takes you to the Emacs
1598 version of Emacs that you use. Still, it is recommended to separate
1603 has to be done in Emacs Lisp in your Viper customization file. For the common
1611 * Packages that Change Keymaps:: How to deal with such beasts.
1613 * Vi Macros:: How to do Vi style macros.
1623 An easy way to customize Viper is to change the values of constants used in
1633 command to @kbd{:set autoindent}; @kbd{:se ta @key{SPC}} will complete the command
1639 Viper will be waiting for you to type a value for the tabstop variable.
1650 @code{setq-default}. It may be useful for certain major modes to have their
1652 @code{setq} to change the local value of this variable in the hooks to the
1659 @key{RET}, @kbd{O}, and @kbd{o} indent cursor according to the current
1664 in the current buffer only. Use @code{setq-default} to change the value in
1677 Set current buffer to read only. To change globally put
1698 doesn't insert the tab, since this key is usually bound to
1701 command @code{viper-insert-tab}, which is bound to @kbd{S-tab} (shift + tab).
1705 to bind @code{viper-insert-tab} to some other convenient key.
1715 window will be scrolled up or down by about 1/7-th of its size, to reveal
1722 If not @code{nil}, @kbd{C-h} is bound to @code{help-command};
1724 @item viper-vi-style-in-minibuffer t
1726 insert mode when you type text in the minibuffer; if @code{nil}, typing in
1727 the minibuffer feels like plain Emacs.
1729 If you set this to @code{nil}, you can use @key{ESC} as Meta in Vi state.
1732 sets this variable to @code{twice}, which is almost like @code{nil}, except
1733 that double @key{ESC} beeps. This, too, lets @key{ESC} to be used as a Meta.
1740 low may make it hard to type macros quickly enough.
1742 Set this to @code{nil}, if you want @kbd{l,h} to cross
1745 Set this to @code{nil}, if you want
1746 @kbd{C-h} and @key{DEL} to not stop
1747 at the beginning of a line in Insert state, @kbd{X} and @kbd{x} to delete
1750 It @code{t}, cursor moves back 1 character when switching from insert state to vi
1751 state. If @code{nil}, the cursor stays where it was before the switch.
1753 @code{t} means: leave it to Viper to decide when a buffer must be brought
1756 cases. @code{nil} means you either has to invoke @code{viper-mode} manually
1757 for each buffer (or you can add @code{viper-mode} to the appropriate major mode
1765 have to set it as a string inside double quotes.
1767 Function used by the command @kbd{#c<move>} to spell.
1769 The value of this variable is the function symbol used to expand wildcard
1770 symbols. This is platform-dependent. The default tries to set this variable
1771 to work with most shells, MS Windows, etc. However, if it
1776 This feature is used to expand wildcards in the Ex command @kbd{:e}.
1785 @kbd{:n} does not normally cycle through buffers. Set this to get
1788 This is set to @code{nil} for user levels 1 and 2 and to @code{t} for user
1789 levels 3 and 4. Users who specify level 5 are allowed to set this variable
1790 as they please (the default for this level is @code{t}). If set to
1795 This is set to @code{nil} for user
1796 level 1 and to @code{t} for user levels 2--4.
1797 At level 5, users are allowed to set this variable as they please (the
1799 If set to @code{nil}, complete Vi compatibility is provided
1800 in Vi command state. Setting this to @code{nil} is really a bad idea,
1808 Prefix key used to invoke the macros @kbd{f12 1} and @kbd{f12 2} that repeat
1810 Both these macros are bound (as Viper macros) to
1812 which checks the second key by which it is invoked to see which of the
1813 previous commands to invoke. Viper binds @kbd{f12 1} and @kbd{f12 2} only,
1815 @xref{Vi Macros}, for how to do this.
1817 If not @code{nil}, Viper tries to not move point when undoing commands.
1818 Instead, it will briefly move the cursor to the place where change has
1820 then point will be moved to the place where the change took place.
1821 Set it to @code{t} and see if you like it better.
1829 @dfn{face} used to highlight the region.
1844 For a complete list of colors available to you, evaluate the expression
1855 If set to a valid color, this will be the cursor color when Viper is in
1859 If set to a valid color, this will be the cursor color when Viper is in
1862 A string used to mark the end of replacement regions. It is used only on
1865 A string used to mark the beginning of replacement regions. It is used
1869 @code{viper-replace-region-start-delimiter} to delimit replacement regions,
1875 the replacement mode. In this variable is set to @code{nil}, Viper will
1879 Specifies the key used to switch from Emacs to Vi and back.
1883 In Insert state, this key acts as a temporary escape to Vi state, i.e., it
1889 The value of this variable is a function name that is used to determine
1896 List of parameterless functions to be run just after entering the Vi
1905 to Emacs state.
1908 the last chance to do customization before Viper is up and running.
1929 @vindex viper-vi-style-in-minibuffer
1969 describe-key-briefly} and then typing the key you want to know about.
1980 to bind L1 (a key that exists on some SUN workstations) so it will invoke
1981 the Emacs Calendar and to bind L4 so it will undo changes.
1984 not emit the right signals for Emacs to understand. To let Emacs know about
1985 those keys, you will have to find out which key sequences they emit
1986 by typing @kbd{C-q} and then the key (you should switch to Emacs state
1987 first). Then you can bind those sequences to their preferred forms using
1996 The above illustrates how to do this for Xterm. On VT100, you would have to
2001 defined by the major modes and by Viper itself. Therefore, if you wish to
2004 Viper users who wish to specify their own key bindings should be concerned
2009 customized bindings for Emacs state made to @code{viper-emacs-global-user-map}
2014 If you wish to change a Viper binding, you can use the
2015 @code{define-key} command, to modify @code{viper-vi-global-user-map},
2022 If you want to
2023 bind a key, say @kbd{C-v}, to the function that scrolls
2024 page down and to make @kbd{0} display information on the current buffer,
2066 needs to create a sparse keymap, say, @code{my-fancy-map}, bind whatever
2077 to use @kbd{dd} in Vi state under Dired mode to delete files, @kbd{u} to unmark
2088 A Vi purist may want to modify Emacs state under Dired mode so that
2090 Vi. Although this is not recommended, as these keys are bound to useful
2101 Yet another way to customize key bindings in a major mode is to edit the
2106 keymap), where the keymap contains bindings that are supposed to be active
2109 Effects similar to key binding changes can be achieved by defining Vi
2112 bound to, unless these keys are typed in quick succession. So, with macros,
2121 buffer switches to some other Viper state and then back to Emacs state). To
2122 avoid this, one should add @code{viper-change-state-to-emacs} to an
2125 did not set @code{viper-always} to @code{nil}, chances are that you won't
2126 need to perform the above procedure, because Viper will take care of most
2142 redefines @kbd{ZZ} to invoke @code{TeX-command-master} in @code{vi-state}
2143 and @kbd{ZQ} to save-then-kill the current buffer. These bindings take
2145 of this function is to execute the above expression from within a function
2146 that is included in a hook to some major mode. For instance, the above
2148 could be called from a function, @code{my-tex-init}, which may be added to
2158 Another useful application is to bind @kbd{ZZ} to @code{send-mail}
2161 For instance, here is how to do this for @code{mh-e}, the Emacs interface
2162 to MH:
2170 You can also use @code{viper-add-local-keys} to set per buffer
2173 As with global bindings, customized local bindings done to Emacs state
2180 local to Viper state and the current buffer, not to the major mode.
2181 In such situations, the remedy is to type @kbd{M-x viper-zap-local-keys}.
2201 Viper is designed to coexist with all major and minor modes of Emacs. This
2204 @code{viper-want-emacs-keys-in-vi} and @code{viper-want-emacs-keys-in-insert} to
2206 If @code{viper-always} is set to @code{t} (which is the default), Viper
2207 will try to bring each buffer
2216 with @kbd{C-x} and @kbd{C-c}. This is why it was so important for us to
2218 It is common for language-specific major modes to bind @key{TAB} and
2219 @kbd{C-j} (the line feed) keys to various formatting functions. This is
2220 extremely useful, but may require some getting used to for a Vi user. If you
2225 novice users. In Emacs, @key{TAB} is used to format text and programs, and
2227 line to be re-indented in accordance with the context. In programming,
2229 immediately alert the programmer to a possible error. For instance, if a
2231 line, @key{TAB} is likely to mis-indent the line.
2236 @kbd{S-tab} (shift+ tab) is chosen to emulate Vi's @key{TAB}.
2240 a case, you will have to bind @code{viper-insert-tab} to some other
2243 Some packages, notably Dired, Gnus, Info, etc., attach special meaning to
2250 brings them in Emacs state. You can switch to Vi state by typing @kbd{C-z}
2251 if, for instance, you want to do Vi-style search in a buffer (although,
2252 usually, incremental search, which is bound to @kbd{C-s}, is sufficient in
2253 these situations). But you should then switch back to Emacs state if you
2254 plan to continue using these major modes productively. You can also switch
2255 to Vi temporarily, to execute just one command. This is done by typing
2259 If you would like certain major modes to come up in Emacs state rather than
2269 It is also possible to impose Vi on some major modes, even though they may
2270 bind common keys to specialized commands. This might make sense for modes
2288 The argument to @code{viper-harness-minor-mode} is the name of the file for the
2292 guidance here is to look into the file that defines the minor mode you are
2300 keys. If so, use the above line to harness @code{nasty-mode}. If your
2302 doesn't need to be harnessed.
2304 It is recommended to harness even those minor modes that don't override
2305 Viper keys, but still have their own keymaps. A general way to
2307 compatible with Viper is to have the file @file{my-mode.el} include the following code:
2338 Enable buffer search. Explicit call to @code{viper-buffer-search-enable}
2339 sets @code{viper-buffer-search-char} to @kbd{g}. Alternatively, the user can
2340 set @code{viper-buffer-search-char} in his/her Viper customization file to a key
2341 sequence to be used for buffer search. There is no need to call
2346 This function, bound to @kbd{C-c /}, lets one toggle case-sensitive and
2347 case-insensitive search, and also switch between plain vanilla search and
2349 asked which mode to toggle. With prefix argument 1, this toggles
2353 However, we found that the most convenient way to toggle
2354 these options is to bind a Vi macro to
2355 bind @kbd{//} to toggles case sensitivity and to @kbd{///} to toggles
2356 vanilla search. Thus, quickly hitting @kbd{/} twice will switch Viper from
2357 case sensitive search to case-insensitive. Repeating this once again will
2359 will switch you from vanilla-style search to search via regular expressions.
2371 If you don't like this feature as a default, but would still like to have
2380 Some people find it useful to use the Vi-style search key, @kbd{/}, to invoke
2386 binds @kbd{:} to invoke ex-style commands, like in vi-state. And, as described
2387 above, @kbd{//} and @kbd{///} get bound to Vi-style macros that toggle
2405 in the hook to the major mode (e.g., @code{dired-mode-hook}).
2434 to complete the file name by typing the appropriate suffix.
2438 To turn this feature off, set the above variable to @code{nil}.
2463 to the function that inserts the previous string in the insertion history.
2465 direction, you can either bind an unused key to
2466 @code{viper-insert-next-from-insertion-ring} or hit any digit (1 to 9) then
2469 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
2470 this will interfere with the minibuffer histories and, possibly, other
2481 However, repeated typing @kbd{C-c M-p} will cause Viper to show the
2482 previous destructive commands in the minibuffer. Subsequent hitting period
2486 Since typing @kbd{C-c M-p} may be tedious, it is more convenient to bind an
2487 appropriate function to an unused function key on the keyboard and use that
2494 to the function that searches the command history in the direction of older
2496 direction, you can either bind an unused key to
2497 @code{viper-next-destructive-command} or hit any digit (1 to 9) then @kbd{f31}.
2499 One should not bind the above functions to @kbd{M-p} or @kbd{M-n}, since
2500 this will interfere with the minibuffer histories and, possibly, other
2503 @item viper-minibuffer-vi-face 'viper-minibuffer-vi-face
2504 @item viper-minibuffer-insert-face 'viper-minibuffer-insert-face
2505 @item viper-minibuffer-emacs-face 'viper-minibuffer-emacs-face
2506 These faces control the appearance of the minibuffer text in the
2516 Prompts and minibuffer messages are not affected.
2518 Purists who do not like adornments in the minibuffer can always zap them by
2521 (copy-face 'default 'viper-minibuffer-vi-face)
2522 (copy-face 'default 'viper-minibuffer-insert-face)
2523 (copy-face 'default 'viper-minibuffer-emacs-face)
2527 indication of the current Viper state in the minibuffer. (This is important
2528 if the user accidentally switches to another Viper state by typing @key{ESC} or
2550 where @code{file1} to @code{file4} are names of files related to the master
2554 @kbd{:RelatedFile} (abbr.@: @kbd{:R}) will display files 1 to 4 one after
2561 These commands are akin to @kbd{:n} and @kbd{:N}, but they allow the user to
2564 Note that only the master file needs to have the aforementioned block of
2572 in a primitive interface to Emacs tags. @xref{Tags Tables,,,emacs,
2575 The following two commands are normally bound to a mouse click and are part
2591 occurrence of the pattern to search for.
2594 not already bound to something else. If you want to use the mouse-search
2595 feature, and the @kbd{Meta-Shift-mouse-1} mouse action is already bound to
2597 @code{viper-mouse-search-key} to something else in
2602 This would bind mouse search to the action invoked by pressing the
2609 purposes then you have to confirm your intention by placing the following
2619 The region that is chosen as a pattern to search for is determined as
2628 adjacent (from either side) to an alphanumeric character. This useful
2647 indicates how many such regions to snarf from the buffer and insert. (In
2651 already bound to something else. If you want to use this feature and the
2657 If you want to bind mouse-insert to an action even if this action is
2659 to your Viper customization file, after setting @code{viper-mouse-insert-key}:
2669 purpose of mouse search and mouse insert. By default, this is set to
2684 configuration. However, this may require some getting used to. For
2685 instance, if you are typing in a frame, A, and then move the mouse to frame
2686 B and click to invoke mouse search, search (or insertion) will be performed
2687 in frame A@. To perform search/insertion in frame B, you will first have to
2693 bind (and unbind, if necessary) @code{viper-mouse-catch-frame-switch} from
2694 the mouse event it is bound to.
2704 Finally, if the way Viper determines the word to be searched for or to be
2706 @code{viper-surrounding-word-function}, which can be changed to indicate
2708 you will then have to write such a function and make it known to your
2719 convenient to use Emacs keyboard macro facility. Emacs keyboard macros are
2721 @kbd{C-x e} (or @kbd{*}, if Viper is in Vi state). If you need to use several
2722 temporary macros, Viper lets you save them to a
2728 If, however, you need to use a macro regularly, it must be given a
2729 permanent name and saved. Emacs manual explains how to do this, but
2732 too many keys (to a Vi user's taste, anyway).
2733 Second, binding such macros to function keys, for
2738 specially, if this key sequence is bound to a macro.
2745 interface to the powerful Emacs keyboard macro facility.
2767 being defined. Third, macros can be bound to arbitrary sequences of keys,
2768 not just to printable keys. For instance, one can define a macro that will
2772 @kbd{help}, can't be bound to macros under Emacs, since they
2774 the user gives to keys. In general, keys that have a binding in
2775 @code{key-translation-map} can't be bound to a macro.)
2777 Fourth, in Viper, one can define macros that are specific to a given
2785 As if all that is not enough, Viper (through its interface to Emacs
2794 macro to be global, mode-specific, or buffer-specific. You will also be
2795 given a chance to save the macro in your Viper customization file.
2796 This is the easiest way to save a macro and make
2833 Thus, typing @kbd{aa} fast in Vi state will switch Viper to Insert state
2834 (due to the first @kbd{a}), insert @kbd{aa}, and then it will switch back to Vi
2837 Note that the last argument to @code{viper-record-kbd-macro} must be either a
2839 the latter says that the macro is to be defined for all buffers
2849 and @kbd{:unmap!} or by issuing a call to @code{viper-unrecord-kbd-macro}.
2852 needed only when the user needs to get rid of the macros that are already
2867 aborts the process, and it must be repeated. This is analogous to Vi,
2869 actually run. All that means that in order for a definition to be
2871 advance, to avoid errors. For instance, if you want to map @kbd{gg} to
2877 avoid the need to redo the job. When macros are actually run, an error
2882 The latter makes it possible to define macros bound to, say, double-hits
2885 makes Viper macro facility a @emph{keyboard doubler}, so to speak.
2888 the standard Emacs mechanism for binding function keys to commands.
2896 binds the key f13 to the Emacs function that repeats the last minibuffer
2898 purposes, if you bind, say, a double-hitting action for that key to some
2899 other function. Emacs doesn't allow the user to do that, but Viper does
2901 first. When you are asked to enter a macro name, hit f13 twice, followed by
2906 macro is executed. Suppose now we wanted to bind the key sequence
2907 @kbd{f13 f13} to the command @code{eval-last-sexp}. To accomplish this, we
2909 If you answer positively to Viper's offer to save this macro in your
2920 default, are bound to @kbd{[f12 \1]} and @kbd{[f12 \2]} (invoked by typing
2922 shortcuts to Viper's command ring history. The first macro will execute the
2926 If you need to go deeper into the command history, you will have to use
2938 actually free and can still be bound to some Emacs function via
2942 Viper allows the user to define macro names that are prefixes of other macros.
2943 For instance, one can define @kbd{[[} and @kbd{[[[[} to be macros.
2947 key sequences, @kbd{[[} or @kbd{[[[[} has a definition applicable to the
2951 in our case, @kbd{[[[[text} will cause the macro @kbd{[[} to be executed
2955 the actually keys to be used to invoke the macro. For instance, you
2956 should hit the actual key @kbd{f6} if it is to be part of a macro
2971 This is because it is all too easy to create an infinite loop in this way.
2972 Since Viper macros are much more powerful than Vi's it is impossible to
2976 We should also note that Vi macros are disabled in the minibuffer, which
2979 The rate at which the user must type keys in order for them to be
2981 @code{viper-fast-keyseq-timeout}, which defaults to 200 milliseconds.
2987 Emacs maps some of these sequences back to the logical keys
2988 (e.g., the sequences generated by the arrow keys are mapped to @kbd{up},
2990 Macros that are bound to key sequences that contain such unmapped function
2991 keys have to be redefined for TTY's (and possibly for every type of TTY you
3050 use these commands to describe a region of text to operate on.
3057 The command description uses angle brackets @samp{<>} to indicate
3071 @samp{<move>} refers to the above movement commands, and @samp{<a-z>}
3072 refers to registers or textmarkers from @samp{a} to @samp{z}. Note
3073 that the @samp{<move>} is described by full move commands, that is to
3076 @samp{<address>} refers to Ex line addresses, which include
3084 Actual line number, use @kbd{.=} to get the line number
3098 Note that the pattern is allowed to contain newline character (inserted as
3105 to mean current file. If you want a @samp{%} in your command, it must be
3110 Similarly, @samp{#} expands to the previous file. The previous file is
3111 the first file in @kbd{:args} listing. This defaults to previous window
3123 Common characters referred to include:
3149 @samp{WORD} for whitespace delimited words. @samp{char} refers to any
3150 @acronym{ASCII} character, @samp{CHAR} to non-whitespace character.
3152 optional, usually defaulting to 1. Brackets are elided for
3153 @samp{<count>} to eschew obfuscation.
3156 words understand Emacs symbol tables. Therefore, all symbols declared to be
3167 Viper considers only those symbols to be part of a word that are specified
3173 very close to Vi, and it also recognizes words in other
3175 and is likely to fit all your needs.
3177 You can also set Viper syntax preference to @code{strict-vi}, which would
3178 cause Viper to view all non-English letters as non-word-symbols.
3184 Finally, if @code{viper-syntax-preference} is set to @code{extended}, Viper
3213 syntax tables in order to not thwart the various major modes that set these
3216 The usual Emacs convention is used to indicate Control Characters, i.e.,
3219 C, -, h!!!} The @kbd{^} is itself, never used to indicate a
3222 Finally, we note that Viper's Ex-style commands can be made to work on the
3226 ends at line 135. There is no need to type the line numbers, since Viper
3262 <count> chars to the left.
3266 <count> chars to the right.
3282 <count> <char>s to the right (find).
3284 Till before <count> <char>s to the right.
3286 <count> <char>s to the left.
3288 Till after <count> <char>s to the left.
3307 Go to line <count> (default end-of-file).
3362 regular expressions. @xref{Viper Specials}, for alternative ways to invoke
3368 Find the next bracket/parenthesis/brace and go to its match.
3371 @code{viper-parse-sexp-ignore-comments} to @code{nil} in your Viper
3445 Emacs mark is referred to in the region specifiers @kbd{r} and @kbd{R}.
3458 Set the Emacs mark (@pxref{Emacs Preliminaries}) back to where it was last
3467 Jump to the Emacs mark.
3475 Exchange point and mark and go to the first CHAR on line.
3477 Go to specified Viper mark.
3479 Go to specified Viper mark and go to the first CHAR on line.
3497 @xref{Options}, to see how to change tab and shiftwidth size. See the GNU
3499 Check out the variable @code{indent-tabs-mode} to put in just spaces.
3524 shiftwidth to the right (layout!).
3526 Shift <count> lines one shiftwidth to the right.
3548 Successive typing of @kbd{C-c M-p} causes Viper to search the history in
3551 order. Each command in the history is displayed in the minibuffer. The
3556 functions doing the perusing can be bound to unused keyboard keys in the
3579 Minibuffer can be edited similarly to Insert state, and you can switch
3581 Some users prefer plain Emacs feel in the minibuffer. To this end, set
3582 @code{viper-vi-style-in-minibuffer} to @code{nil}.
3594 Back to the begin of the change on the
3613 as one chunk. If you want to break a sequence of deletions so that the
3626 Delete from point to endpoint of <count><move>.
3633 shiftwidth to the left (layout!).
3635 Shift <count> lines one shiftwidth to the left.
3664 Change from begin to endpoint of <count><move>.
3680 @samp{confirm} (type @samp{y} to confirm a particular
3682 punctuation CHAR unequal to <space> <tab> and <lf> can be used as
3690 found there (e.g., @samp{~} is not expanded to the result of the previous
3696 Copy text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
3700 Move text between @kbd{x} and @kbd{y} to the position after @kbd{z}.
3713 Change upper-case characters in the region to lower-case.
3715 Change lower-case characters in the region to upper-case.
3719 In Insert and Replace states, these keys are bound to commands that peruse
3722 @kbd{C-c M-p} or @kbd{C-c M-n}, you will cause Viper to
3726 In Vi state, these keys are bound to functions that peruse the history of
3756 @xref{Groundwork}, for Ex address syntax. @xref{Options}, to see how to
3757 get literal (non-regular-expression) search and how to stop search from
3768 found there (e.g., @samp{~} is not expanded to the result of the previous
3771 After typing @kbd{/} or @kbd{?} all the usual Emacs minibuffer commands, such as
3774 (which is bound to @kbd{C-s} everywhere except in this case).
3785 Find the next bracket and go to its match
3788 Search globally [from line x to y] for <string>
3798 Search in the tags file where <name> is defined (file, line), and go to it.
3804 @samp{confirm} (type @samp{y} to confirm a particular
3844 Yank from begin to endpoint of <count><move>.
3846 Yank from begin to endpoint of <count><move> to register.
3848 Yank from begin to endpoint of <count><move> and append
3849 to register.
3853 Idem (should be equivalent to @kbd{y$} though).
3900 that have a @samp{~} appended to them.
3974 name. If you need to type a modifier, such as @kbd{>>} or @kbd{!}, don't
3980 type @kbd{1:w} you would see @samp{:11,22w} in the minibuffer.
3993 Write the file. Viper makes sure that a final newline is always added to
3995 variable @code{require-final-newline} to @code{t}. If you don't like this
3996 feature, use @code{setq-default} to set @code{require-final-newline} to
3999 Write to the file <name>.
4001 Append the buffer to the file <name>. There should be no space between
4005 Confirmation is required for writing to an existing file (if this is not
4006 the file the buffer is visiting) or to a read-only file.
4008 Write lines x through y to the file <name>.
4023 and kill Emacs. Killing Emacs is the wrong way to use it, so you should
4024 switch to higher user levels as soon as possible.
4036 filename to @file{file}.
4038 Set the working directory to <dir> (default home directory).
4044 confirmation. Unlike Vi, Viper allows @kbd{:e} to take multiple arguments.
4049 In Viper, unlike Vi, @kbd{e!} is identical to @kbd{:e}. In both cases, the
4050 user is asked to confirm if there is a danger of discarding changes to a
4066 Switch to another buffer. If @code{ex-cycle-other-window} is @code{t},
4067 switch in another window. Buffer completion is supported.
4069 actually used to read the buffer name. The default is @code{read-buffer},
4079 is typed in minibuffer. File completion and history are supported.
4131 will cause @kbd{www} to run wc on
4137 This is a departure from Vi, needed to allow WYSIWYG mapping of
4138 keyboard macros and to permit the use of function keys and arbitrary Emacs
4160 yank anonymous macro to register
4192 The symbol @samp{%} is used in Ex shell commands to mean current file. If
4198 Similarly, @samp{#} expands to the previous file. The previous file is the
4199 first file in @kbd{:args} listing. This defaults to the previous file in
4214 % is replace by current file, \% is changed to %
4227 Give <count> lines as standard input to the
4231 Let lines x to y be standard input for <cmd>
4292 readonly: The file is not to be changed.
4293 If the user attempts to write to this file, confirmation will be requested.
4300 shell: The program to be used for shell escapes
4339 considered @samp{stuck} to the begin of the file.
4348 Set <option> to <value>.
4381 Note: Emacs binds @kbd{C-\} to a function that offers to change the
4383 binding. However, it is still possible to switch the input method by typing
4387 In Insert and Replace states, prepare Viper to accept the next command and
4388 execute it as if Viper was in Vi state. Then return to Insert state.
4390 In Vi state, switch to Emacs state; in Emacs state, switch to Vi state.
4392 Switches to Vi state for the duration of a single command. Then goes back
4393 to the original Viper state. Works from Vi, Insert, Replace, and Emacs states.
4405 Put back the last killed text. Similar to Vi's @kbd{p}, but also works in
4427 The following two mouse actions are normally bound to special search and
4437 already bound to something else.
4445 already bound to something else.