History is provided for Ex commands, Vi searches, file names, pieces of text inserted in earlier commands that use Insert or Replace state, and for destructive commands in Vi state. These are useful for fixing those small typos that screw up searches and :s, and for eliminating routine associated with repeated typing of file names or pieces of text that need to be inserted frequently. At the : or / prompts in the Minibuffer, you can do the following:
M-p and M-n | To move to previous and next history items. This causes the history items to appear on the command line, where you can edit them, or simply type Return to execute. |
M-r and M-s | To search backward and forward through the history. |
RET
|
Type RET to accept a default (which is displayed in the prompt).
|
The history of insertions can be perused by typing C-c M-p and C-c M-n while in Insert or Replace state. The history of destructive Vi commands can be perused via the same keys when Viper is in Vi state. See Viper Specials, for details.
All Ex commands have a file history. For instance, typing :e, space and then M-p will bring up the name of the previously typed file name. Repeatedly typing M-p, M-n, etc., will let you browse through the file history.
Similarly, commands that have to do with switching buffers have a buffer history, and commands that expect strings or regular expressions keep a history on those items.
Undo and Backups Improvements over Vi Macros and Registers