Drop use of User Fugitive autocommand

This commit is contained in:
Tim Pope
2021-04-15 15:59:13 -04:00
parent b4081f0a88
commit 2590324d7f

View File

@@ -14,10 +14,14 @@ let g:dispatch_compilers['hub'] = 'git'
function! s:SetUpMessage(filename) abort function! s:SetUpMessage(filename) abort
if &omnifunc !~# '^\%(syntaxcomplete#Complete\)\=$' || if &omnifunc !~# '^\%(syntaxcomplete#Complete\)\=$' ||
\ a:filename !~# '\.git[\/].*MSG$' || \ a:filename !~# '\.git[\/].*MSG$' ||
\ !exists('*FugitiveFind') || empty(FugitiveGitDir()) \ !exists('*FugitiveFind')
return return
endif endif
let config_file = FugitiveFind('.git/config') let dir = exists('*FugitiveConfigGetRegexp') ? FugitiveGitDir() : FugitiveExtractGitDir(a:filename)
if empty(dir)
return
endif
let config_file = FugitiveFind('.git/config', dir)
let config = filereadable(config_file) ? readfile(config_file) : [] let config = filereadable(config_file) ? readfile(config_file) : []
if !empty(filter(config, if !empty(filter(config,
\ '!empty(rhubarb#HomepageForUrl(matchstr(v:val, ''^\s*url\s*=\s*"\=\zs\S*'')))')) \ '!empty(rhubarb#HomepageForUrl(matchstr(v:val, ''^\s*url\s*=\s*"\=\zs\S*'')))'))
@@ -28,7 +32,7 @@ endfunction
augroup rhubarb augroup rhubarb
autocmd! autocmd!
if exists('+omnifunc') if exists('+omnifunc')
autocmd User Fugitive call s:SetUpMessage(expand('%:p')) autocmd FileType gitcommit call s:SetUpMessage(expand('<afile>:p'))
endif endif
autocmd BufEnter * autocmd BufEnter *
\ if expand('%') ==# '' && &previewwindow && pumvisible() && getbufvar('#', '&omnifunc') ==# 'rhubarb#omnifunc' | \ if expand('%') ==# '' && &previewwindow && pumvisible() && getbufvar('#', '&omnifunc') ==# 'rhubarb#omnifunc' |