Wednesday, April 3, 2013

Re: clicking to open folds in Gui?

AK wrote:
> 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 will support leftmouse clicks to toggle folds:
nno <silent> <leftmouse> <leftmouse>:exe 'silent! normal!
'.((foldclosed('.')>0)? 'zMzx' : 'zc')<cr>:norm! z.<cr>

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment