Improve horizontal scrolling performance of :Git blame

References: https://github.com/tpope/vim-sensible/pull/124
This commit is contained in:
Tim Pope
2022-12-30 00:41:31 -05:00
parent 5b0b138483
commit 99cdb88bc6

View File

@@ -7156,6 +7156,9 @@ function! fugitive#BlameSyntax() abort
return
endif
let seen = {}
for x in split('01234567890abcdef', '\zs')
exe 'syn match FugitiveblameHashGroup'.x '"\%(^\^\=[*?]*\)\@<='.x.'\x\{5,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite'
endfor
for lnum in range(1, line('$'))
let orig_hash = matchstr(getline(lnum), '^\^\=[*?]*\zs\x\{6\}')
let hash = orig_hash
@@ -7177,8 +7180,8 @@ function! fugitive#BlameSyntax() abort
else
let s:hash_colors[hash] = ''
endif
let pattern = substitute(orig_hash, '^\(\x\)\x\(\x\)\x\(\x\)\x$', '\1\\x\2\\x\3\\x', '') . '*\>'
exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=[*?]*\)\@<='.pattern.'" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite'
let pattern = substitute(orig_hash, '^\(\x\)\x\(\x\)\x\(\x\)\x$', '\1\\x\2\\x\3\\x', '') . '*'
exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=[*?]*\)\@<='.pattern.'" contained containedin=FugitiveblameHashGroup' . orig_hash[0]
endfor
syn match FugitiveblameUncommitted "\%(^\^\=[?*]*\)\@<=\<0\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite
call s:BlameRehighlight()