diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index e4931cd..930cb47 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1539,12 +1539,6 @@ function! fugitive#BufReadStatus() abort exe "nnoremap " nowait "u :execute StageToggleOnly('Staged',line('.'),v:count)" exe "xnoremap " nowait "u :execute StageToggle(line(\"'<\"),line(\"'>\")-line(\"'<\")+1)" nnoremap C :Gcommit:echohl WarningMsgecho ':Gstatus C is deprecated in favor of cc'echohl NONE - nnoremap ca :Gcommit --amend - nnoremap cc :Gcommit - nnoremap ce :Gcommit --amend --no-edit - nnoremap cw :Gcommit --amend --only - nnoremap cva :Gcommit -v --amend - nnoremap cvc :Gcommit -v nnoremap a :execute StageInline('toggle',line('.'),v:count) nnoremap i :execute StageInline('toggle',line('.'),v:count) exe 'nnoremap ' nowait "= :execute StageInline('toggle',line('.'),v:count)" @@ -1562,7 +1556,6 @@ function! fugitive#BufReadStatus() abort nnoremap P :execute StagePatch(line('.'),line('.')+v:count1-1) xnoremap P :execute StagePatch(line("'<"),line("'>")) nnoremap q :if bufnr('$') == 1quitelsebdeleteendif - nnoremap r :exe ReloadStatus() nnoremap R :exe ReloadStatus() nnoremap U :echoerr 'Changed to X' nnoremap g :execute StageDelete(line('.'),v:count) @@ -1571,8 +1564,7 @@ function! fugitive#BufReadStatus() abort xnoremap X :execute StageDelete(line("'<"),line("'>")-line("'<")+1) nnoremap . : =fnameescape(get(StatusCfile(),0,'')) nnoremap q :bdelete - nnoremap g? :help fugitive-:Gstatus - nnoremap :help fugitive-:Gstatus + nnoremap :help fugitive-mappings set filetype=fugitive for [lnum, section] in [[staged_end, 'Staged'], [unstaged_end, 'Unstaged']] @@ -4061,12 +4053,17 @@ function! fugitive#MapJumps(...) abort nnoremap P :exe 'Gedit ' . fnameescape(ContainingCommit().'^'.v:count1.Relative(':')) nnoremap ~ :exe 'Gedit ' . fnameescape(ContainingCommit().'~'.v:count1.Relative(':')) nnoremap C :exe 'Gedit ' . fnameescape(ContainingCommit()) - nnoremap cc :echoerr 'Use C' nnoremap co :echoerr 'Use CTRL-W C' nnoremap C :exe 'Gsplit ' . fnameescape(ContainingCommit()) nnoremap cp :echoerr 'Use gC' nnoremap gC :exe 'Gpedit ' . fnameescape(ContainingCommit()) nnoremap gc :exe 'Gpedit ' . fnameescape(ContainingCommit()) + nnoremap ca :Gcommit --amend + nnoremap cc :Gcommit + nnoremap ce :Gcommit --amend --no-edit + nnoremap cw :Gcommit --amend --only + nnoremap cva :Gcommit -v --amend + nnoremap cvc :Gcommit -v nnoremap cf :Gcommit --fixup==SquashArgument() nnoremap cs :Gcommit --squash==SquashArgument() nnoremap cA :Gcommit --edit --squash==SquashArgument() @@ -4076,12 +4073,15 @@ function! fugitive#MapJumps(...) abort nnoremap rp :Grebase --interactive @{push} nnoremap rw :exe 'Grebase --interactive=substitute(SquashArgument(),'.\+',' &^','')'s/^pick/reword/e nnoremap rm :exe 'Grebase --interactive=substitute(SquashArgument(),'.\+',' &^','')'s/^pick/edit/e + nnoremap rd :exe 'Grebase --interactive=substitute(SquashArgument(),'.\+',' &^','')'s/^pick/drop/e nnoremap rk :exe 'Grebase --interactive=substitute(SquashArgument(),'.\+',' &^','')'s/^pick/drop/e + nnoremap rx :exe 'Grebase --interactive=substitute(SquashArgument(),'.\+',' &^','')'s/^pick/drop/e nnoremap rr :Grebase --continue nnoremap rs :Grebase --skip nnoremap re :Grebase --edit-todo nnoremap ra :Grebase --abort nmap . : + nnoremap g? :help fugitive-mappings endif endfunction diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 8e8ee8f..33632c1 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -30,47 +30,8 @@ that are part of Git repositories). :Glcd [directory] |:lcd| relative to the repository. *fugitive-:Gstatus* *fugitive-:G* -:Gstatus Bring up a git-status inspired summary in the preview -:G window. The following maps, which work on the cursor - line file where sensible, are provided: - - g? show this help - next file - previous file - |: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 +:G Bring up a summary window vaguely akin to git-status. +:Gstatus Press g? or see |fugitive-mappings| for usage. *fugitive-:Gcommit* :Gcommit [args] A wrapper around git-commit. Unless the arguments @@ -271,51 +232,175 @@ that are part of Git repositories). 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* + Skip to the next file or hunk. + + *fugitive_CTRL-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_* + 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 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* On the command line, recall the path to the current |fugitive-object| (that is, a representation of the object recognized by |:Gedit|). - *fugitive-y_CTRL-G* -["x]y Yank the commit SHA and path to the current - |fugitive-object|. - -These maps are available in committed Git objects. - - *fugitive-* - 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. + *fugitive_y_CTRL-G* +["x]y Yank the path to the current |fugitive-object|. SPECIFYING OBJECTS *fugitive-object* *fugitive-revision* @@ -353,7 +438,7 @@ Add %{FugitiveStatusline()} to your statusline to get an indicator including the current branch and the currently edited file's commit. If you don't have a statusline, this one matches the default when 'ruler' is set: > - set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P + set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P < *FugitiveHead(...)* *fugitive#head(...)* Use FugitiveHead() to return the name of the current branch. If the current