Skip to content

Instantly share code, notes, and snippets.

@scrooloose
Created October 11, 2009 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scrooloose/207594 to your computer and use it in GitHub Desktop.
Save scrooloose/207594 to your computer and use it in GitHub Desktop.
"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