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.
- dialing up the command-line window.
: switch to Command-Line mode
previous and next Ex command can filter the command by pretype:
:co
previous and next Ex comand can not filter the command, just previous and next comand
Note: By default, Vim records the last twenty commands, you can set by : set history=200
in vimrc.
/ switch to search prompt
all keys can use like before.
Meet the Command-Line Window
Note: Avoid the Cursor Keys When Recalling Commands from History. you can create the mapping:
cnoremap <C-p> <Up> cnoremap <C-n> <Down>
meet the command-line window.
Note: The Command-Line window is like a regular Vim buffer, where each line contains an item from our history. h, j, k, l
can use, when you press the <CR> key, the contents of the current line are executed as an Ex command.
Press <CR> to execute the :update | !ruby %
command.