In addition to providing the command-line window, Vim also offers some limited features allowing you to interact with the command-line whilst in command-line mode (without using the arrow keys).
Movement
<ctrl-b>
move the cursor to the beginning of the command-line
<ctrl-e>
move the cursor to the end of the command-line
Editing
<ctrl-h>
delete the character before the cursor (like backspace)
<ctrl-w>
delete the word before the cursor
<ctrl-u>
delete all the way from the cursor back to the start of the command-line
You could of course add command-line mappings with :cnoremap
to emulate certain other programs' navigation keys. Or install Tim Pope's RSI plugin to use the de facto standard Readline bindings.
Pasting
You can paste the contents of any register into the command-line at the position of the cursor by pressing <ctrl-r>
followed by the character specifying the register. e.g. <ctrl-r>
,+
will insert the contents of the clipboard into the command-line; <ctrl-r>
,"
will insert the contents of the "unnamed" register (i.e. the contents of your last delete or yank).
See :help cmdline.txt
for further details of all the above.
:q
; this opens a new "buffer-like" window, in which you can usehjkl
for movement,y
for yanking, etc.q:
, right?) Good to know! I had accidentally got there in the past, but not really thought about using it. It doesn't seem to work with/
though (search).