I know that when I am in insert mode I can enter Normal mode for one command only and automatically switch back to insert mode using <C-O>
. For example to go to the end of the line when in Insert mode I could type <C-O>$
I have the following key mapping to format the current paragraph:
nnoremap <leader>fp mtvipgw`t
I would like to trigger this whilst in insert mode by typing <C-O><leader>fp
. Unfortunately this doesn't work and I'm sent back into insert mode after the first command only (mt
) and then the rest of the mapping is typed as normal characters.
How can I make this work?
gw
already put the cursor back in the right spot? Why the marks? I think you could just do<C-o>gwip
gw
behavior in insert mode. Your point is useful and correct, thanks. The question is about triggering multiple commands sequentially after using <C-O>, and the accepted answer is about that problem, notgw
specifically.