6

Sometimes in Vim, I'm typing a command and realise that I could really use Vim's motion commands for navigating the command-line:

  • :s/somthing/else/
  • realise that I misspelled something.
  • Fmae and be done with it.

Of course, trying this would just put Fmae at the end of the command. Is there any way to get (a subset of) the vim commands into the vim command-line? After all, that's what it does.

2 Answers 2

5

When i need to edit a long command in command line, i use q+:

then i see a list of my last commands and i can move with regular vim motions and it's easy to edit.

1

Use Ctrl+F on the command line.

It will bring you to the same pop-up window as q: would bring you in normal mode. You can edit any command there. To execute press Enter.

As a bonus use the same Ctrl+F in search mode as well or use q\ in normal mode

The Mnemonic for F in Ctrl+F might be Full history, Find in history

You must log in to answer this question.