My dotfiles. Period.

fugitive.txt 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. *fugitive.txt* A Git wrapper so awesome, it should be illegal
  2. Author: Tim Pope <vimNOSPAM@tpope.org> *fugitive-author*
  3. License: Same terms as Vim itself (see |license|)
  4. This plugin is only available if 'compatible' is not set.
  5. INTRODUCTION *fugitive*
  6. Install in ~/.vim, or in ~\vimfiles if you're on Windows and feeling lucky.
  7. Vim 7.2 is recommended as it ships with syntax highlighting for many Git file
  8. types.
  9. If you're in a hurry to get started, here are some things to try:
  10. In any file in your repository, run |:Gedit| HEAD. Press <CR> to jump to the
  11. current branch. Press <CR> again to jump to the top most commit. Keep using
  12. <CR> to explore parent commits, trees, and blobs. Use C in a tree or blob to
  13. get back to the commit.
  14. Edit a file in the work tree and make some changes. Use |:Gdiff| to open up
  15. the indexed version. Use |do| and |dp| on various hunks to bring the files in
  16. sync, or use |:Gread| to pull in all changes. Write the indexed version to
  17. stage the file.
  18. Run |:Gstatus| to check your repository's status. Use "-" to stage and reset
  19. files and "p" to add/reset --patch them. Invoke |:Gcommit| to commit your
  20. changes.
  21. Run |:Gblame| in a work tree file to see a blame in a vertical split. Press
  22. <CR> on any line to reopen and reblame that file as it stood in that commit.
  23. Press o or O on any line to inspect that commit in a split or a tab.
  24. Run |:Ggrep| to search the work tree or history. Run |:Gmove| to rename a
  25. file. Run |:Gremove| to delete a file.
  26. COMMANDS *fugitive-commands*
  27. These commands are local to the buffers in which they work (generally, buffers
  28. that are part of Git repositories).
  29. *fugitive-:Git*
  30. :Git [args] Run an arbitrary git command. Similar to :!git [args]
  31. but chdir to the repository tree first.
  32. *fugitive-:Gcd*
  33. :Gcd [directory] |:cd| relative to the repository.
  34. *fugitive-:Glcd*
  35. :Glcd [directory] |:lcd| relative to the repository.
  36. *fugitive-:Gstatus*
  37. :Gstatus Bring up the output of git-status in the preview
  38. window. In addition to standard motions, you can
  39. use <C-N> and <C-P> to jump from filename to
  40. filename. Press C to invoke |:Gcommit|. Press D to
  41. |:Gdiff| the file on the cursor line, or ds to
  42. |:Gsdiff|. Press - to stage or unstage the file on
  43. the cursor line. Press p to do so on a per hunk basis
  44. (--patch). All of D, -, and p have a different,
  45. sensible (and hopefully intuitive) behavior when
  46. invoked on a heading rather than a file name.
  47. *fugitive-:Gcommit*
  48. :Gcommit [args] A wrapper around git-commit. If there is nothing
  49. to commit, |:Gstatus| is called instead. Unless the
  50. arguments given would skip the invocation of an editor
  51. (e.g., -m), a split window will be used to obtain a
  52. commit message. Write and close that window (:wq or
  53. |:Gwrite|) to finish the commit. Unlike when running
  54. the actual git-commit command, it is possible (but
  55. unadvisable) to muck with the index with commands like
  56. git-add and git-reset while a commit message is
  57. pending.
  58. *fugitive-:Ggrep*
  59. :Ggrep [args] |:grep| with git-grep as 'grepprg'.
  60. *fugitive-:Glog*
  61. :Glog [args] Load all previous revisions of the current file into
  62. the quickfix list. Additional git-log arguments can
  63. be given (for example, --reverse). If "--" appears as
  64. an argument, no file specific filtering is done, and
  65. commits are loaded into the quickfix list.
  66. *fugitive-:Gedit* *fugitive-:Ge*
  67. :Gedit [revision] |:edit| a |fugitive-revision|.
  68. *fugitive-:Gsplit*
  69. :Gsplit [revision] |:split| a |fugitive-revision|.
  70. *fugitive-:Gvsplit*
  71. :Gvsplit [revision] |:vsplit| a |fugitive-revision|.
  72. *fugitive-:Gtabedit*
  73. :Gtabedit [revision] |:tabedit| a |fugitive-revision|
  74. *fugitive-:Gpedit*
  75. :Gpedit [revision] |:pedit| a |fugitive-revision|
  76. *fugitive-:Gread*
  77. :Gread [revision] Empty the buffer and |:read| a |fugitive-revision|.
  78. When the argument is omitted, this is similar to
  79. git-checkout on a work tree file or git-add on a stage
  80. file, but without writing anything to disk.
  81. :{range}Gread [revision]
  82. |:read| in a |fugitive-revision| after {range}.
  83. *fugitive-:Gwrite*
  84. :Gwrite Write to the current file's path and stage the results.
  85. When run in a work tree file, it is effectively git
  86. add. Elsewhere, it is effectively git-checkout. A
  87. great deal of effort is expended to behave sensibly
  88. when the work tree or index version of the file is
  89. open in another buffer.
  90. :Gwrite {path} You can give |:Gwrite| an explicit path of where in
  91. the work tree to write. You can also give a path like
  92. :0:foo.txt or even :0 to write to just that stage in
  93. the index.
  94. *fugitive-:Gwq*
  95. :Gwq [path] Like |:Gwrite| followed by |:quit| if the write
  96. succeeded.
  97. :Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write
  98. succeeded.
  99. *fugitive-:Gdiff*
  100. :Gdiff [revision] Perform a |vimdiff| against the current file in the
  101. given revision. With no argument, the version in the
  102. index is used (which means a three-way diff during a
  103. merge conflict, making it a git-mergetool
  104. alternative). The newer of the two files is placed
  105. to the right. Use |do| and |dp| and write to the
  106. index file to simulate "git add --patch".
  107. *fugitive-:Gsdiff*
  108. :Gsdiff [revision] Like |:Gdiff|, but split horizontally.
  109. *fugitive-:Gvdiff*
  110. :Gvdiff [revision] Identical to |:Gdiff|. For symmetry with |:Gsdiff|.
  111. *fugitive-:Gmove*
  112. :Gmove {destination} Wrapper around git-mv that renames the buffer
  113. afterward. The destination is relative to the current
  114. directory except when started with a /, in which case
  115. it is relative to the work tree. Add a ! to pass -f.
  116. *fugitive-:Gremove*
  117. :Gremove Wrapper around git-rm that deletes the buffer
  118. afterward. When invoked in an index file, --cached is
  119. passed. Add a ! to pass -f and forcefully discard the
  120. buffer.
  121. *fugitive-:Gblame*
  122. :Gblame [flags] Run git-blame on the file and open the results in a
  123. scroll bound vertical split. Press enter on a line to
  124. reblame the file as it was in that commit. You can
  125. give any of ltwfsMC as flags and they will be passed
  126. along to git-blame.
  127. :[range]Gblame [flags] Run git-blame on the given range.
  128. *fugitive-:Gbrowse*
  129. :[range]Gbrowse If the remote for the current branch is on GitHub,
  130. open the current file, blob, tree, commit, or tag
  131. (with git-web--browse) on GitHub. Otherwise, open the
  132. current file, blob, tree, commit, or tag in
  133. git-instaweb (if you have issues, verify you can run
  134. "git instaweb" from a terminal). If a range is given,
  135. it is appropriately appended to the URL as an anchor.
  136. :[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
  137. than opening it.
  138. :[range]Gbrowse {revision}
  139. Like :Gbrowse, but for a given |fugitive-revision|. A
  140. useful value here is -, which ties the URL to the
  141. latest commit rather than a volatile branch.
  142. :[range]Gbrowse [...]@{remote}
  143. Force using the given remote rather than the remote
  144. for the current branch. The remote is used to
  145. determine which GitHub repository to link to.
  146. MAPPINGS *fugitive-mappings*
  147. These maps are available in Git objects.
  148. *fugitive-<CR>*
  149. <CR> Jump to the revision under the cursor.
  150. *fugitive-o*
  151. o Jump to the revision under the cursor in a new split.
  152. *fugitive-O*
  153. O Jump to the revision under the cursor in a new tab.
  154. *fugitive-~*
  155. ~ Go to the current file in the [count]th first
  156. ancestor.
  157. *fugitive-P*
  158. P Go to the current file in the [count]th parent.
  159. *fugitive-C*
  160. C Go to the commit containing the current file.
  161. *fugitive-a*
  162. a Show the current tag, commit, or tree in an alternate
  163. format.
  164. SPECIFYING REVISIONS *fugitive-revision*
  165. Fugitive revisions are similar to Git revisions as defined in the "SPECIFYING
  166. REVISIONS" section in the git-rev-parse man page. For commands that accept an
  167. optional revision, the default is the file in the index for work tree files
  168. and the work tree file for everything else. Example revisions follow.
  169. Revision Meaning ~
  170. HEAD .git/HEAD
  171. master .git/refs/heads/master
  172. HEAD^{} The commit referenced by HEAD
  173. HEAD^ The parent of the commit referenced by HEAD
  174. HEAD: The tree referenced by HEAD
  175. /HEAD The file named HEAD in the work tree
  176. Makefile The file named Makefile in the work tree
  177. HEAD^:Makefile The file named Makefile in the parent of HEAD
  178. :Makefile The file named Makefile in the index (writable)
  179. - The current file in HEAD
  180. ^ The current file in the previous commit
  181. ~3 The current file 3 commits ago
  182. : .git/index (Same as |:Gstatus|)
  183. :0 The current file in the index
  184. :1 The current file's common ancestor during a conflict
  185. :2 The current file in the target branch during a conflict
  186. :3 The current file in the merged branch during a conflict
  187. :/foo The most recent commit with "foo" in the message
  188. STATUSLINE *fugitive-statusline*
  189. *fugitive#statusline()*
  190. Add %{fugitive#statusline()} to your statusline to get an indicator including
  191. the current branch and the currently edited file's commit. If you don't have
  192. a statusline, this one matches the default when 'ruler' is set:
  193. >
  194. set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
  195. <
  196. ABOUT *fugitive-about*
  197. Grab the latest version or report a bug on GitHub:
  198. http://github.com/tpope/vim-fugitive
  199. vim:tw=78:et:ft=help:norl: