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*
:Gstatus Bring up the output of git-status in the preview
window. In addition to standard motions, one can
use <C-N> and <C-P> 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:
<C-N> next file
<C-P> previous file
<CR> |: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

View File

@ -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 <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()
nunmap <buffer> P
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> 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:/
return 'echoerr v:errmsg'
endtry