> 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
As
:help :normal
says, any insert command started using :normal must be completed
within that :normal command. To do what you want, see
:help :startinsert
Regards,
Gary
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment