Wednesday, December 2, 2009

How to go insert mode in nmap execution

I have a mapping in normal mode. After the mapping execution, I want
to make Vim enters insert mode based on certain criteria. For example,
if it is at the beginning of line, it should enter insert mode.
Otherwise, it should stay in normal mode. I tried to use 'normal i'.
But it doesn't work. Any ideas? below is the script. Thank you.

nmap ss :call MyFoo()<CR>
function! MyFoo()
if col(".") == 1
"go to insert mode
normal i
endif
endfunction

Anna

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: