Cancel the command line without executing it
Ctrl-c
Example
Command-line 0 / 1Normal 1 / 1Cancel the command line without executing it.
Command line
- Prompt
:let g:exampleCount = 9- Insertion column
23- Editing mode
Insert- Completion menu
inactive
Command history
Vim messages
Empty
- Last status message
- Last warning
Example variables
- g:exampleCount
0
Command applied
Command line
- Prompt
- Insertion column
0- Editing mode
Inactive- Completion menu
inactive
Command history
- 1
let g:exampleCount = 9
Vim messages
Empty
- Last status message
- Last warning
Example variables
- g:exampleCount
0
Before & after
Before
Command line
- Prompt
:let g:exampleCount = 9- Insertion column
23- Editing mode
Insert- Completion menu
inactive
Command history
Vim messages
Empty
- Last status message
- Last warning
Example variables
- g:exampleCount
0
After
Command line
- Prompt
- Insertion column
0- Editing mode
Inactive- Completion menu
inactive
Command history
- 1
let g:exampleCount = 9
Vim messages
Empty
- Last status message
- Last warning
Example variables
- g:exampleCount
0
Start in Command-line mode. The prompt contains a pending assignment of 9, while g:exampleCount is visibly 0. This cancellation leaves the variable at 0 because the assignment is not submitted.
one two
three four
five six
keepCursor on line 1, column 1Details & Vim help
Example replayed in Vim
Cancel the command line without executing it. Use while editing a command or search prompt. Ctrl-c abandons that prompt. Escape can start the entered command when cpoptions contains x or when supplied by a mapping. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.