Thursday, February 7, 2013

Re: vim: help for scripting

On 2/7/13, ping <songpingemail@gmail.com> 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@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: