diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 4572f64..a218d17 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -52,9 +52,10 @@ that are part of Git repositories). *fugitive-:Gstatus* :Gstatus Bring up the output of git-status in the preview window. Press D to |:Gdiff| the file on the cursor - line. Press - to stage or unstage the file on the - cursor line. Press p to do so on a per hunk basis - (--patch). Press C to invoke |:Gcommit|. + line, or dh to |:Gdiff!|. Press - to stage or unstage + the file on the cursor line. Press p to do so on a + per hunk basis (--patch). Press C to invoke + |:Gcommit|. *fugitive-:Gcommit* :Gcommit [args] A wrapper around git-commit. If there is nothing diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 8ebfc8f..aa5aa01 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -538,7 +538,7 @@ function! fugitive#reload_status() abort endfor endfunction -function! s:StageDiff() abort +function! s:StageDiff(bang) abort let section = getline(search('^# .*:$','bnW')) let line = getline('.') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*') @@ -549,13 +549,13 @@ function! s:StageDiff() abort elseif line =~# '^#\trenamed:' && filename =~ ' -> ' let [old, new] = split(filename,' -> ') execute 'Gedit '.s:fnameescape(':0:'.new) - return 'Gdiff HEAD:'.s:fnameescape(old) + return 'Gdiff'.a:bang.' HEAD:'.s:fnameescape(old) elseif section == '# Changes to be committed:' execute 'Gedit '.s:fnameescape(':0:'.filename) - return 'Gdiff -' + return 'Gdiff'.a:bang.' -' else execute 'Gedit '.s:fnameescape('/'.filename) - return 'Gdiff' + return 'Gdiff'.a:bang endif endfunction @@ -1377,7 +1377,9 @@ function! s:BufReadIndex() setlocal ro noma nomod nomodeline bufhidden=delete nnoremap a :let b:fugitive_display_format += 1exe BufReadIndex() nnoremap i :let b:fugitive_display_format -= 1exe BufReadIndex() - nnoremap D :execute StageDiff() + nnoremap D :execute StageDiff('') + nnoremap dd :execute StageDiff('') + nnoremap dh :execute StageDiff('!') nnoremap - :execute StageToggle(line('.'),line('.')+v:count1-1) xnoremap - :execute StageToggle(line("'<"),line("'>")) nnoremap p :execute StagePatch(line('.'),line('.')+v:count1-1)