Retrieve previous command-line from history that matches pattern before the cursor
<Up>
Example
Command-line 0 / 1Command-line 1 / 1Retrieve previous command-line from history that matches pattern before the cursor.
Command line
- Prompt
:- Insertion column
1- Editing mode
Insert- Completion menu
inactive
Command history
- 1
echo 1- 2
echo 2
Vim messages
Empty
- Last status message
- Last warning
Command line open · edit or submit
Command line
- Prompt
:echo 2- Insertion column
7- Editing mode
Insert- Completion menu
inactive
Command history
- 1
echo 1- 2
echo 2
Vim messages
Empty
- Last status message
- Last warning
Before & after
Before
Command line
- Prompt
:- Insertion column
1- Editing mode
Insert- Completion menu
inactive
Command history
- 1
echo 1- 2
echo 2
Vim messages
Empty
- Last status message
- Last warning
After
Command line
- Prompt
:echo 2- Insertion column
7- Editing mode
Insert- Completion menu
inactive
Command history
- 1
echo 1- 2
echo 2
Vim messages
Empty
- Last status message
- Last warning
Start in Command-line mode.
one two
three four
five six
keepCursor on line 1, column 1Details & Vim help
Example replayed in Vim
Retrieve previous command-line from history that matches pattern before the cursor. Use while editing a : command or / or ? search prompt; this edits or controls that prompt rather than running an Ex command. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.