mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-09 03:53:47 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df103dc595 | ||
|
|
989fb15b8c | ||
|
|
123d2e096d |
@@ -11,8 +11,8 @@ Vim's diff handling capabilities to stage a subset of the file's
|
|||||||
changes.
|
changes.
|
||||||
|
|
||||||
Bring up the output of `git status` with `:Gstatus`. Press `-` to
|
Bring up the output of `git status` with `:Gstatus`. Press `-` to
|
||||||
`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch` that
|
`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch`. And guess
|
||||||
mofo. And guess what `:Gcommit` does!
|
what `:Gcommit` does!
|
||||||
|
|
||||||
`:Gblame` brings up an interactive vertical split with `git blame`
|
`:Gblame` brings up an interactive vertical split with `git blame`
|
||||||
output. Press enter on a line to edit the commit where the line
|
output. Press enter on a line to edit the commit where the line
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
" fugitive.vim - A Git wrapper so awesome, it should be illegal
|
" fugitive.vim - A Git wrapper so awesome, it should be illegal
|
||||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||||
" Version: 2.0
|
" Version: 2.1
|
||||||
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
|
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
|
||||||
|
|
||||||
if exists('g:loaded_fugitive') || &cp
|
if exists('g:loaded_fugitive') || &cp
|
||||||
@@ -1403,9 +1403,9 @@ augroup END
|
|||||||
|
|
||||||
" Section: Gdiff
|
" Section: Gdiff
|
||||||
|
|
||||||
call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff('keepalt ',<f-args>)")
|
call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff('',<f-args>)")
|
||||||
call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff('keepalt vert ',<f-args>)")
|
call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff('keepalt vert ',<f-args>)")
|
||||||
call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff('',<f-args>)")
|
call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff('keepalt ',<f-args>)")
|
||||||
|
|
||||||
augroup fugitive_diff
|
augroup fugitive_diff
|
||||||
autocmd!
|
autocmd!
|
||||||
@@ -1429,12 +1429,12 @@ function! fugitive#can_diffoff(buf) abort
|
|||||||
return s:can_diffoff(a:buf)
|
return s:can_diffoff(a:buf)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:diff_horizontal(count) abort
|
function! s:diff_modifier(count) abort
|
||||||
let fdc = matchstr(&diffopt, 'foldcolumn:\zs\d\+')
|
let fdc = matchstr(&diffopt, 'foldcolumn:\zs\d\+')
|
||||||
if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical'
|
if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical'
|
||||||
return 'keepalt vert '
|
|
||||||
elseif &diffopt =~# 'vertical'
|
|
||||||
return 'keepalt '
|
return 'keepalt '
|
||||||
|
elseif &diffopt =~# 'vertical'
|
||||||
|
return 'keepalt vert '
|
||||||
elseif winwidth(0) <= a:count * ((&tw ? &tw : 80) + (empty(fdc) ? 2 : fdc))
|
elseif winwidth(0) <= a:count * ((&tw ? &tw : 80) + (empty(fdc) ? 2 : fdc))
|
||||||
return 'keepalt '
|
return 'keepalt '
|
||||||
else
|
else
|
||||||
@@ -1518,11 +1518,11 @@ 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 vert = empty(a:vert) ? s:diff_horizontal(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 (!a:0 || a:1 == ':') && s:buffer().commit() =~# '^[0-1]\=$' && s:repo().git_chomp_in_tree('ls-files', '--unmerged', '--', s:buffer().path()) !=# ''
|
||||||
let vert = empty(a:vert) ? s:diff_horizontal(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''))`'
|
||||||
execute 'nnoremap <buffer> <silent> dp :diffput '.nr.'<Bar>diffupdate<CR>'
|
execute 'nnoremap <buffer> <silent> dp :diffput '.nr.'<Bar>diffupdate<CR>'
|
||||||
|
|||||||
Reference in New Issue
Block a user