Redo :Gstatus documentation

This commit is contained in:
Tim Pope 2019-02-10 19:00:40 -05:00
parent 817fc15287
commit 5c5581386f
2 changed files with 177 additions and 92 deletions

View File

@ -1539,12 +1539,6 @@ function! fugitive#BufReadStatus() abort
exe "nnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>StageToggleOnly('Staged',line('.'),v:count)<CR>" exe "nnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>StageToggleOnly('Staged',line('.'),v:count)<CR>"
exe "xnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>StageToggle(line(\"'<\"),line(\"'>\")-line(\"'<\")+1)<CR>" exe "xnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>StageToggle(line(\"'<\"),line(\"'>\")-line(\"'<\")+1)<CR>"
nnoremap <buffer> <silent> C :<C-U>Gcommit<CR>:echohl WarningMsg<Bar>echo ':Gstatus C is deprecated in favor of cc'<Bar>echohl NONE<CR> nnoremap <buffer> <silent> C :<C-U>Gcommit<CR>:echohl WarningMsg<Bar>echo ':Gstatus C is deprecated in favor of cc'<Bar>echohl NONE<CR>
nnoremap <buffer> <silent> ca :<C-U>Gcommit --amend<CR>
nnoremap <buffer> <silent> cc :<C-U>Gcommit<CR>
nnoremap <buffer> <silent> ce :<C-U>Gcommit --amend --no-edit<CR>
nnoremap <buffer> <silent> cw :<C-U>Gcommit --amend --only<CR>
nnoremap <buffer> <silent> cva :<C-U>Gcommit -v --amend<CR>
nnoremap <buffer> <silent> cvc :<C-U>Gcommit -v<CR>
nnoremap <buffer> <silent> a :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR> nnoremap <buffer> <silent> a :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>
nnoremap <buffer> <silent> i :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR> nnoremap <buffer> <silent> i :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>
exe 'nnoremap <buffer> <silent>' nowait "= :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>" exe 'nnoremap <buffer> <silent>' nowait "= :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>"
@ -1562,7 +1556,6 @@ function! fugitive#BufReadStatus() abort
nnoremap <buffer> <silent> P :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<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> xnoremap <buffer> <silent> P :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> q :<C-U>if bufnr('$') == 1<Bar>quit<Bar>else<Bar>bdelete<Bar>endif<CR> nnoremap <buffer> <silent> q :<C-U>if bufnr('$') == 1<Bar>quit<Bar>else<Bar>bdelete<Bar>endif<CR>
nnoremap <buffer> <silent> r :<C-U>exe <SID>ReloadStatus()<CR>
nnoremap <buffer> <silent> R :<C-U>exe <SID>ReloadStatus()<CR> nnoremap <buffer> <silent> R :<C-U>exe <SID>ReloadStatus()<CR>
nnoremap <buffer> <silent> U :<C-U>echoerr 'Changed to X'<CR> nnoremap <buffer> <silent> U :<C-U>echoerr 'Changed to X'<CR>
nnoremap <buffer> <silent> g<Bar> :<C-U>execute <SID>StageDelete(line('.'),v:count)<CR> nnoremap <buffer> <silent> g<Bar> :<C-U>execute <SID>StageDelete(line('.'),v:count)<CR>
@ -1571,8 +1564,7 @@ function! fugitive#BufReadStatus() abort
xnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line("'<"),line("'>")-line("'<")+1)<CR> xnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line("'<"),line("'>")-line("'<")+1)<CR>
nnoremap <buffer> . : <C-R>=<SID>fnameescape(get(<SID>StatusCfile(),0,''))<CR><Home> nnoremap <buffer> . : <C-R>=<SID>fnameescape(get(<SID>StatusCfile(),0,''))<CR><Home>
nnoremap <buffer> <silent> q :<C-U>bdelete<CR> nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
nnoremap <buffer> <silent> g? :help fugitive-:Gstatus<CR> nnoremap <buffer> <silent> <F1> :help fugitive-mappings<CR>
nnoremap <buffer> <silent> <F1> :help fugitive-:Gstatus<CR>
set filetype=fugitive set filetype=fugitive
for [lnum, section] in [[staged_end, 'Staged'], [unstaged_end, 'Unstaged']] for [lnum, section] in [[staged_end, 'Staged'], [unstaged_end, 'Unstaged']]
@ -4061,12 +4053,17 @@ function! fugitive#MapJumps(...) abort
nnoremap <buffer> <silent> P :<C-U>exe 'Gedit ' . <SID>fnameescape(<SID>ContainingCommit().'^'.v:count1.<SID>Relative(':'))<CR> nnoremap <buffer> <silent> P :<C-U>exe 'Gedit ' . <SID>fnameescape(<SID>ContainingCommit().'^'.v:count1.<SID>Relative(':'))<CR>
nnoremap <buffer> <silent> ~ :<C-U>exe 'Gedit ' . <SID>fnameescape(<SID>ContainingCommit().'~'.v:count1.<SID>Relative(':'))<CR> nnoremap <buffer> <silent> ~ :<C-U>exe 'Gedit ' . <SID>fnameescape(<SID>ContainingCommit().'~'.v:count1.<SID>Relative(':'))<CR>
nnoremap <buffer> <silent> C :<C-U>exe 'Gedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR> nnoremap <buffer> <silent> C :<C-U>exe 'Gedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
nnoremap <buffer> <silent> cc :<C-U>echoerr 'Use C'<CR>
nnoremap <buffer> <silent> co :<C-U>echoerr 'Use CTRL-W C'<CR> nnoremap <buffer> <silent> co :<C-U>echoerr 'Use CTRL-W C'<CR>
nnoremap <buffer> <silent> <C-W>C :<C-U>exe 'Gsplit ' . <SID>fnameescape(<SID>ContainingCommit())<CR> nnoremap <buffer> <silent> <C-W>C :<C-U>exe 'Gsplit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
nnoremap <buffer> <silent> cp :<C-U>echoerr 'Use gC'<CR> nnoremap <buffer> <silent> cp :<C-U>echoerr 'Use gC'<CR>
nnoremap <buffer> <silent> gC :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR> nnoremap <buffer> <silent> gC :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
nnoremap <buffer> <silent> gc :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR> nnoremap <buffer> <silent> gc :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
nnoremap <buffer> <silent> ca :<C-U>Gcommit --amend<CR>
nnoremap <buffer> <silent> cc :<C-U>Gcommit<CR>
nnoremap <buffer> <silent> ce :<C-U>Gcommit --amend --no-edit<CR>
nnoremap <buffer> <silent> cw :<C-U>Gcommit --amend --only<CR>
nnoremap <buffer> <silent> cva :<C-U>Gcommit -v --amend<CR>
nnoremap <buffer> <silent> cvc :<C-U>Gcommit -v<CR>
nnoremap <buffer> cf :<C-U>Gcommit --fixup=<C-R>=<SID>SquashArgument()<CR> nnoremap <buffer> cf :<C-U>Gcommit --fixup=<C-R>=<SID>SquashArgument()<CR>
nnoremap <buffer> cs :<C-U>Gcommit --squash=<C-R>=<SID>SquashArgument()<CR> nnoremap <buffer> cs :<C-U>Gcommit --squash=<C-R>=<SID>SquashArgument()<CR>
nnoremap <buffer> cA :<C-U>Gcommit --edit --squash=<C-R>=<SID>SquashArgument()<CR> nnoremap <buffer> cA :<C-U>Gcommit --edit --squash=<C-R>=<SID>SquashArgument()<CR>
@ -4076,12 +4073,15 @@ function! fugitive#MapJumps(...) abort
nnoremap <buffer> <silent> rp :<C-U>Grebase --interactive @{push}<CR> nnoremap <buffer> <silent> rp :<C-U>Grebase --interactive @{push}<CR>
nnoremap <buffer> <silent> rw :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/reword/e<CR> nnoremap <buffer> <silent> rw :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/reword/e<CR>
nnoremap <buffer> <silent> rm :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/edit/e<CR> nnoremap <buffer> <silent> rm :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/edit/e<CR>
nnoremap <buffer> <silent> rd :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/drop/e<CR>
nnoremap <buffer> <silent> rk :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/drop/e<CR> nnoremap <buffer> <silent> rk :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/drop/e<CR>
nnoremap <buffer> <silent> rx :<C-U>exe 'Grebase --interactive<C-R>=substitute(<SID>SquashArgument(),'.\+',' &^','')<CR>'<Bar>s/^pick/drop/e<CR>
nnoremap <buffer> <silent> rr :<C-U>Grebase --continue<CR> nnoremap <buffer> <silent> rr :<C-U>Grebase --continue<CR>
nnoremap <buffer> <silent> rs :<C-U>Grebase --skip<CR> nnoremap <buffer> <silent> rs :<C-U>Grebase --skip<CR>
nnoremap <buffer> <silent> re :<C-U>Grebase --edit-todo<CR> nnoremap <buffer> <silent> re :<C-U>Grebase --edit-todo<CR>
nnoremap <buffer> <silent> ra :<C-U>Grebase --abort<CR> nnoremap <buffer> <silent> ra :<C-U>Grebase --abort<CR>
nmap <buffer> . <SID>: <Plug><cfile><Home> nmap <buffer> . <SID>: <Plug><cfile><Home>
nnoremap <buffer> <silent> g? :help fugitive-mappings<CR>
endif endif
endfunction endfunction

View File

@ -30,47 +30,8 @@ that are part of Git repositories).
:Glcd [directory] |:lcd| relative to the repository. :Glcd [directory] |:lcd| relative to the repository.
*fugitive-:Gstatus* *fugitive-:G* *fugitive-:Gstatus* *fugitive-:G*
:Gstatus Bring up a git-status inspired summary in the preview :G Bring up a summary window vaguely akin to git-status.
:G window. The following maps, which work on the cursor :Gstatus Press g? or see |fugitive-mappings| for usage.
line file where sensible, are provided:
g? show this help
<C-N> next file
<C-P> previous file
<CR> |:Gedit|
- |:Git| add
- |:Git| reset (staged files)
ca |:Gcommit| --amend
cc |:Gcommit|
ce |:Gcommit| --amend --no-edit
cw |:Gcommit| --amend --only
cva |:Gcommit| --verbose --amend
cvc |:Gcommit| --verbose
cf |:Gcommit| --fixup=
cs |:Gcommit| --squash=
cA |:Gcommit| --edit --squash=
= toggle inline diff
< show inline diff
> hide inline diff
D |:Gdiff|
ds |:Gsdiff|
dp |:Git!| diff (p for patch; use :Gw to apply)
dp |:Git| add --intent-to-add (untracked files)
dv |:Gvdiff|
gO |:Gvsplit|
O |:Gtabedit|
o |:Gsplit|
P |:Git| add --patch
P |:Git| reset --patch (staged files)
s |:Git| add
u |:Git| reset
X |:Git| checkout
X |:Git| checkout HEAD (staged files)
X |:Git| clean (untracked files)
X |:Git| rm (unmerged files)
q close status
R reload status
. enter |:| command line with file prepopulated
*fugitive-:Gcommit* *fugitive-:Gcommit*
:Gcommit [args] A wrapper around git-commit. Unless the arguments :Gcommit [args] A wrapper around git-commit. Unless the arguments
@ -271,51 +232,175 @@ that are part of Git repositories).
MAPPINGS *fugitive-mappings* MAPPINGS *fugitive-mappings*
These maps are available everywhere. These mappings are available in both the |:Gstatus| buffer and Fugitive object
buffers, although not all mappings make sense in all buffers. Mappings that
operate on the file or hunk under the cursor are generally available in visual
mode to operate on multiple files or partial hunks.
*fugitive-c_CTRL-R_CTRL-G* *fugitive-staging-mappings*
Staging and resetting mappings ~
*fugitive_s*
s Stage (add) the file or hunk under the cursor.
*fugitive_u*
u Unstage (reset) the file or hunk under the cursor.
*fugitive_-*
- Stage or unstage the file or hunk under the cursor.
*fugitive_CTRL-N*
<C-N> Skip to the next file or hunk.
*fugitive_CTRL-P*
<C-P> Skip to the next file or hunk.
*fugitive_X*
X Discard the change under the cursor. This uses
`checkout` or `clean` under the hood. A command is
echoed that shows how to undo the change. Consult
`:messages` to see it again.
*fugitive_=*
= Toggle an inline diff of the file under the cursor.
*fugitive_<*
< Insert an inline diff of the file under the cursor.
*fugitive_>*
> Remove the inline diff of the file under the cursor.
*fugitive_dd*
dd Perform a |:Gdiff| on the file under the cursor.
*fugitive_ds*
ds Perform a |:Gsdiff| on the file under the cursor.
*fugitive_dv*
dv Perform a |:Gvdiff| on the file under the cursor.
*fugitive_dp*
dp Invoke |:Git!| diff on the file under the cursor.
Deprecated in favor of inline diffs. On untracked
files, this instead calls |:Git| add --intent-to-add.
*fugitive_P*
P Invoke |:Git| add --patch or reset --patch on the file
under the cursor.
*fugitive-navigation-mappings*
Navigation mappings ~
*fugitive_<CR>*
<CR> Open the file or |fugitive-object| under the cursor.
*fugitive_o*
o Open the file or |fugitive-object| under the cursor in
a new split.
*fugitive_gO*
gO Open the file or |fugitive-object| under the cursor in
a new vertical split.
*fugitive_O*
O Open the file or |fugitive-object| under the cursor in
a new tab.
*fugitive_~*
~ Open the current file in the [count]th first ancestor.
*fugitive_P*
P Open the current file in the [count]th parent.
*fugitive_C*
C Open the commit containing the current file.
*fugitive_CTRL-W_C*
<C-W>C Open the commit containing the current file in a new
split.
*fugitive_c*
Commit mappings ~
cc Create a commit.
ca Amend the last commit and edit the message.
ce Amend the last commit without editing the message.
cw Reword the last commit.
cvc Create a commit with -v.
cva Amend the last commit with -v
cf Create a `fixup!` commit for the commit under the
cursor.
cs Create a `squash!` commit for the commit under the
cursor.
cA Create a `squash!` commit for the commit under the
cursor and edit the message.
*fugitive_r*
Rebase mappings ~
ri Perform an interactive rebase. Uses ancestor of
commit under cursor as upstream if available.
rf Perform an autosquash rebase without editing the todo
list. Uses ancestor of commit under cursor as
upstream if available.
ru Perform an interactive rebase against @{upstream}.
rp Perform an interactive rebase against @{push}.
rr Continue the current rebase.
rs Skip the current commit and continue the current
rebase.
ra Abort the current rebase.
re Edit the current rebase todo list.
rw Perform an interactive rebase with the commit under
the cursor set to `reword`.
rm Perform an interactive rebase with the commit under
the cursor set to `edit`.
rd Perform an interactive rebase with the commit under
the cursor set to `drop`.
*fugitive-misc-mappings*
Miscellaneous mappings ~
*fugitive_q*
q Close the status buffer.
*fugitive_R*
R Reload the status buffer.
*fugitive_.*
. Start a |:| command line with the file under the
cursor prepopulated.
*fugitive_g?*
g? Open this help.
*fugitive-global-mappings*
Global mappings ~
*fugitive_c_CTRL-R_CTRL-G*
<C-R><C-G> On the command line, recall the path to the current <C-R><C-G> On the command line, recall the path to the current
|fugitive-object| (that is, a representation of the |fugitive-object| (that is, a representation of the
object recognized by |:Gedit|). object recognized by |:Gedit|).
*fugitive-y_CTRL-G* *fugitive_y_CTRL-G*
["x]y<C-G> Yank the commit SHA and path to the current ["x]y<C-G> Yank the path to the current |fugitive-object|.
|fugitive-object|.
These maps are available in committed Git objects.
*fugitive-<CR>*
<CR> Jump to the |fugitive-object| under the cursor.
*fugitive-o*
o Jump to the |fugitive-object| under the cursor in a
new split.
*fugitive-gO*
gO Jump to the |fugitive-object| under the cursor in a
new vertical split.
*fugitive-O*
O Jump to the |fugitive-object| under the cursor in a
new tab.
*fugitive--*
- Go to the tree containing the current tree or blob
(i.e, the parent directory).
*fugitive-~*
~ Go to the current file in the [count]th first
ancestor.
*fugitive-P*
P Go to the current file in the [count]th parent.
*fugitive-C*
C Go to the commit containing the current file.
*fugitive-a*
a Show the current tag, commit, or tree in an alternate
format.
SPECIFYING OBJECTS *fugitive-object* *fugitive-revision* SPECIFYING OBJECTS *fugitive-object* *fugitive-revision*