Primary Navigation

Re: clicking to open folds in Gui?

... I actually would love to use mouse click for that, BUT: 1. it doesn t work for me, instead moving 1 char to the right, like l. 2. if I get it to work, how

Message 1 of 9
, Apr 2, 2013

0 Attachment

On 04/02/2013 02:17 PM, Charles Campbell wrote:

> I use the following mapping:
>
> nno <silent> <space> :exe 'silent! normal! '.((foldclosed('.')>0)?
> 'zMzx' : 'zc')<cr>
>
> Its not a click mapping, obviously -- but it makes the space bar a
> toggle for the folding under the cursor. I suppose that instead of
> <space> one could put <leftmouse> or whatever.

I actually would love to use mouse click for that, BUT:

1. it doesn't work for me, instead moving 1 char to the right, like l.

2. if I get it to work, how can I make it behave as a normal click when
it's not on a fold?

Thanks! -ak

--
--
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

> On 04/02/2013 02:17 PM, Charles Campbell wrote:
>> I use the following mapping:
>>
>> nno <silent> <space> :exe 'silent! normal! '.((foldclosed('.')>0)?
>> 'zMzx' : 'zc')<cr>
>>
>> Its not a click mapping, obviously -- but it makes the space bar a
>> toggle for the folding under the cursor. I suppose that instead of
>> <space> one could put <leftmouse> or whatever.
>
>
> I actually would love to use mouse click for that, BUT:
>
> 1. it doesn't work for me, instead moving 1 char to the right, like l.
>
> 2. if I get it to work, how can I make it behave as a normal click when
> it's not on a fold?
>
> Thanks! -ak
>

The following variant supports leftmouse clicks when on folds, and does
nothing when not in a fold: (ie. it doesn't toggle, and also centers
the fold)
nno <silent> <leftmouse> <leftmouse>:exe 'sil! norm!
'.((foldclosed('.')>0)? 'zMzxz.' : '')<cr>

Regards,
C Campbell

--
--
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