On Mar 18, 11:25 am, Marc Weber <[email protected]> wrote:
> Tell us in english words what you want to happen if you press your menu when
> which mode is active.
>
> Marc Weber
@Marc, was I writing in german? :)
Marc en Ben,
Thanks for your answer.
I'll give an example.
I have these commands in my menu:
&Delete\ Extra\ Empty\ Lines :%s/^\_s\+/\r/
g<CR>
&Delete\ Extra\ Empty\ Lines\ -[S] :'<,'>s/^\_s\+/
\r/g<CR>
&Delete\ All\ Empty\ Lines :g/^\s*$/d
<CR>
&Delete\ All\ Empty\ Lines\ -[S] :'<,'>g/^\s*$/
d <CR>
&Delete\ from\ Pattern\ to\ Start\ or\ End\ of\ Line :call
<SID>DeleteStartEnd("%")<CR>
&Delete\ from\ Pattern\ to\ Start\ or\ End\ of\ Line\ -[S] :call
<SID>DeleteStartEnd("'<,'>")<CR>
The menu line with [S] is the same as the one above but has to be used
only with selected text.
I have hundreds of double commands.
- One for the whole file.
- One for only selected text.
My question is, is it possible to let Vim detect if text is selected
or not?
@Marc,
This example deselect the text and always return the "n" value:
fun! s:Test()
if mode() == 'v'
echo "v"
else
echo mode()
endif
endfun
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php