From 99cdb88bc64063dc4656ae53496f06fb2a394cd4 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 30 Dec 2022 00:41:31 -0500 Subject: [PATCH] Improve horizontal scrolling performance of :Git blame References: https://github.com/tpope/vim-sensible/pull/124 --- autoload/fugitive.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 272efcb..105cfe5 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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()