Execute accidentally inserted commands
Talk0
1,599pages on
this wiki
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.
Comments
I guess you meant:
inoremap <somekey> <Esc>u:@.
I prefer
inoremap <somekey> <Esc>u@. i
Also
yy@"
Explanation:
yy yank current line into default register @" execute default recording