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?
2 Answers
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_ce
for a quick review.
For more help see:
:h cmdwin
:h cmdline-editing
-
I didn't know about
<c-f>
, but I found that using<Esc>
followed byq:
showed me the unfinished ex mode command in my command line window.– WildcardMar 11, 2016 at 4:09
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).