Last Updated: February 25, 2016
·
1.364K
· nxqd

Run the last command in Vim

There are many cases that you need to run the last command in Vim. Normally, we have to enter exmode then up then enter. Let's save some keystroke by creating a shortcut for it:

map <leader>l :<Up><CR>

As you can see, now it takes 2 key strokes, so do we just only save one. Yes we do, but still, you bind it to <leader> which is the key you use a lot and also the next key has it's meaning : l for last.

4 Responses
Add your response

Couldn't this be done by doing @: as well?

over 1 year ago ·

What about using the '.' command ?

over 1 year ago ·

This one is for running the last command in ex mode. 'dot' is for normal mode :)

over 1 year ago ·

@Kevin: Yes it can be done in the same way, but I find that @: take two key strokes but it's hard to remember but may it's me only :)

over 1 year ago ·