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

Re: clicking to open folds in Gui?

Expand Messages
  • Charles Campbell
    ... Hello! I use the following mapping: nno :exe silent! normal! .((foldclosed( . ) 0)? zMzx : zc ) Its not a click mapping,
    Message 1 of 9 , Apr 2, 2013
      Ben Fritz wrote:
      > On Tuesday, April 2, 2013 12:15:12 PM UTC-5, Linda W wrote:
      >> Is there an option or .vim addon that would allow me to click
      >>
      >> on the plus of a folded section and have it expand it?
      >>
      >>
      >>
      >> Closing might not be as intuitive -- if using fold method
      >>
      >> marker (#{{{1), maybe clicking on that marker would close it?
      >>
      >>
      >>
      >> It's just that I saw the + there on a fold and it looked like
      >>
      >> those graphs that you can click on to expand that section...and wondered
      >>
      >> if there was anything in vim that could do that...
      >>
      > I think you're looking for the 'foldcolumn' option. Clicking the + or - in the column displayed when this option is set to non-zero will expand or collapse folds.
      >
      Hello!

      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.

      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.
    • Linda W
      ... Yes and no -- there was an existing + displayed where the fold was that didn t take an extra column that I was wanting to click on. However, the
      Message 2 of 9 , Apr 2, 2013
        Ben Fritz wrote:
        >> I think you're looking for the 'foldcolumn' option. Clicking the + or - in the column displayed when this option is set to non-zero will expand or collapse folds.
        >>

        Christian Brabandt wrote:
        > You can, if you set the foldcolumn option to some value larger than
        > zero. A click there will close an open fold and open a closed fold. See
        > also the documentation at :h fold-foldcolumn
        > regards,
        > Christian
        >
        ----
        Yes and no -- there was an existing + displayed where the fold was
        that didn't take
        an extra column that I was wanting to click on.

        However, the fold-column option offers other benefits in navigation, so
        it might suit me better! I'll have to play w/it and see how it grows on
        me...

        Thanks!



        Charles Campbell wrote:
        > nno <silent> <space> :exe 'silent! normal!
        > '.((foldclosed('.')>0)? 'zMzx' : 'zc')<cr>
        > I suppose that instead of <space> one could put <leftmouse> or whatever.

        (and maybe I'll throw in that space bar mapping too, just for kicks on a
        mouseclick...
        ;->


        --
        --
        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.
      • tooth pik
        ... I can vouch for the space mapping -- I ve been using it for a looong time and it s great -- -- You received this message from the vim_use maillist. Do
        Message 3 of 9 , Apr 2, 2013
          On Tue, Apr 02, 2013 at 04:19:50PM -0700, Linda W wrote:


          > Ben Fritz wrote:
          > Christian Brabandt wrote:
          > Charles Campbell wrote:
          > > nno <silent> <space> :exe 'silent! normal!
          > > '.((foldclosed('.')>0)? 'zMzx' : 'zc')<cr>
          > > I suppose that instead of <space> one could put <leftmouse> or whatever.

          > (and maybe I'll throw in that space bar mapping too, just for kicks on a
          > mouseclick...
          > ;->

          I can vouch for the space mapping -- I've been using it for a looong
          time and it's great

          --
          --
          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.
        • 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 4 of 9 , Apr 2, 2013
            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 5 of 9 , Apr 3, 2013
              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 6 of 9 , Apr 3, 2013
                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.