Tip 34Recall Commands from History

Vim records the commands that we enter in Command-Line mode and provides two ways of recalling them: scrolling through past command-lines with the cursor keys or dialing up the command-line window.

Vim keeps a history of our activity in Command-Line mode. We can easily recall previous commands, so there’s no need to type out a long Ex command at the prompt more than once.

To begin with, let’s switch to Command-Line mode by pressing the : key. Leave the prompt empty; then press the <Up> arrow key. The command line should be populated with the most recent Ex command that we executed. We can use the <Up> key again to go further back through our Ex command history or use the <Down> key to go in the opposite ...

Get Practical Vim, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.