Hello.
I want to customize some of the shortcuts in Netrw.
I have seen it provides a global variable which is a dictionary of key mappings and function calls.
I paste here a snippet from the help:
Example: Clear netrw's marked file list via a mapping on gu >
" ExampleUserMap: {{{2
fun! ExampleUserMap(islocal)
call netrw#Modify("netrwmarkfilelist",[])
call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"")
let retval= ["refresh"]
return retval
endfun
" ExampleUserMap: {{{2
fun! ExampleUserMap(islocal)
call netrw#Modify("netrwmarkfilelist",[])
call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"")
let retval= ["refresh"]
return retval
endfun
let g:Netrw_UserMaps= [["gu","ExampleUserMap"]]
What I am trying to do is to use this mechanism to map u to browse up dir rather than -, so I did the next:
function! utils#UserNetrwBrowseUpDir( islocal )
call netrw#Call("NetrwBrowseUpDir", 1)
endfunction
call netrw#Call("NetrwBrowseUpDir", 1)
endfunction
let g:Netrw_UserMaps= [["u","utils#UserNetrwBrowseUpDir"]]
Well the mapping is working, using netrw#Call() I can call internal functions in netrw.vim,
but I got an error in NetrwBrowseUpDir( islocal ), basically the argument is passed as a list whereas it should be a number.
This is netrw#Call()
fun! netrw#Call(funcname,...)
if a:0 > 0
exe "call s:".a:funcname."(".string(a:000).")"
else
exe "call s:".a:funcname."()"
endif
endfun
if a:0 > 0
exe "call s:".a:funcname."(".string(a:000).")"
else
exe "call s:".a:funcname."()"
endif
endfun
I don't know how I have to pass my argument to netrw#Call() in order to be passed as a single integer to NetrwBrowseUpDir() .
Thanks and sorry for the long email.
P
--
Un saludo
Best Regards
Pablo Giménez
Best Regards
Pablo Giménez
--
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/d/optout.
No comments:
Post a Comment