On 05/11/08 17:57, Boyko Bantchev wrote:
> Hello all,
>
> How can a script detect whether Vim is in video mode?
> The mode() function does not seem to return correct results.
> Thank you!
>
> Boyko B.

The problem is that running a script changes the mode. This explains 
what is said near the bottom of ":help mode()":

>               This is useful in the 'statusline' option or when used
>               with |remote_expr()| In most other places it always returns
>               "c" or "n".
>               Also see |visualmode()|.

Well, what dies visualmode() say? Hm, no, if you've been in Visual mode 
and back you get the latest visual mode, not the fact that you aren't in 
it anymore.

I suppose you could add a function to a custom 'statusline' -- that 
function would return the empty string and, as a side effect, set some 
global or script-local variable to the result of mode(). Not sure if it 
would work though, and even if it does, I'm not sure the game is worth 
the candle.


Best regards,
Tony.
-- 
Keep America beautiful.  Swallow your beer cans.

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

Reply via email to