mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 23:03:51 -05:00
Expand ssh host aliases in remote urls
A common practice for using multiple accounts with a hosting service
such as GitHub is to alias the host in ~/.ssh/config and use an
alternate ssh key to authenticate as the alternate user:
Host github.com-work
HostName github.com
IdentityFile ~/.ssh/id_rsa_work
By swapping in the original host name for the alias in
FugitiveRemoteUrl(), we can enable :GBrowse plugins to correctly
recognize the hosting service's domain name.
If for some reason you need the original URL without modification, pass
a true value as the third parameter:
let url = FugitiveRemoteUrl('', bufnr(''), 1)
References https://github.com/tpope/vim-rhubarb/issues/60
This commit is contained in:
@@ -122,7 +122,7 @@ function! FugitiveConfigGetAll(name, ...) abort
|
||||
endfunction
|
||||
|
||||
function! FugitiveRemoteUrl(...) abort
|
||||
return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1))
|
||||
return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1), a:0 > 2 ? a:3 : 0)
|
||||
endfunction
|
||||
|
||||
function! FugitiveHead(...) abort
|
||||
|
||||
Reference in New Issue
Block a user