Re-execute command by :history option in VIM

vim

Solution

`:history` is only there for you to look at it.

To re-execute a previous command, you have two options:

Use `<Up>` and `<Down>` at the command prompt:

:m10
(do stuff)
:<Up>

Use the "command-line window":

You can call it with `q:` and navigate with search and use the beautiful normal mode commands we all love.

Position the cursor on a line and hit `<CR>` to re-execute the command.

Edit a command and hit `<CR>` to execute the new command.

You can quit the command-line window with `:q`.

See `:help cmdline-window`.

Problem

How can you execute a command again listed in the ``` :history ``` option in vim. There are numbers shown. Is the only way to copy the command by hand, then re-enter it? Or is there something like in shell script.

Original source