mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Compare commits
2 Commits
540b6a8b8a
...
blame_mess
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62c50ff296 | ||
|
|
c2877d0d5c |
@@ -298,6 +298,9 @@ endfunction
|
||||
function! s:repo_tree(...) dict abort
|
||||
if self.dir() =~# '/\.git$'
|
||||
let dir = self.dir()[0:-6]
|
||||
if dir !~# '/'
|
||||
let dir .= '/'
|
||||
endif
|
||||
else
|
||||
let dir = s:configured_tree(self.git_dir)
|
||||
endif
|
||||
@@ -2049,6 +2052,7 @@ function! s:Blame(bang,line1,line2,count,args) abort
|
||||
if exists('+relativenumber')
|
||||
setlocal norelativenumber
|
||||
endif
|
||||
let &l:statusline = '%{fugitive#blame_statusline('.bufnr('').')}%<'
|
||||
execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1)
|
||||
nnoremap <buffer> <silent> <F1> :help fugitive-:Gblame<CR>
|
||||
nnoremap <buffer> <silent> g? :help fugitive-:Gblame<CR>
|
||||
@@ -2216,6 +2220,25 @@ function! s:RehighlightBlame() abort
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! fugitive#blame_statusline(nr) abort
|
||||
if bufnr('%') != a:nr && !getwinvar(0, '&cursorbind')
|
||||
return ''
|
||||
endif
|
||||
let line = getbufline(a:nr, line('.'))[0]
|
||||
let hash = matchstr(line, '^\^\=\zs\x\{7}')
|
||||
if hash =~# '^0*$'
|
||||
return ''
|
||||
endif
|
||||
if type(getbufvar(a:nr, 'fugitive_blame_lookup')) != type({})
|
||||
call setbufvar(a:nr, 'fugitive_blame_lookup', {})
|
||||
endif
|
||||
let lookup = getbufvar(a:nr, 'fugitive_blame_lookup')
|
||||
if !has_key(lookup, hash)
|
||||
let lookup[hash] = s:repo().git_chomp('log', '-1', hash, '--pretty=format:'.g:fugitive_summary_format)
|
||||
endif
|
||||
return get(lookup, hash, '')
|
||||
endfunction
|
||||
|
||||
" Section: Gbrowse
|
||||
|
||||
call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(<bang>0,<line1>,<count>,<f-args>)")
|
||||
|
||||
Reference in New Issue
Block a user