ivan budiselic schrieb:
> Hi,
> 
> I'm wondering if it's possible to get the insert mode cursor position in
> Vim-script. col() and virtcol() don't really solve my problem because in
> order to invoke my function, I'm using a mapping like
> 
> imap <F2> <Esc>:call functionname()<CR>i

instead, call the function with i_CTRL-R

    :imap <F2> <C-R>=FuncName()<CR>

and let the function return the empty string "" .

> so by the time the function is called, Vim is in normal mode. Now this
> causes a problem, because a line like "abcd" (quotes for clarity) has only
> four cursor positions in normal mode, but five cursor positions in insert
> mode. So col() doesn't differentiate between "|abcd" and "a|bcd". I'm not
> really sure what virtcol() is doing (from reading :help virtcol()), but it
> isn't solving my problem either.

you'll get a column position>=1 "to the right" of the cursor

    :imap <F2> <C-R>=col(".")<CR>

> So, does anyone know how to differentiate between these two cases.
> 
> Thanks,
> Ivan

-- 
Andy


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

Reply via email to