Created
October 10, 2009 14:39
-
-
Save AndrewRadev/206863 to your computer and use it in GitHub Desktop.
NERDTree integration with Utl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Requires: Utl | |
call NERDTreeAddKeyMap({ | |
\ 'key': 'gu', | |
\ 'callback': 'OpenCurrentNodeWithUtl', | |
\ 'quickhelpText': 'open current node with the Utl plugin' }) | |
function! OpenCurrentNodeWithUtl() | |
" Get the path of the item under the cursor if possible: | |
let currentDir = g:NERDTreeFileNode.GetSelected() | |
if currentDir == {} | |
return | |
endif | |
let link = currentDir.path.str() | |
" Convert it to the format Utl expects: | |
let link = substitute(link, '\', '/', 'g') | |
let link = substitute(link, ' ', '%20', 'g') | |
let link = 'file://' . link | |
silent call Utl('openLink', link) | |
redraw! | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment