Conceal file names and line numbers in :Gblame
This commit is contained in:
parent
daccfb508f
commit
f43393dd9a
@ -1554,7 +1554,13 @@ augroup fugitive_blame
|
|||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
function! s:linechars(pattern)
|
function! s:linechars(pattern)
|
||||||
return strlen(s:gsub(matchstr(getline('.'), a:pattern), '.', '.'))
|
let chars = strlen(s:gsub(matchstr(getline('.'), a:pattern), '.', '.'))
|
||||||
|
if exists('*synconcealed') && &conceallevel > 1
|
||||||
|
for col in range(1, chars)
|
||||||
|
let chars -= synconcealed(line('.'), col)[0]
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
return chars
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:Blame(bang,line1,line2,count,args) abort
|
function! s:Blame(bang,line1,line2,count,args) abort
|
||||||
@ -1621,11 +1627,14 @@ function! s:Blame(bang,line1,line2,count,args) abort
|
|||||||
execute top
|
execute top
|
||||||
normal! zt
|
normal! zt
|
||||||
execute current
|
execute current
|
||||||
execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1)
|
|
||||||
setlocal nomodified nomodifiable nonumber scrollbind nowrap foldcolumn=0 nofoldenable filetype=fugitiveblame
|
setlocal nomodified nomodifiable nonumber scrollbind nowrap foldcolumn=0 nofoldenable filetype=fugitiveblame
|
||||||
|
if exists('+concealcursor')
|
||||||
|
setlocal concealcursor=nc conceallevel=2
|
||||||
|
endif
|
||||||
if exists('+relativenumber')
|
if exists('+relativenumber')
|
||||||
setlocal norelativenumber
|
setlocal norelativenumber
|
||||||
endif
|
endif
|
||||||
|
execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1)
|
||||||
nnoremap <buffer> <silent> q :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w<Bar>'.bufnr('').'bdelete','^-1','','')<CR>
|
nnoremap <buffer> <silent> q :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w<Bar>'.bufnr('').'bdelete','^-1','','')<CR>
|
||||||
nnoremap <buffer> <silent> gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w<Bar>'.bufnr('').'bdelete<Bar>if expand("%:p") =~# "^fugitive:[\\/][\\/]"<Bar>Gedit<Bar>endif','^-1','','')<CR>
|
nnoremap <buffer> <silent> gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w<Bar>'.bufnr('').'bdelete<Bar>if expand("%:p") =~# "^fugitive:[\\/][\\/]"<Bar>Gedit<Bar>endif','^-1','','')<CR>
|
||||||
nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>BlameJump('')<CR>
|
nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>BlameJump('')<CR>
|
||||||
@ -1729,16 +1738,18 @@ endfunction
|
|||||||
|
|
||||||
function! s:BlameSyntax() abort
|
function! s:BlameSyntax() abort
|
||||||
let b:current_syntax = 'fugitiveblame'
|
let b:current_syntax = 'fugitiveblame'
|
||||||
|
let conceal = has('conceal') ? ' conceal' : ''
|
||||||
|
let arg = exists('b:fugitive_blame_arguments') ? b:fugitive_blame_arguments : ''
|
||||||
syn match FugitiveblameBoundary "^\^"
|
syn match FugitiveblameBoundary "^\^"
|
||||||
syn match FugitiveblameBlank "^\s\+\s\@=" nextgroup=FugitiveblameAnnotation,fugitiveblameOriginalFile,FugitiveblameOriginalLineNumber skipwhite
|
syn match FugitiveblameBlank "^\s\+\s\@=" nextgroup=FugitiveblameAnnotation,fugitiveblameOriginalFile,FugitiveblameOriginalLineNumber skipwhite
|
||||||
syn match FugitiveblameHash "\%(^\^\=\)\@<=\x\{7,40\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite
|
syn match FugitiveblameHash "\%(^\^\=\)\@<=\x\{7,40\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite
|
||||||
syn match FugitiveblameUncommitted "\%(^\^\=\)\@<=0\{7,40\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite
|
syn match FugitiveblameUncommitted "\%(^\^\=\)\@<=0\{7,40\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite
|
||||||
syn region FugitiveblameAnnotation matchgroup=FugitiveblameDelimiter start="(" end="\%( \d\+\)\@<=)" contained keepend oneline
|
syn region FugitiveblameAnnotation matchgroup=FugitiveblameDelimiter start="(" end="\%( \d\+\)\@<=)" contained keepend oneline
|
||||||
syn match FugitiveblameTime "[0-9:/+-][0-9:/+ -]*[0-9:/+-]\%( \+\d\+)\)\@=" contained containedin=FugitiveblameAnnotation
|
syn match FugitiveblameTime "[0-9:/+-][0-9:/+ -]*[0-9:/+-]\%( \+\d\+)\)\@=" contained containedin=FugitiveblameAnnotation
|
||||||
syn match FugitiveblameLineNumber " \@<=\d\+)\@=" contained containedin=FugitiveblameAnnotation
|
exec 'syn match FugitiveblameLineNumber " *\d\+)\@=" contained containedin=FugitiveblameAnnotation'.conceal
|
||||||
syn match FugitiveblameOriginalFile " \%(\f\+\D\@<=\|\D\@=\f\+\)\%(\%(\s\+\d\+\)\=\s\%((\|\s*\d\+)\)\)\@=" contained nextgroup=FugitiveblameOriginalLineNumber,FugitiveblameAnnotation skipwhite
|
exec 'syn match FugitiveblameOriginalFile " \%(\f\+\D\@<=\|\D\@=\f\+\)\%(\%(\s\+\d\+\)\=\s\%((\|\s*\d\+)\)\)\@=" contained nextgroup=FugitiveblameOriginalLineNumber,FugitiveblameAnnotation skipwhite'.(arg =~# 'f' ? '' : conceal)
|
||||||
syn match FugitiveblameOriginalLineNumber " \@<=\d\+\%(\s(\)\@=" contained nextgroup=FugitiveblameAnnotation skipwhite
|
exec 'syn match FugitiveblameOriginalLineNumber " *\d\+\%(\s(\)\@=" contained nextgroup=FugitiveblameAnnotation skipwhite'.(arg =~# 'n' ? '' : conceal)
|
||||||
syn match FugitiveblameOriginalLineNumber " \@<=\d\+\%(\s\+\d\+)\)\@=" contained nextgroup=FugitiveblameShort skipwhite
|
exec 'syn match FugitiveblameOriginalLineNumber " *\d\+\%(\s\+\d\+)\)\@=" contained nextgroup=FugitiveblameShort skipwhite'.(arg =~# 'n' ? '' : conceal)
|
||||||
syn match FugitiveblameShort " \d\+)" contained contains=FugitiveblameLineNumber
|
syn match FugitiveblameShort " \d\+)" contained contains=FugitiveblameLineNumber
|
||||||
syn match FugitiveblameNotCommittedYet "(\@<=Not Committed Yet\>" contained containedin=FugitiveblameAnnotation
|
syn match FugitiveblameNotCommittedYet "(\@<=Not Committed Yet\>" contained containedin=FugitiveblameAnnotation
|
||||||
hi def link FugitiveblameBoundary Keyword
|
hi def link FugitiveblameBoundary Keyword
|
||||||
|
Loading…
Reference in New Issue
Block a user