1

As title. Given that I'm already in insert mode and there is some insert mode function. Inside the function, I want to insert a space by command, how?

1
  • if you are inside an insert mode function just returning ' ' does not work (e.g. returning a space)? May 18, 2022 at 11:22

1 Answer 1

0

something like the following snippet works while in Insert Mode and typing <C-o>:call Testing()

function! Testing()
  echom 'testing...'
  exec 'normal! i '
  echom 'done.'
endfunction

(added it to my .vimrc for testing)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.