Document :Gstatus maps in tabular form

This commit is contained in:
Tim Pope 2011-08-19 15:01:37 -04:00
parent 2aae91c3ed
commit dd52642d13
2 changed files with 37 additions and 30 deletions

View File

@ -27,16 +27,24 @@ that are part of Git repositories).
*fugitive-:Gstatus* *fugitive-:Gstatus*
:Gstatus Bring up the output of git-status in the preview :Gstatus Bring up the output of git-status in the preview
window. In addition to standard motions, one can window. The following maps, which work on the cursor
use <C-N> and <C-P> to jump from filename to line file where sensible, are provided:
filename. Press C to invoke |:Gcommit|. Press D to
|:Gdiff| the file on the cursor line, or ds to <C-N> next file
|:Gsdiff|. Press - to stage or unstage the file on <C-P> previous file
the cursor line. Press p to do so on a per hunk basis <CR> |:Gedit|
(--patch). All of D, -, and p have a different, - |:Git| add
sensible (and hopefully intuitive) behavior when - |:Git| reset (staged files)
invoked on a heading rather than a file name. Press q C |:Gcommit|
to close the preview window. 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* *fugitive-:Gcommit*
:Gcommit [args] A wrapper around git-commit. If there is nothing :Gcommit [args] A wrapper around git-commit. If there is nothing

View File

@ -573,8 +573,7 @@ function! fugitive#reload_status() abort
endfor endfor
endfunction endfunction
function! s:StageDiff(...) abort function! s:StageDiff(diff) abort
let cmd = a:0 ? a:1 : 'Gdiff'
let section = getline(search('^# .*:$','bnW')) let section = getline(search('^# .*:$','bnW'))
let line = getline('.') let line = getline('.')
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$')
@ -585,13 +584,13 @@ function! s:StageDiff(...) abort
elseif line =~# '^#\trenamed:' && filename =~ ' -> ' elseif line =~# '^#\trenamed:' && filename =~ ' -> '
let [old, new] = split(filename,' -> ') let [old, new] = split(filename,' -> ')
execute 'Gedit '.s:fnameescape(':0:'.new) 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:' elseif section == '# Changes to be committed:'
execute 'Gedit '.s:fnameescape(':0:'.filename) execute 'Gedit '.s:fnameescape(':0:'.filename)
return cmd.' -' return a:diff.' -'
else else
execute 'Gedit '.s:fnameescape('/'.filename) execute 'Gedit '.s:fnameescape('/'.filename)
return cmd return a:diff
endif endif
endfunction endfunction
@ -1705,25 +1704,25 @@ function! s:BufReadIndex()
set ft=gitcommit set ft=gitcommit
endif endif
setlocal ro noma nomod nomodeline bufhidden=delete setlocal ro noma nomod nomodeline bufhidden=delete
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
nnoremap <buffer> <silent> R :<C-U>edit<CR>
nnoremap <buffer> <silent> a :<C-U>let b:fugitive_display_format += 1<Bar>exe <SID>BufReadIndex()<CR>
nnoremap <buffer> <silent> i :<C-U>let b:fugitive_display_format -= 1<Bar>exe <SID>BufReadIndex()<CR>
nnoremap <buffer> <silent> D :<C-U>execute <SID>StageDiff()<CR>
nnoremap <buffer> <silent> dd :<C-U>execute <SID>StageDiff()<CR>
nnoremap <buffer> <silent> dh :<C-U>execute <SID>StageDiff('Gsdiff')<CR>
nnoremap <buffer> <silent> ds :<C-U>execute <SID>StageDiff('Gsdiff')<CR>
nnoremap <buffer> <silent> dv :<C-U>execute <SID>StageDiff()<CR>
nnoremap <buffer> <silent> - :<C-U>execute <SID>StageToggle(line('.'),line('.')+v:count1-1)<CR>
xnoremap <buffer> <silent> - :<C-U>execute <SID>StageToggle(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<CR>
xnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> <C-N> :call search('^#\t.*','W')<Bar>.<CR>
nnoremap <buffer> <silent> <C-P> :call search('^#\t.*','Wbe')<Bar>.<CR>
call s:JumpInit() call s:JumpInit()
nunmap <buffer> P nunmap <buffer> P
nunmap <buffer> ~ nunmap <buffer> ~
nnoremap <buffer> <silent> <C-N> :call search('^#\t.*','W')<Bar>.<CR>
nnoremap <buffer> <silent> <C-P> :call search('^#\t.*','Wbe')<Bar>.<CR>
nnoremap <buffer> <silent> - :<C-U>execute <SID>StageToggle(line('.'),line('.')+v:count1-1)<CR>
xnoremap <buffer> <silent> - :<C-U>execute <SID>StageToggle(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> a :<C-U>let b:fugitive_display_format += 1<Bar>exe <SID>BufReadIndex()<CR>
nnoremap <buffer> <silent> i :<C-U>let b:fugitive_display_format -= 1<Bar>exe <SID>BufReadIndex()<CR>
nnoremap <buffer> <silent> C :<C-U>Gcommit<CR> nnoremap <buffer> <silent> C :<C-U>Gcommit<CR>
nnoremap <buffer> <silent> D :<C-U>execute <SID>StageDiff('Gvdiff')<CR>
nnoremap <buffer> <silent> dd :<C-U>execute <SID>StageDiff('Gvdiff')<CR>
nnoremap <buffer> <silent> dh :<C-U>execute <SID>StageDiff('Gsdiff')<CR>
nnoremap <buffer> <silent> ds :<C-U>execute <SID>StageDiff('Gsdiff')<CR>
nnoremap <buffer> <silent> dv :<C-U>execute <SID>StageDiff('Gvdiff')<CR>
nnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<CR>
xnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
nnoremap <buffer> <silent> R :<C-U>edit<CR>
catch /^fugitive:/ catch /^fugitive:/
return 'echoerr v:errmsg' return 'echoerr v:errmsg'
endtry endtry