Thursday, February 7, 2013

Re: vim: help for scripting

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



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@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: