Georg Dahn schrieb: > Andy Wokula wrote: >> visualmode() and :vmap <expr> don't work together well: >> >> I wanted a map for the "v" key in Visual mode to toggle between >> characterwise and blockwise Visual mode. I thought this would work: >> >> :vno <expr> v visualmode()==#"v" ? "<c-v>" : "v" >> >> but it didn't (and doesn't), because visualmode() returns the type of >> the _previously_ used Visual mode. >> >> visualmode() has no option for returning the current visual mode so >> I think this is a bug. > > In Vim help (:h visualmode()) the following is written: > >> The result is a String, which describes the last Visual mode >> used in the current buffer. Initially it returns an empty >> string, but once Visual mode has been used, it returns "v", >> "V", or "<CTRL-V>" (a single CTRL-V character) for >> character-wise, line-wise, or block-wise Visual mode >> respectively. > > Thus, this is no bug, but a feature. If you want to know the current > mode, just use the function mode(): > > :h mode() > > This function does what you need. > > Best wishes, > Georg
Ah, ok. Thx :-) -- Andy --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
