On 22:45 Wed 06 Feb     , ping wrote:
> On 2/6/2013 5:39 PM, Marcin Szamotulski wrote:
> > 1) use map <cr> to find out whether the mapping already
> > >exist when you run the code.
> I got "no mapping found"
> > >2) lookup how the the Voom plugin does map <CR> to a key.
> > >There is no python magic - all mappings are done in Vim - so you're
> > >likely to be wrong about assuming its related to python.
> I agree now that I'm wrong on that.
> so I got these from the plugin code:
> 
>   " Which key to map to Select-Node-and-Shuttle-between-Body/Tree
>   if !exists('g:voom_return_key')
>       let g:voom_return_key = '<Return>'
>   endif
> 
> ......
> 
> exe "nnoremap <buffer><silent> ".g:voom_return_key." :<C-u>call 
> Voom_TreeSelect(0)<CR>"
> exe "vnoremap <buffer><silent> ".g:voom_return_key." <Esc>:<C-u>call 
> Voom_TreeSelect(0)<CR>"
> "exe "vnoremap <buffer><silent> ".g:voom_return_key." <Nop>"
> exe "nnoremap <buffer><silent> ".g:voom_tab_key." :<C-u>call 
> Voom_ToTreeOrBodyWin()<CR>"
> exe "vnoremap <buffer><silent> ".g:voom_tab_key." <Esc>:<C-u>call 
> Voom_ToTreeOrBodyWin()<CR>"
> "exe "vnoremap <buffer><silent> ".g:voom_tab_key." <Nop>"
> 
> > >
> > >grep the plugin code for CR and cr and you'll be lucky. Then try using
> > >the right hand side instead of sendig <cr> - you may get more helpful
> > >error messages then.
> this is a bit complex kind of map... so based on that , how can I make a 
> jump within my script?
> I tried:
> exec "<C-u>call Voom_TreeSelect(0)<CR>"
> 
> it seems not work:
> 
> Error detected while processing function QuitNR:
> line   11:
> E488: Trailing characters: <C-u>call Voom_TreeSelect(0)<CR>
> Press ENTER or type command to continue
> 
> 
> thanks.
To call a function it is enough to write:

call VoomTreeSelect(0)

in you vimscript.  However if you want to use :execute command (but you
don't need to):

exe 'call VoomTreeSelect(0)'

Both <c-u> and <cr> are not needed.  An example of a usage of <c-u>  and
<cr> is when you define a map via :exe :

exe 'map E :<C-U>call VoomTreeSelect(0)<CR>'

and I presume you took your syntax from here.  The difference is that
the right hand side of a map is not the same as what exe statement is
using.  :exe executes expressions as an Ex command while the right hand
side of a map is a bunch of normal commands, where ':' is used to enter
the command line.  If you enter it in the visual mode, then it will
start with range '<,>' and <c-u> is used to delete it.

Best,
Marcin

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to