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

Re: vim: help for scripting

Expand Messages
  • Marc Weber
    ... Let s you overide the key. ... THis means fill in the setting defined above. Thus its basically: nnoremap : call
    Message 1 of 15 , Feb 7, 2013
    • 0 Attachment
      > if !exists('g:voom_return_key')
      > let g:voom_return_key = '<Return>'
      > endif

      Let's you overide the <CR> key.

      > exe "nnoremap <buffer><silent> ".g:voom_return_key." :<C-u>call Voom_TreeSelect(0)<CR>"
      THis means fill in the setting defined above. Thus its basically:

      nnoremap <buffer><silent> <CR> :<c-u>call Voom_TreeSelect(0)

      You only want what vim call the RHS (righthandside): call Voom_TreeSelect(...)
      Use that instead of normal "<cr>"

      At least you should have enough info now to find a way to succeed.

      Marc Weber

      --
      --
      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.
    • ping
      ... thanks for all of those good info, it s really nice to learn. I ve saved these notes and later references also. now with this: call Voom_ToTreeOrBodyWin()
      Message 2 of 15 , Feb 7, 2013
      • 0 Attachment
        On 2/7/2013 7:08 AM, Marc Weber wrote:
        >> if !exists('g:voom_return_key')
        >> let g:voom_return_key = '<Return>'
        >> endif
        > Let's you overide the <CR> key.
        >
        >> exe "nnoremap <buffer><silent> ".g:voom_return_key." :<C-u>call Voom_TreeSelect(0)<CR>"
        > THis means fill in the setting defined above. Thus its basically:
        >
        > nnoremap <buffer><silent> <CR> :<c-u>call Voom_TreeSelect(0)
        >
        > You only want what vim call the RHS (righthandside): call Voom_TreeSelect(...)
        > Use that instead of normal "<cr>"
        >
        > At least you should have enough info now to find a way to succeed.
        >
        > Marc Weber
        >
        thanks for all of those good info, it's really nice to learn.
        I've saved these notes and later references also.

        now with this:
        call Voom_ToTreeOrBodyWin()

        in my script:
        function! QuitNR()
        "get number of one win in voom
        let wn_curr=winnr()

        "normal <CR>
        call Voom_ToTreeOrBodyWin()

        let wn_pair=winnr()
        let wn_larger=wn_curr > wn_pair ? wn_curr : wn_pair
        let wn_smaller=wn_curr < wn_pair ? wn_curr : wn_pair

        "jump larger win first
        exec wn_larger . "wincmd w"
        "close the win
        close
        "then jump to the smaller win and close it out
        exec wn_smaller . "wincmd w"
        close
        endfu
        nn vV :call QuitNR()<CR>

        I succeed!

        thanks for all the helps and good notes! you guys make this alias
        extremely helpful...



        regards
        ping


        --
        --
        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.
      • Benji Fisher
        Maybe this is too little, too late, but your syntax was wrong. If you want to emulate hitting Enter, then the right way is ... (and scroll down to the
        Message 3 of 15 , Feb 7, 2013
        • 0 Attachment
          Maybe this is too little, too late, but your syntax was wrong.  If you want to emulate hitting Enter, then the right way is

          :execute "normal \<CR>"

          :help :normal

          (and scroll down to the example).

          -- 
          HTH
          Benji Fisher


          On Thu, Feb 7, 2013 at 9:21 AM, ping <songpingemail@...> wrote:
          On 2/7/2013 7:08 AM, Marc Weber wrote:
             if !exists('g:voom_return_key')
                 let g:voom_return_key = '<Return>'
             endif
          Let's you overide the <CR> key.
           
          exe "nnoremap <buffer><silent> ".g:voom_return_key." :<C-u>call Voom_TreeSelect(0)<CR>"
          THis means fill in the setting defined above. Thus its basically:

          nnoremap <buffer><silent> <CR> :<c-u>call Voom_TreeSelect(0)

          You only want what vim call the RHS (righthandside): call Voom_TreeSelect(...)
          Use that instead of normal "<cr>"

          At least you should have enough info now to find a way to succeed.

          Marc Weber

          thanks for all of those good info, it's really nice to learn.
          I've saved these notes and later references also.

          now with this:
          call Voom_ToTreeOrBodyWin()

          in my script:
          function! QuitNR()
              "get number of one win in voom
              let wn_curr=winnr()

              "normal <CR>
              call Voom_ToTreeOrBodyWin()


              let wn_pair=winnr()
              let wn_larger=wn_curr > wn_pair ? wn_curr : wn_pair
              let wn_smaller=wn_curr < wn_pair ? wn_curr : wn_pair

              "jump larger win first

              exec wn_larger . "wincmd w"
              "close the win
              close
              "then jump to the smaller win and close it out

              exec wn_smaller . "wincmd w"
              close
          endfu
          nn vV :call QuitNR()<CR>

          I succeed!

          thanks for all the helps and good notes! you guys make this alias extremely helpful...



          regards
          ping



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



          --
          --
          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.
           
           
        • ping
          ... ohhh...this looks a more generic solution... it works perfectly in all cases! thanks! -- -- You received this message from the vim_use maillist. Do not
          Message 4 of 15 , Feb 7, 2013
          • 0 Attachment
            On 2/7/2013 1:47 PM, Benji Fisher wrote:
            > Maybe this is too little, too late, but your syntax was wrong. If you
            > want to emulate hitting Enter, then the right way is
            >
            > :execute "normal \<CR>"
            >
            > :help :normal
            ohhh...this looks a more generic solution...
            it works perfectly in all cases! thanks!

            --
            --
            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.
          • Vlad Irnov
            ... Hi Ping, Please use the github page or email me directly for any VOoM-specific requests. Scripting of VOoM should not be attempted without my supervision!
            Message 5 of 15 , Feb 7, 2013
            • 0 Attachment
              On 2/7/13, ping <songpingemail@...> wrote:
              > On 2/7/2013 7:08 AM, Marc Weber wrote:
              >>> if !exists('g:voom_return_key')
              >>> let g:voom_return_key = '<Return>'
              >>> endif
              >> Let's you overide the <CR> key.
              >>
              >>> exe "nnoremap <buffer><silent> ".g:voom_return_key." :<C-u>call
              >>> Voom_TreeSelect(0)<CR>"
              >> THis means fill in the setting defined above. Thus its basically:
              >>
              >> nnoremap <buffer><silent> <CR> :<c-u>call Voom_TreeSelect(0)
              >>
              >> You only want what vim call the RHS (righthandside): call
              >> Voom_TreeSelect(...)
              >> Use that instead of normal "<cr>"
              >>
              >> At least you should have enough info now to find a way to succeed.
              >>
              >> Marc Weber
              >>
              > thanks for all of those good info, it's really nice to learn.
              > I've saved these notes and later references also.
              >
              > now with this:
              > call Voom_ToTreeOrBodyWin()
              >
              > in my script:
              > function! QuitNR()
              > "get number of one win in voom
              > let wn_curr=winnr()
              >
              > "normal <CR>
              > call Voom_ToTreeOrBodyWin()
              >
              > let wn_pair=winnr()
              > let wn_larger=wn_curr > wn_pair ? wn_curr : wn_pair
              > let wn_smaller=wn_curr < wn_pair ? wn_curr : wn_pair
              >
              > "jump larger win first
              > exec wn_larger . "wincmd w"
              > "close the win
              > close
              > "then jump to the smaller win and close it out
              > exec wn_smaller . "wincmd w"
              > close
              > endfu
              > nn vV :call QuitNR()<CR>
              >
              > I succeed!
              >
              > thanks for all the helps and good notes! you guys make this alias
              > extremely helpful...

              Hi Ping,

              Please use the github page or email me directly for any VOoM-specific
              requests.

              Scripting of VOoM should not be attempted without my supervision! All
              plugin functions are global because this is how I like it, but you
              cannot just call any function from any buffer.

              Closing windows one by one is a bit complicated. There is utility
              function Voom_DeleteOutline([command]) which you can use to
              simultaneously close the current window and to delete the associated
              Tree buffer, if any. See VOoM help for details, section
              |voom_quit|. In your case, define a global mapping like this:
              :nnoremap <silent> vV :call Voom_DeleteOutline('close')<CR>
              Then you can get rid of both the source window and the associated Tree
              buffer with at most two commands: move to the source window (<Cr> or
              <Tab>) and press "vV". Instead of 'close' you can specify 'bd' or 'bw'
              or 'q'.

              Regards, Vlad

              --
              --
              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.
            • ping
              ... thanks Vlad, that s definitely more neat way. but what if I want to archive the same effect regardless of which window my cursor is currently is, body or
              Message 6 of 15 , Feb 7, 2013
              • 0 Attachment
                On 2/7/2013 8:10 PM, Vlad Irnov wrote:
                |voom_quit|. In your case, define a global mapping like this:
                    :nnoremap <silent> vV :call Voom_DeleteOutline('close')<CR>
                Then you can get rid of both the source window and the associated Tree
                buffer with at most two commands: move to the source window (<Cr> or
                <Tab>) and press "vV". Instead of 'close' you can specify 'bd' or 'bw'
                or 'q'.
                thanks Vlad, that's definitely more neat way.
                but what if I want to archive the same effect regardless of which window my cursor is currently is, body or tree?
                I did a quick test, and it looks as you pointed out I need to move my cursor in the body and invoke the Voom_DeleteOutline() function.
                the reason I wanted the "jump"-and-"record the winnr" method is to make sure I got the same result regardless of my positon (body or tree).

                b.t.w, it may looks a stupid desire that why I need this, the real driver is that I'm using nrrw over Voom. so very frequently I need to invoke a new
                nrrwrgn over the VOom-ed buffer, highlight/outline it with voom again (now I have 2 pairs of Voom-ed buffer --- 4 windows),
                and I need to close the 2 new windows after that quick work done.

                regards
                ping
                 


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