Copy path file with NERDtree Vim plugin

nerdtree, sublimetext, vim

Solution

NERD_tree comes with its own extension system; just put the following fragment into `~/.vim/nerdtree_plugin/yank_mapping.vim`:

call NERDTreeAddKeyMap({
        \ 'key': 'yy',
        \ 'callback': 'NERDTreeYankCurrentNode',
        \ 'quickhelpText': 'put full path of current node into the default register' })

function! NERDTreeYankCurrentNode()
    let n = g:NERDTreeFileNode.GetSelected()
    if n != {}
        call setreg('"', n.path.str())
    endif
endfunction

Of course, you can adapt the default key (`yy`), and register (`"`; use `+` for the clipboard).

Problem

Is there some way to copy the path of a file in the Vim's NERDtree plugin? Better: is there some plugin to make the same operations the SideBarEnhancements plugin of Sublime Text does?

Original source