Is there a way to interact with the command-line mode while always remaining in the home position?

In particular, the following two actions are cumbersome, requiring moving the fingers away to the arrow keys and sometimes worse, the mouse.

  1. Moving around: Is there a way to move back and forth in the command-line mode while remaining in the usual position?
  2. How can you copy and paste on the command-line? I mean copying both from part of the command-line itself to another part, or from the text or even clipboard.
  • 1
    Both can be solved by using the command-line window with :q; this opens a new "buffer-like" window, in which you can use hjkl for movement, y for yanking, etc. Mar 2, 2015 at 13:51
  • 1
    @Carpetsmoker (you mean 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).
    – Shahbaz
    Mar 2, 2015 at 14:13
  • Oops, yes, I meant q: ... I never used it much, so I can't give you a full/proper answer... Mar 2, 2015 at 15:10

2 Answers 2


There's the command-line (that you know), and there's the command-line window (the command-line in a special buffer, which you can edit just like any other). You enter this either via <C-f> from the command-line (also for / searches etc.) when you feel the need for more "editing power", or directly from normal mode via the dedicated q:, q/, etc. commands.

Read more about this at :help command-line-window.

  • 4
    <C-f> is very useful to know, since it works after you are already half-way through the command.
    – Shahbaz
    Mar 2, 2015 at 14:20
  • 1
    I agree; the : comes almost automatically for me, so it's good to be able to switch without going back to normal mode. Mar 2, 2015 at 14:21

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).


  • <ctrl-b> move the cursor to the beginning of the command-line
  • <ctrl-e> move the cursor to the end of the command-line


  • <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.


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.

  • 1
    Awesome! <ctrl-r> would be particularly useful.
    – Shahbaz
    Mar 3, 2015 at 15:57
  • Yes, I've even used ^R for macros. It has let me perform super tricky manipulations of text by yanking part of the file during the macro, and later, also during the macro, using the yanked part in a long Ex-mode command with ^R. :)
    – Wildcard
    Oct 30, 2015 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.