mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Add alternatives to :GBrowse ++remote=
In the same way Vim requires custom commands to start with an uppercase letter, I'm starting to think we should self-impose the same constraint on custom ++options. Also, let's throw "Git" in there, just to allow this to be truly unique if necessary. This also allows a special remote argument of ".git" to refer to the local repository. A possible use of this would be a local gitweb handler.
This commit is contained in:
@@ -1170,7 +1170,9 @@ function! fugitive#RemoteUrl(...) abort
|
||||
else
|
||||
let url = remove(args, 0)
|
||||
endif
|
||||
if url !~# ':\|^/\|^\.\.\=/'
|
||||
if url ==# '.git'
|
||||
let url = FugitiveGitDir(config)
|
||||
elseif url !~# ':\|^/\|^\.\.\=/'
|
||||
let url = FugitiveConfigGet('remote.' . url . '.url', config)
|
||||
endif
|
||||
let instead_of = []
|
||||
@@ -6794,11 +6796,11 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
|
||||
let dir = s:Dir()
|
||||
try
|
||||
let arg = a:arg
|
||||
if arg =~# '^++remote='
|
||||
let remote = matchstr(arg, '^++remote=\zs\S\+')
|
||||
if arg =~# '^++\%([Gg]it\)\=[Rr]emote='
|
||||
let remote = matchstr(arg, '^++\%([Gg]it\)\=[Rr]emote=\zs\S\+')
|
||||
let arg = matchstr(arg, '\s\zs\S.*')
|
||||
endif
|
||||
let validremote = '\.\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)\='
|
||||
let validremote = '\.\%(git\)\=\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)\='
|
||||
if arg ==# '-'
|
||||
let remote = ''
|
||||
let rev = ''
|
||||
|
||||
Reference in New Issue
Block a user