Pass <mods> along to URL opener

I don't know if there is a use for this, but it seems like the right
thing to do.
This commit is contained in:
Tim Pope
2021-04-03 21:23:09 -04:00
parent 2ef9d9a748
commit 81074db0ee

View File

@@ -6260,23 +6260,24 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
endif endif
let url = substitute(url, '[ <>\|"]', '\="%".printf("%02X",char2nr(submatch(0)))', 'g') let url = substitute(url, '[ <>\|"]', '\="%".printf("%02X",char2nr(submatch(0)))', 'g')
let mods = s:Mods(a:mods)
if a:bang if a:bang
if has('clipboard') if has('clipboard')
let @+ = url let @+ = url
endif endif
return 'echo '.string(url) return 'echo '.string(url)
elseif exists(':Browse') == 2 elseif exists(':Browse') == 2
return 'echo '.string(url).'|Browse '.url return 'echo '.string(url).'|' . mods . 'Browse '.url
elseif exists(':OpenBrowser') == 2 elseif exists(':OpenBrowser') == 2
return 'echo '.string(url).'|OpenBrowser '.url return 'echo '.string(url).'|' . mods . 'OpenBrowser '.url
else else
if !exists('g:loaded_netrw') if !exists('g:loaded_netrw')
runtime! autoload/netrw.vim runtime! autoload/netrw.vim
endif endif
if exists('*netrw#BrowseX') if exists('*netrw#BrowseX')
return 'echo '.string(url).'|call netrw#BrowseX('.string(url).', 0)' return 'echo '.string(url).'|' . mods . 'call netrw#BrowseX('.string(url).', 0)'
elseif exists('*netrw#NetrwBrowseX') elseif exists('*netrw#NetrwBrowseX')
return 'echo '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)' return 'echo '.string(url).'|' . mods . 'call netrw#NetrwBrowseX('.string(url).', 0)'
else else
return 'echoerr ' . string('Netrw not found. Define your own :Browse to use :GBrowse') return 'echoerr ' . string('Netrw not found. Define your own :Browse to use :GBrowse')
endif endif