Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a command to visit the homepage of a Bundle #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions autoload/vundle.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ com! -nargs=? -bang PluginClean
com! -nargs=0 PluginDocs
\ call vundle#installer#helptags(g:vundle#bundles)

com! -nargs=1 PluginVisitHome
\ call vundle#scripts#visit_bundle_home(<q-args>)

" Aliases
com! -nargs=* -complete=custom,vundle#scripts#complete PluginUpdate PluginInstall! <args>

Expand Down
45 changes: 45 additions & 0 deletions autoload/vundle/scripts.vim
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,51 @@ func! vundle#scripts#view(title, headers, results)
endf


" ---------------------------------------------------------------------------
" Open the homepage of the given plugin in a browser. If the plugin is a
" local one :Explore it.
"
" arg: A plugin specification like for :Plugin
" ---------------------------------------------------------------------------
func! vundle#scripts#visit_bundle_home(arg)
let uri = vundle#config#init_bundle(a:arg)['uri']
if exists(':OpenBrowser')
" See https://github.com/tyru/open-browser.vim
execute 'OpenBrowser' uri
else
" The user does not have the open-browser plugin installed so we have to
" try to open the uri ourself.
let protocoll = split(uri, ':')[0]
if protocoll == 'file'
execute 'Vexplore' uri[7:]
return
elseif protocoll =~ 'https?'
" FIXME is there a better way to test for OS X? This is false with the
" stock version of vim.
if has('macunix')
execute '!open' uri
return
elseif has('win16') || has('win32') || has('win64')
execute '!start' uri
" FIXME should this be:
"execute 'cmd /c start' uri
return
elseif has('unix')
if executable('xgd-open')
execute '!xgd-open' uri
" FIXME are there other ways to open uris on linux (besides calling
" firefox or chrome directly)? What do Gnome, KDE or XFCE provide?
return
endif
endif
endif
" if we reach this point we either can not open the uri (it is a git:// uri)
" or we do not know how to open stuff on this system.
echomsg 'The uri for this plugin is' uri.'. Please open it yourself.'
endif
endf


" ---------------------------------------------------------------------------
" Load the plugin database from vim-scripts.org .
"
Expand Down