Boyko Bantchev wrote: > 2008/11/5 Tony Mechelynck <[EMAIL PROTECTED]>: > >> On 05/11/08 18:38, Tim Chase wrote: >> >>>> How can a script detect whether Vim is in video mode? >>>> The mode() function does not seem to return correct results. >>>> >>> "video mode"?? you'll have to expand on what you expect this to >>> :)mean. >>> >> [...] >> >> I think he meant _visual_ mode but of course I can't be sure. >> > > Yes, I did mean visual mode but mistyped .... > I am trying to write a script that does :'<,'>!someprogram > but if there is no visual selection, it would print an error message. > Is your "someprogram" evoked via a map?
If so, then a reliable way to differentiate between having been called via a nmap vs a vmap is to pass an argument along; please see the example which follows: nmap <Leader>X :call SomeFunction(0)<cr> vmap <Leader>X :<c-u>call SomeFunction(1)<cr> fun! SomeFunction(isvis) echomsg "isvis=".a:isvis endfun Regards, Chip Campbell --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
