Loading ...
Sorry, an error occurred while loading the content.

Re: clicking to open folds in Gui?

Expand Messages
  • AK
    ... 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

      ---
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Charles Campbell
      ... The following variant will support leftmouse clicks to toggle folds: nno :exe silent! normal! .((foldclosed( . ) 0)?
      Message 2 of 9 , Apr 3, 2013
      • 0 Attachment
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Charles Campbell
        Here s another fold-related mapping I use: nno :SWP [[:let b:topfunc= line( . ) ][:let b:botfunc= line( . ) :exe b:topfunc ,
        Message 3 of 9 , Apr 3, 2013
        • 0 Attachment
          Here's another fold-related mapping I use:

          nno <silent> <c-space> :SWP<cr>[[:let b:topfunc= line(".")<cr>][:let
          b:botfunc= line(".")<cr>:exe b:topfunc "," b:botfunc "foldo"<bar>unlet
          b:topfunc b:botfunc<bar>RWP<cr>

          You'll need my cecutil plugin, though: see
          http://www.drchip.org/astronaut/vim/index.html#CECUTIL . What it does,
          using a comment I have in my .vimrc:

          " <c-space>: open all folds between [[ to ][ (ie. unfold the current
          function)

          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.