New to vimscript. I am trying to invoke a function in insert-mode. The function is a bit complicated, but I am stuck at running "normal!".
Here is the mapping:
inoremap <buffer> <expr> <c-o> Tmp2() nnoremap <buffer> <c-o> :call Tmp2()<cr>
Here is a very simple func that demonstrates my problem
function! Tmp2() normal! yiW echom @@ return @@ endfunction
When I run the command in normal mode, it works fine. When I am in insert mode I get:
Line 1: E523: Not allowed here