Viper can edit multiple files. This means, for example that you never need
to suffer through
No write since last change errors.
Some Viper elements are common over all the files.
Textmarkers remember files and positions. If you set marker ‘a’ in file foo, start editing file bar and type 'a, then YOU WILL SWITCH TO FILE foo. You can see the contents of a textmarker using the Viper command [<a-z> where <a-z> are the textmarkers, e.g., [a to view marker ‘a’ .
Command repetitions are common over files. Typing !! will repeat the last ! command whichever file it was issued from. Typing . will repeat the last command from any file, and searches will repeat the last search. Ex commands can be repeated by typing : RET. Note: in some rare cases, that : RET may do something dangerous. However, usually its effect can be undone by typing u.
Registers are common to files. Also, text yanked with y can be put back (p) into any file. The Viper command ]<a-z>, where <a-z> are the registers, can be used to look at the contents of a register, e.g., type ]a to view register ‘a’.
There is one difference in text deletion that you should be aware of. This difference comes from Emacs and was adopted in Viper because we find it very useful. In Vi, if you delete a line, say, and then another line, these two deletions are separated and are put back separately if you use the ‘p’ command. In Emacs (and Viper), successive series of deletions that are not interrupted by other commands are lumped together, so the deleted text gets accumulated and can be put back as one chunk. If you want to break a sequence of deletions so that the newly deleted text could be put back separately from the previously deleted text, you should perform a non-deleting action, e.g., move the cursor one character in any direction.
The current directory name for a file is automatically prepended to the file name in any :e, :r, :w, etc., command (in Emacs, each buffer has a current directory). This directory is inserted in the minibuffer once you type space after :e, r, etc. Viper also supports completion of file names and Ex commands (TAB), and it keeps track of command and file history (M-p, M-n). Absolute filenames are required less often in Viper.
You should be aware that Emacs interprets /foo/bar//bla as /bla and /foo/~/bar as ~/bar. This is designed to minimize the need for erasing file names that Emacs suggests in its prompts, if a suggested file name is not what you wanted.
The command :cd will change the default directory for the current Emacs buffer. The Ex command :e will interpret the filename argument in ‘csh’, by default. See Customization, if you want to change this.
Currently undisplayed files can be listed using the :ar command. The command :n can be given counts from the :ar list to switch to other files. For example, use ‘:n3’ to move to the third file in that list.