Created
October 11, 2009 10:33
-
-
Save scrooloose/207594 to your computer and use it in GitHub Desktop.
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
"Originally -> http://gist.github.com/206863 | |
"YAY gist forking is broken! | |
" Requires: Utl | |
if !exists("loaded_utl") | |
finish | |
endif | |
call NERDTreeAddKeyMap({ | |
\ 'key': 'gu', | |
\ 'callback': 'NERDTreeOpenCurrentNodeWithUtl', | |
\ 'quickhelpText': 'open with Utl plugin' }) | |
function! NERDTreeOpenCurrentNodeWithUtl() | |
" Get the path of the item under the cursor if possible: | |
let currentFile = g:NERDTreeFileNode.GetSelected() | |
if currentFile == {} | |
return | |
endif | |
let link = currentFile.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