From dd52642d13f603289aa742d29f9a4bfb3a259edb Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 19 Aug 2011 15:01:37 -0400 Subject: [PATCH] Document :Gstatus maps in tabular form --- doc/fugitive.txt | 28 ++++++++++++++++++---------- plugin/fugitive.vim | 39 +++++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 69851b4..6825835 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -27,16 +27,24 @@ that are part of Git repositories). *fugitive-:Gstatus* :Gstatus Bring up the output of git-status in the preview - window. In addition to standard motions, one can - use and to jump from filename to - filename. Press C to invoke |:Gcommit|. Press D to - |:Gdiff| the file on the cursor line, or ds to - |:Gsdiff|. Press - to stage or unstage the file on - the cursor line. Press p to do so on a per hunk basis - (--patch). All of D, -, and p have a different, - sensible (and hopefully intuitive) behavior when - invoked on a heading rather than a file name. Press q - to close the preview window. + window. The following maps, which work on the cursor + line file where sensible, are provided: + + next file + previous file + |:Gedit| + - |:Git| add + - |:Git| reset (staged files) + C |:Gcommit| + D |:Gdiff| + ds |:Gsdiff| + dv |:Gvdiff| + O |:Gtabedit| + o |:Gsplit| + p |:Git| add -p + p |:Git| reset -p (staged files) + q close status + R reload status *fugitive-:Gcommit* :Gcommit [args] A wrapper around git-commit. If there is nothing diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 5e927e6..31df5ad 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -573,8 +573,7 @@ function! fugitive#reload_status() abort endfor endfunction -function! s:StageDiff(...) abort - let cmd = a:0 ? a:1 : 'Gdiff' +function! s:StageDiff(diff) abort let section = getline(search('^# .*:$','bnW')) let line = getline('.') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$') @@ -585,13 +584,13 @@ function! s:StageDiff(...) abort elseif line =~# '^#\trenamed:' && filename =~ ' -> ' let [old, new] = split(filename,' -> ') execute 'Gedit '.s:fnameescape(':0:'.new) - return cmd.' HEAD:'.s:fnameescape(old) + return a:diff.' HEAD:'.s:fnameescape(old) elseif section == '# Changes to be committed:' execute 'Gedit '.s:fnameescape(':0:'.filename) - return cmd.' -' + return a:diff.' -' else execute 'Gedit '.s:fnameescape('/'.filename) - return cmd + return a:diff endif endfunction @@ -1705,25 +1704,25 @@ function! s:BufReadIndex() set ft=gitcommit endif setlocal ro noma nomod nomodeline bufhidden=delete - nnoremap q :bdelete - nnoremap R :edit - nnoremap a :let b:fugitive_display_format += 1exe BufReadIndex() - nnoremap i :let b:fugitive_display_format -= 1exe BufReadIndex() - nnoremap D :execute StageDiff() - nnoremap dd :execute StageDiff() - nnoremap dh :execute StageDiff('Gsdiff') - nnoremap ds :execute StageDiff('Gsdiff') - nnoremap dv :execute StageDiff() - nnoremap - :execute StageToggle(line('.'),line('.')+v:count1-1) - xnoremap - :execute StageToggle(line("'<"),line("'>")) - nnoremap p :execute StagePatch(line('.'),line('.')+v:count1-1) - xnoremap p :execute StagePatch(line("'<"),line("'>")) - nnoremap :call search('^#\t.*','W'). - nnoremap :call search('^#\t.*','Wbe'). call s:JumpInit() nunmap P nunmap ~ + nnoremap :call search('^#\t.*','W'). + nnoremap :call search('^#\t.*','Wbe'). + nnoremap - :execute StageToggle(line('.'),line('.')+v:count1-1) + xnoremap - :execute StageToggle(line("'<"),line("'>")) + nnoremap a :let b:fugitive_display_format += 1exe BufReadIndex() + nnoremap i :let b:fugitive_display_format -= 1exe BufReadIndex() nnoremap C :Gcommit + nnoremap D :execute StageDiff('Gvdiff') + nnoremap dd :execute StageDiff('Gvdiff') + nnoremap dh :execute StageDiff('Gsdiff') + nnoremap ds :execute StageDiff('Gsdiff') + nnoremap dv :execute StageDiff('Gvdiff') + nnoremap p :execute StagePatch(line('.'),line('.')+v:count1-1) + xnoremap p :execute StagePatch(line("'<"),line("'>")) + nnoremap q :bdelete + nnoremap R :edit catch /^fugitive:/ return 'echoerr v:errmsg' endtry