This is Info file ../info/viper, produced by Makeinfo version 1.68 from the input file viper.texi. INFO-DIR-SECTION Editors START-INFO-DIR-ENTRY * VIPER: (viper). The newest Emacs VI-emulation mode. (also, A VI Plan for Emacs Rescue or the VI PERil.) END-INFO-DIR-ENTRY Distribution ************ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the same conditions as for modified versions.  File: viper, Node: Search and Replace, Next: Yanking, Prev: Changing Text, Up: Text Handling Search and Replace ------------------ *Note Groundwork::, for Ex address syntax. *Note Options:: to see how to get literal (non-regular-expression) search and how to stop search from wrapping around. ` /' To the th occurrence of . ` ?' To the th previous occurrence of . ` g' Search for the text described by move. (off by default) `n' Repeat latest `/' `?' (next). `N' Idem in opposite direction. `%' Find the next bracket and go to its match `:[x,y]g//' Search globally [from line x to y] for and execute the Ex on each occurrence. `:[x,y]v//' Execute on the lines that don't match. `#g' Execute the last keyboard macro for each line in the region. *Note Macros and Registers::, for more info. `Q' Query Replace. `:ta ' Search in the tags file where is defined (file, line), and go to it. `:[x,y]s///' Substitute (on lines x through y) the pattern (default the last pattern) with . Useful flags are `g' for `global' (i.e. change every non-overlapping occurrence of ) and `c' for `confirm' (type `y' to confirm a particular substitution, else `n'). Instead of `/' any punctuation character other than and can be used as delimiter. Note: *The newline character (inserted as `C-qC-j') can be used in *. `&' Repeat latest Ex substitute command, e.g. `:s/wrong/right'. `:global //' `:g //' Execute on all lines that match . `:vglobal //' `:v //' Execute on all lines that do not match .  File: viper, Node: Yanking, Next: Undoing, Prev: Search and Replace, Up: Text Handling Yanking ------- ` y' Yank from begin to endpoint of . ` "y' Yank from begin to endpoint of to register. ` "y' Yank from begin to endpoint of and append to register. ` yy' lines. ` Y' Idem (should be equivalent to `y$' though). `m' Mark the cursor position with a letter. `[' Show contents of textmarker. `]' Show contents of register. ` ["]p' Put the contents of the (default undo) buffer times after the cursor. The register will be automatically down-cased. ` ["]P' Put the contents of the (default undo) buffer times before the cursor. The register will  File: viper, Node: Undoing, Prev: Yanking, Up: Text Handling Undoing ------- `u U' Undo the latest change. `.' Repeat undo. `:q!' Quit Vi without writing. `:e!' Re-edit a messed-up file. `:rec' Recover file from autosave. Viper also creates backup files that have a `~' appended to them.  File: viper, Node: Display, Next: File and Buffer Handling, Prev: Text Handling, Up: Commands Display ======= `C-g' At user level 1, give file name, status, current line number and relative position. At user levels 2 and higher, abort the current command. `C-c g' Give file name, status, current line number and relative position - all user levels. `C-l' Refresh the screen. ` C-e' Expose more lines at bottom, cursor stays put (if possible). ` C-y' Expose more lines at top, cursor stays put (if possible). ` C-d' Scroll lines downward (default the number of the previous scroll; initialization: half a page). ` C-u' Scroll lines upward (default the number of the previous scroll; initialization: half a page). ` C-f' pages forward. ` C-b' pages backward (in older versions `C-b' only works without count). ` z' `zH' Put line at the top of the window (default the current line). ` z-' `zL' Put line at the bottom of the window (default the current line). ` z.' `zM' Put line in the center of the window (default the current line).  File: viper, Node: File and Buffer Handling, Next: Mapping, Prev: Display, Up: Commands File and Buffer Handling ======================== In all file handling commands, space should be typed before entering the file name. If you need to type a modifier, such as `>>' or `!', don't put any space between the command and the modifier. `:q' Quit buffer except if modified. `:q!' Quit buffer without checking. In Viper, these two commands are identical. Confirmation is required if exiting modified buffers that visit files. `:suspend' `:stop' Suspend Viper `:[x,y] w' Write the file. Viper makes sure that a final newline is always added to any file where this newline is missing. This is done by setting Emacs variable `require-final-newline' to `t'. If you don't like this feature, use `setq-default' to set `require-final-newline' to `nil'. This must be done in `.viper' file. `:[x,y] w ' Write to the file . `:[x,y] w>> ' Append the buffer to the file . There should be no space between `w' and `>>'. Type space after the `>>' and see what happens. `:w! ' Overwrite the file . In Viper, `:w' and `:w!' are identical. Confirmation is required for writing to an existing file (if this is not the file the buffer is visiting) or to a read-only file. `:x,y w ' Write lines x through y to the file . `:wq' Write the file and kill buffer. `:r [ ...]' Read file into a buffer, inserting its contents after the current line. `:xit' Same as `:wq'. `:Write' `:W' Save all unsaved buffers, asking for confirmation. `:WWrite' `:WW' Like `W', but without asking for confirmation. `ZZ' Save current buffer and kill it. If user level is 1, then save all files and kill Emacs. Killing Emacs is the wrong way to use it, so you should switch to higher user levels as soon as possible. `:x []' Save and kill buffer. `:x! []' `:w![]' and `:q'. `:pre' Preserve the file - autosave buffers. `:rec' Recover file from autosave. `:f' Print file name and lines. `:cd []' Set the working directory to (default home directory). `:pwd' Print present working directory. `:e [+] ' Edit files. If no filename is given, edit the file visited by the current buffer. If buffer was modified or the file changed on disk, ask for confirmation. Unlike Vi, Viper allows `:e' to take multiple arguments. The first file is edited the same way as in Vi. The rest are visited in the usual Emacs way. `:e! [+] ' Re-edit file. If no filename, re-edit current file. In Viper, unlike Vi, `e!' is identical to `:e'. In both cases, the user is asked to confirm if there is a danger of discarding changes to a buffer. `:q!' Quit Vi without writing. `C-^' Edit the alternate (normally the previous) file. `:rew' Obsolete `:args' List files not shown anywhere with counts for next `:n [count] [+] []' Edit file, or edit files. The count comes from `:args'. `:N [count] [+] []' Like `:n', but the meaning of the variable EX-CYCLE-OTHER-WINDOW is reversed. `:b' Switch to another buffer. If EX-CYCLE-OTHER-WINDOW is `t', switch in another window. Buffer completion is supported. `:B' Like `:b', but the meaning of EX-CYCLE-OTHER-WINDOW is reversed. `:
r ' Read the file into the buffer after the line
. `v, V, C-v' Edit a file in current or another window, or in another frame. File name is typed in Minibuffer. File completion and history are supported.  File: viper, Node: Mapping, Next: Shell Commands, Prev: File and Buffer Handling, Up: Commands Mapping ======= `:map ' Start defining a Vi-style keyboard macro. For instance, typing `:map www' followed by `:!wc %' and then typing `C-x )' will cause `www' to run wc on current file (Vi replaces `%' with the current file name). `C-x )' Finish defining a keyboard macro. In Viper, this command completes the process of defining all keyboard macros, whether they are Emacs-style or Vi-style. This is a departure from Vi, needed to allow WYSIWYG mapping of keyboard macros and to permit the use of function keys and arbitrary Emacs functions in the macros. `:unmap ' Deprive of its mappings in Vi state. `:map! ' Map a macro for Insert state. `:unmap! ' Deprive of its mapping in Insert state (see `:unmap'). `@' In Vi state, execute the contents of register as a command. `@@' In Vi state, repeat last register command. `@#' In Vi state, begin keyboard macro. End with @. This will put the macro in the proper register. Register will be automatically down-cased. *Note Macros and Registers::, for more info. `@!' In Vi state, yank anonymous macro to register `*' In Vi state, execute anonymous macro (defined by C-x( and C-x )). `C-x e' Like `*', but works in all Viper states. `#g' Execute the last keyboard macro for each line in the region. *Note Macros and Registers::, for more info. `[' Show contents of textmarker. `]' Show contents of register.  File: viper, Node: Shell Commands, Next: Options, Prev: Mapping, Up: Commands Shell Commands ============== Note that % is used in Ex commands to mean current file. If you want a % in your command, it must be escaped as `\%'. However if % is the first character, it stands as the address for the whole file. Similarly, `#' expands to the previous file. The previous file is the first file in `:args' listing. This defaults to the previous file in the VI sense if you have one window. `:sh' Execute a subshell in another window `:[x,y]!' Execute a shell [on lines x through y; % is replace by current file, \% is changed to % `:[x,y]!! []' Repeat last shell command [and append ]. `:!' Just execute command and display result in a buffer. `:!! ' Repeat last shell command and append ` !' The shell executes , with standard input the lines described by , next the standard output replaces those lines (think of `cb', `sort', `nroff', etc.). ` !!' Give lines as standard input to the shell , next let the standard output replace those lines. `:[x,y] w !' Let lines x to y be standard input for (notice the between `w' and `!'). `:
r !' Put the output of after the line
(default current). `:
r ' Read the file into the buffer after the line
(default current).  File: viper, Node: Options, Next: Emacs Related Commands, Prev: Shell Commands, Up: Commands Options ======= `autoindent' `ai' autoindent - In append mode after a the cursor will move directly below the first character on the previous line. This setting affects the current buffer only. `autoindent-global' `ai-global' Same as `autoindent', but affects all buffers. `noautoindent' `noai' Cancel autoindent. `noautoindent-global' `noai-g' Cancel autoindent-global. `ignorecase' `ic' ignorecase - No distinction between upper and lower cases when searching. `noignorecase' `noic' Cancel ignorecase. `magic' `ma' Regular expressions used in searches; nomagic means no regexps. `nomagic' `noma' Cancel magic. `readonly' `ro' readonly - The file is not to be changed. If the user attempts to write to this file, confirmation will be requested. `noreadonly' `noro' Cancel readonly. `shell=' `sh=' shell - The program to be used for shell escapes (default `$SHELL' (default `/bin/sh')). `shiftwidth=' `sw=' shiftwidth - Gives the shiftwidth (default 8 positions). `showmatch' `sm' showmatch - Whenever you append a `)', Vi shows its match if it's on the same page; also with `{' and `}'. If there's no match, Vi will beep. `noshowmatch' `nosm' Cancel showmatch. `tabstop=' `ts=' tabstop - The length of a ; warning: this is only IN the editor, outside of it s have their normal length (default 8 positions). This setting affects the current buffer only. `tabstop-global' `ts-g' Same as `tabstop', but affects all buffers. `wrapmargin=' `wm=' wrapmargin - In append mode Vi automatically puts a whenever there is a or within columns from the right margin. `wrapscan' `ws' wrapscan - When searching, the end is considered `stuck' to the begin of the file. `nowrapscan' `nows' Cancel wrapscan. `:set