Accept +cmd with :Gdiff
This commit is contained in:
parent
8e63140181
commit
b5188a1b4f
@ -1743,10 +1743,15 @@ endfunction
|
|||||||
call s:add_methods('buffer',['compare_age'])
|
call s:add_methods('buffer',['compare_age'])
|
||||||
|
|
||||||
function! s:Diff(vert,...) abort
|
function! s:Diff(vert,...) abort
|
||||||
|
let args = copy(a:000)
|
||||||
|
let post = ''
|
||||||
|
if get(args, 0) =~# '^+'
|
||||||
|
let post = remove(args, 0)[1:-1]
|
||||||
|
endif
|
||||||
let vert = empty(a:vert) ? s:diff_modifier(2) : a:vert
|
let vert = empty(a:vert) ? s:diff_modifier(2) : a:vert
|
||||||
if exists(':DiffGitCached')
|
if exists(':DiffGitCached')
|
||||||
return 'DiffGitCached'
|
return 'DiffGitCached'
|
||||||
elseif (!a:0 || a:1 == ':') && s:buffer().commit() =~# '^[0-1]\=$' && s:repo().git_chomp_in_tree('ls-files', '--unmerged', '--', s:buffer().path()) !=# ''
|
elseif (empty(args) || args[0] == ':') && s:buffer().commit() =~# '^[0-1]\=$' && s:repo().git_chomp_in_tree('ls-files', '--unmerged', '--', s:buffer().path()) !=# ''
|
||||||
let vert = empty(a:vert) ? s:diff_modifier(3) : a:vert
|
let vert = empty(a:vert) ? s:diff_modifier(3) : a:vert
|
||||||
let nr = bufnr('')
|
let nr = bufnr('')
|
||||||
execute 'leftabove '.vert.'split `=fugitive#buffer().repo().translate(s:buffer().expand('':2''))`'
|
execute 'leftabove '.vert.'split `=fugitive#buffer().repo().translate(s:buffer().expand('':2''))`'
|
||||||
@ -1758,11 +1763,11 @@ function! s:Diff(vert,...) abort
|
|||||||
call s:diffthis()
|
call s:diffthis()
|
||||||
wincmd p
|
wincmd p
|
||||||
call s:diffthis()
|
call s:diffthis()
|
||||||
return ''
|
return post
|
||||||
elseif a:0
|
elseif len(args)
|
||||||
let arg = join(a:000, ' ')
|
let arg = join(args, ' ')
|
||||||
if arg ==# ''
|
if arg ==# ''
|
||||||
return ''
|
return post
|
||||||
elseif arg ==# '/'
|
elseif arg ==# '/'
|
||||||
let file = s:buffer().path('/')
|
let file = s:buffer().path('/')
|
||||||
elseif arg ==# ':'
|
elseif arg ==# ':'
|
||||||
@ -1801,7 +1806,7 @@ function! s:Diff(vert,...) abort
|
|||||||
wincmd p
|
wincmd p
|
||||||
call feedkeys(winnr."\<C-W>w", 'n')
|
call feedkeys(winnr."\<C-W>w", 'n')
|
||||||
endif
|
endif
|
||||||
return ''
|
return post
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr v:errmsg'
|
||||||
endtry
|
endtry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user