Say I entered :e bla/bla/bla.txt and I realize I want to put a ! after the e. Can I get there without using the arrow keys?
Asked
Active
Viewed 504 times
2 Answers
5
Command Line Window
You can use cmdline-window to edit the command line the same way as you would any other window. Enter into this window by pressing <c-f> while on the command line or use q: in normal mode.
There is a similar Vimcasts episode on the subject: Refining search patterns with the command-line window
Command line mappings
The command line also has many of its own mappings to help navigate/modify:
<c-b>/<home>to go to the beginning (Some people remap this to<c-a>to match emacs/bash/readline)<s-left>or shift + left arrow moves to the left oneWORD<c-u>clears the command line completely<c-r>{reg}will put the value of register,{reg}into the line- Many more. See
Q_cefor a quick review.
For more help see:
:h cmdwin
:h cmdline-editing
Peter Rincker
- 15,854
- 1
- 36
- 45
1
From :h cmdline:
CTRL-B or <Home> c_CTRL-B c_<Home> c_Home
cursor to beginning of command-line
CTRL-E or <End> c_CTRL-E c_<End> c_End
cursor to end of command-line
I didn't see any other commands that "jumped" around and didn't use arrow keys. You could do: HomeDel, then type e! (a bit convoluted, I agree).
muru
- 24,838
- 8
- 82
- 143
<c-f>, but I found that using<Esc>followed byq:showed me the unfinished ex mode command in my command line window. – Wildcard Mar 11 '16 at 04:09