Vim Tips Wiki

Execute accidentally inserted commands

Revision as of 09:06, September 29, 2008 by JohnBot (Talk | contribs)

1,619pages on
this wiki
Tip 637 Printable Monobook Previous Next

created January 17, 2004 · complexity basic · author Jochen Behrens · version 5.7

If you are in insert mode and typed a command for normal mode, you can use it.

inoremap <somekey> <Esc>u@.

This mapping switches to normal mode, undoes the last insertion and takes it as a command.

Most times I need it, if I typed dd and the line still remains because of Insert-Mode and the unwanted 'dd' ist somewhere in my text.


I guess you meant:

inoremap <somekey> <Esc>u:@.

I prefer

inoremap <somekey> <Esc>u@. i




yy yank current line into default register
@" execute default recording

Around Wikia's network

Random Wiki