Pablo Giménez wrote:
> 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
>
>     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
>
> 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
>
> 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.
>
Hello:

Please try the attached script (goup.vim); it uses netrw#Call with
"NetrwBrowseUpDir".  You may need to use
http://www.drchip.org/astronaut/vim/index.html#NETRW 's version of
netrw.  There's a problem with that version that I'm trying to address
under Windows, though, so be forewarned.
To use goup.vim:

  :e .

which should go up one directory.

The next step: try unbud.vim.

  :so unbud.vim
  :e .
  u

which also should go up one directory.

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
fun! GoUp()
 call netrw#Call("NetrwBrowseUpDir", 1)
endfunc
call GoUp()

function! UserNetrwBrowseUpDir( islocal )
  call netrw#Call("NetrwBrowseUpDir", a:islocal)
endfunction

let g:Netrw_UserMaps= [["u","UserNetrwBrowseUpDir"]]

Reply via email to