mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 22:33:51 -05:00
@@ -1283,7 +1283,7 @@ endfunction
|
|||||||
|
|
||||||
call s:add_methods('buffer',['compare_age'])
|
call s:add_methods('buffer',['compare_age'])
|
||||||
|
|
||||||
function! s:Diff(bang,...) abort
|
function! s:Diff(bang,...)
|
||||||
let split = a:bang ? 'split' : 'vsplit'
|
let split = a:bang ? 'split' : 'vsplit'
|
||||||
if exists(':DiffGitCached')
|
if exists(':DiffGitCached')
|
||||||
return 'DiffGitCached'
|
return 'DiffGitCached'
|
||||||
@@ -1930,10 +1930,13 @@ function! s:BufReadIndexFile()
|
|||||||
try
|
try
|
||||||
let b:fugitive_type = 'blob'
|
let b:fugitive_type = 'blob'
|
||||||
let b:git_dir = s:repo().dir()
|
let b:git_dir = s:repo().dir()
|
||||||
call s:ReplaceCmd(s:repo().git_command('cat-file','blob',s:buffer().sha1()))
|
try
|
||||||
if &bufhidden ==# ''
|
call s:ReplaceCmd(s:repo().git_command('cat-file','blob',s:buffer().sha1()))
|
||||||
setlocal bufhidden=delete
|
finally
|
||||||
endif
|
if &bufhidden ==# ''
|
||||||
|
setlocal bufhidden=delete
|
||||||
|
endif
|
||||||
|
endtry
|
||||||
return ''
|
return ''
|
||||||
catch /^fugitive: rev-parse/
|
catch /^fugitive: rev-parse/
|
||||||
silent exe 'doau BufNewFile '.s:fnameescape(bufname(''))
|
silent exe 'doau BufNewFile '.s:fnameescape(bufname(''))
|
||||||
@@ -1998,52 +2001,55 @@ function! s:BufReadObject()
|
|||||||
silent %delete
|
silent %delete
|
||||||
setlocal endofline
|
setlocal endofline
|
||||||
|
|
||||||
if b:fugitive_type == 'tree'
|
try
|
||||||
let b:fugitive_display_format = b:fugitive_display_format % 2
|
if b:fugitive_type == 'tree'
|
||||||
if b:fugitive_display_format
|
let b:fugitive_display_format = b:fugitive_display_format % 2
|
||||||
call s:ReplaceCmd(s:repo().git_command('ls-tree',hash))
|
if b:fugitive_display_format
|
||||||
else
|
call s:ReplaceCmd(s:repo().git_command('ls-tree',hash))
|
||||||
call s:ReplaceCmd(s:repo().git_command('show','--no-color',hash))
|
|
||||||
endif
|
|
||||||
elseif b:fugitive_type == 'tag'
|
|
||||||
let b:fugitive_display_format = b:fugitive_display_format % 2
|
|
||||||
if b:fugitive_display_format
|
|
||||||
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
|
|
||||||
else
|
|
||||||
call s:ReplaceCmd(s:repo().git_command('cat-file','-p',hash))
|
|
||||||
endif
|
|
||||||
elseif b:fugitive_type == 'commit'
|
|
||||||
let b:fugitive_display_format = b:fugitive_display_format % 2
|
|
||||||
if b:fugitive_display_format
|
|
||||||
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
|
|
||||||
else
|
|
||||||
call s:ReplaceCmd(s:repo().git_command('show','--no-color','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash))
|
|
||||||
call search('^parent ')
|
|
||||||
if getline('.') ==# 'parent '
|
|
||||||
silent delete_
|
|
||||||
else
|
else
|
||||||
silent s/\%(^parent\)\@<! /\rparent /ge
|
call s:ReplaceCmd(s:repo().git_command('show','--no-color',hash))
|
||||||
endif
|
endif
|
||||||
if search('^encoding \%(<unknown>\)\=$','W',line('.')+3)
|
elseif b:fugitive_type == 'tag'
|
||||||
silent delete_
|
let b:fugitive_display_format = b:fugitive_display_format % 2
|
||||||
end
|
if b:fugitive_display_format
|
||||||
1
|
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
|
||||||
|
else
|
||||||
|
call s:ReplaceCmd(s:repo().git_command('cat-file','-p',hash))
|
||||||
|
endif
|
||||||
|
elseif b:fugitive_type == 'commit'
|
||||||
|
let b:fugitive_display_format = b:fugitive_display_format % 2
|
||||||
|
if b:fugitive_display_format
|
||||||
|
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
|
||||||
|
else
|
||||||
|
call s:ReplaceCmd(s:repo().git_command('show','--no-color','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash))
|
||||||
|
call search('^parent ')
|
||||||
|
if getline('.') ==# 'parent '
|
||||||
|
silent delete_
|
||||||
|
else
|
||||||
|
silent s/\%(^parent\)\@<! /\rparent /ge
|
||||||
|
endif
|
||||||
|
if search('^encoding \%(<unknown>\)\=$','W',line('.')+3)
|
||||||
|
silent delete_
|
||||||
|
end
|
||||||
|
1
|
||||||
|
endif
|
||||||
|
elseif b:fugitive_type ==# 'blob'
|
||||||
|
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
|
||||||
endif
|
endif
|
||||||
elseif b:fugitive_type ==# 'blob'
|
finally
|
||||||
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
|
call setpos('.',pos)
|
||||||
endif
|
setlocal ro noma nomod
|
||||||
call setpos('.',pos)
|
if &bufhidden ==# ''
|
||||||
setlocal ro noma nomod
|
setlocal bufhidden=delete
|
||||||
if &bufhidden ==# ''
|
endif
|
||||||
setlocal bufhidden=delete
|
if b:fugitive_type !=# 'blob'
|
||||||
endif
|
set filetype=git
|
||||||
if b:fugitive_type !=# 'blob'
|
nnoremap <buffer> <silent> a :<C-U>let b:fugitive_display_format += v:count1<Bar>exe <SID>BufReadObject()<CR>
|
||||||
set filetype=git
|
nnoremap <buffer> <silent> i :<C-U>let b:fugitive_display_format -= v:count1<Bar>exe <SID>BufReadObject()<CR>
|
||||||
nnoremap <buffer> <silent> a :<C-U>let b:fugitive_display_format += v:count1<Bar>exe <SID>BufReadObject()<CR>
|
else
|
||||||
nnoremap <buffer> <silent> i :<C-U>let b:fugitive_display_format -= v:count1<Bar>exe <SID>BufReadObject()<CR>
|
call s:JumpInit()
|
||||||
else
|
endif
|
||||||
call s:JumpInit()
|
endtry
|
||||||
endif
|
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
|
|||||||
Reference in New Issue
Block a user