mirror of
https://github.com/tpope/vim-fugitive.git
synced 2026-04-25 16:44:13 +08:00
Compare commits
199 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16c2b7abb9 | |||
| 1e3f1103d9 | |||
| 9835920a3c | |||
| fd36aa9c61 | |||
| 4dd41688cf | |||
| 18d6d1ab82 | |||
| 9ce67cdc93 | |||
| bf04261080 | |||
| 52d180af0a | |||
| 14daf094d9 | |||
| ac904e806d | |||
| 9f768cd3bc | |||
| 09cdce7add | |||
| 8851b8fe64 | |||
| cfa485ede7 | |||
| 207c643ea4 | |||
| cac2c8ef8e | |||
| a9a22e0e4e | |||
| c3e918072f | |||
| d854197c03 | |||
| d8ce8d1d03 | |||
| 23faeadc7c | |||
| 1ecd12d523 | |||
| f8aa87a4b5 | |||
| dba8a0705d | |||
| 8cf3d94a3a | |||
| 28de2a1ddd | |||
| 01cda4d443 | |||
| b5188a1b4f | |||
| 8e63140181 | |||
| cec56ef5ff | |||
| 1e755064e9 | |||
| 0b43b51d77 | |||
| 5dcf8a0175 | |||
| 2509641eac | |||
| 073f3a37b9 | |||
| b7b23001de | |||
| b319b69453 | |||
| 03cc95cc19 | |||
| 7c4a906147 | |||
| b5b2548a87 | |||
| ca727b07f1 | |||
| 0fbbe0b3a4 | |||
| 1c844375fa | |||
| e065e4f841 | |||
| 21b6dd7aee | |||
| 935a2cccd3 | |||
| c2908b174d | |||
| b0e38f08dc | |||
| 4cc201cbe3 | |||
| baa05dcfda | |||
| 0095769029 | |||
| e8b94098bb | |||
| eb8eb1850a | |||
| 933f6a1e1d | |||
| 34719016ec | |||
| 2c8461db08 | |||
| d3b98d9886 | |||
| 5699f4613c | |||
| 0374322ba5 | |||
| 90ee6fb5d2 | |||
| 04fe4bfcd9 | |||
| 7423d72b51 | |||
| 24d4098ceb | |||
| 5aaa65736d | |||
| 5d1c219ee5 | |||
| a739112bfc | |||
| d376506177 | |||
| 9af975c82c | |||
| 11f89ba749 | |||
| 45e5317200 | |||
| ee2b0ecdb8 | |||
| 94a5d6fe2f | |||
| 0cd33c6170 | |||
| 6239f5ed8e | |||
| 188692556a | |||
| 716f3d2d4e | |||
| 8576741d61 | |||
| 32957cb552 | |||
| fdc8569c18 | |||
| 7fb703534a | |||
| 41cdbdcd62 | |||
| 91900baad1 | |||
| fb5661211d | |||
| 276f89837f | |||
| 4581cd4217 | |||
| df103dc595 | |||
| 989fb15b8c | |||
| 123d2e096d | |||
| f880016a30 | |||
| fba20539e7 | |||
| 750db5e5b9 | |||
| ffd8c0ad58 | |||
| 018ea3955b | |||
| 9f9dabc1f8 | |||
| 82580253e8 | |||
| 021918c3f6 | |||
| 0d7cb020bd | |||
| 30facffd5b | |||
| f32bdf1a7b | |||
| 4a77929a32 | |||
| dff9b92cde | |||
| 419f1ee910 | |||
| e3904723f8 | |||
| 652c27a46b | |||
| 336c716ba0 | |||
| 585fcc8a9b | |||
| 4b75c7bff2 | |||
| b0bc71460a | |||
| 061a81f247 | |||
| 15fbbf7296 | |||
| 64c690603e | |||
| 269c89ef59 | |||
| e6e259c2d2 | |||
| 3e3a899cf1 | |||
| cad80493f4 | |||
| aed0043a1f | |||
| c5a3c5f8ce | |||
| 0a19a3e78f | |||
| 7fd14b218e | |||
| 99809a021c | |||
| 2b05b275f5 | |||
| c4713200f7 | |||
| 545578538c | |||
| 6f5fd2add0 | |||
| 416165f063 | |||
| f8bf95b9ff | |||
| 46ca7374f0 | |||
| c99f0ff06b | |||
| 07c58226df | |||
| 4f80883e05 | |||
| bf14c9c8a3 | |||
| e7c7149434 | |||
| c8070aec7e | |||
| 21b60b309d | |||
| 9649b02076 | |||
| cbab574164 | |||
| 72d382077c | |||
| 17393f552e | |||
| 51cdb1b190 | |||
| c1664de7b4 | |||
| d6540b2588 | |||
| 22cc877e64 | |||
| 218fc37ce1 | |||
| 3bfa0a2725 | |||
| fd297ad11f | |||
| a069fa7066 | |||
| d6f17608dd | |||
| 70ec927890 | |||
| b27937d5e4 | |||
| 152c9195ae | |||
| 7c40a18bfd | |||
| f395f3cbea | |||
| 0765cbe466 | |||
| 0cb30541ec | |||
| 190fe2a4cf | |||
| 8f0b8edfbd | |||
| 546a6bf219 | |||
| 1b0ddad697 | |||
| 07c078c1be | |||
| 6b338bdbcf | |||
| 34e2d2538a | |||
| dc250fcc8d | |||
| 050b22e531 | |||
| ea18a6a89b | |||
| 61fac2f738 | |||
| 124550cfee | |||
| 00b0916ae2 | |||
| f096152a48 | |||
| 3b5f715262 | |||
| 54ead5abcb | |||
| 25bbb3c5f5 | |||
| 5f7a8a9935 | |||
| 5c18b1a044 | |||
| 4c7e649efb | |||
| 618d884562 | |||
| cbb7c3e890 | |||
| d4c615c427 | |||
| f6d93b8788 | |||
| 09cbdded83 | |||
| 06fafb1324 | |||
| a917e998c7 | |||
| 2ae214a156 | |||
| 0103538d7a | |||
| a27b899a36 | |||
| 6462bdb4b9 | |||
| 1da788a1b0 | |||
| bbf9e51eb2 | |||
| cf3fe781dd | |||
| 1bce4328e4 | |||
| 1601ffc1e0 | |||
| b9525df190 | |||
| 582eb0d3c9 | |||
| d1406ae23a | |||
| d63a475fcb | |||
| 2723a1116f | |||
| 7df3a6894a | |||
| 6f380fa8c6 | |||
| f64ba46509 |
@@ -0,0 +1,18 @@
|
||||
Before reporting a bug, you should try stripping down your Vim configuration
|
||||
and removing other plugins. The sad truth about VimScript is that it is
|
||||
fraught with incompatibilities waiting to happen. I'm happy to work around
|
||||
them where I can, but it's up to you to isolate the conflict.
|
||||
|
||||
Fugitive is particularly prone to regressions due to Git version issues,
|
||||
platform issues, and interactions with other plugins. I end up bisecting a
|
||||
lot more than other projects, and thus I'm especially meticulous here about
|
||||
maintaining a clean, readable, history. Squash and force push any requested
|
||||
changes to a pull request. And if your [commit message
|
||||
sucks](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
|
||||
I'm not going to accept it. Period.
|
||||
|
||||
Beyond that, don't be shy about asking before patching. What takes you hours
|
||||
might take me minutes simply because I have both domain knowledge and a
|
||||
perverse knowledge of VimScript so vast that many would consider it a symptom
|
||||
of mental illness. On the flip side, some ideas I'll reject no matter how
|
||||
good the implementation is. "Send a patch" is an edge case answer in my book.
|
||||
+15
-47
@@ -1,5 +1,4 @@
|
||||
fugitive.vim
|
||||
============
|
||||
# fugitive.vim
|
||||
|
||||
I'm not going to lie to you; fugitive.vim may very well be the best
|
||||
Git wrapper of all time. Check out these features:
|
||||
@@ -12,13 +11,13 @@ Vim's diff handling capabilities to stage a subset of the file's
|
||||
changes.
|
||||
|
||||
Bring up the output of `git status` with `:Gstatus`. Press `-` to
|
||||
`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch` that
|
||||
mofo. And guess what `:Gcommit` does!
|
||||
`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch`. And guess
|
||||
what `:Gcommit` does!
|
||||
|
||||
`:Gblame` brings up an interactive vertical split with `git blame`
|
||||
output. Press enter on a line to reblame the file as it stood in that
|
||||
commit, or `o` to open that commit in a split. When you're done, use
|
||||
`:Gedit` in the historic buffer to go back to the work tree version.
|
||||
output. Press enter on a line to edit the commit where the line
|
||||
changed, or `o` to open it in a split. When you're done, use `:Gedit`
|
||||
in the historic buffer to go back to the work tree version.
|
||||
|
||||
`:Gmove` does a `git mv` on a file and simultaneously renames the
|
||||
buffer. `:Gremove` does a `git rm` on a file and simultaneously deletes
|
||||
@@ -46,8 +45,7 @@ with the current branch in (surprise!) your statusline.
|
||||
Last but not least, there's `:Git` for running any arbitrary command,
|
||||
and `Git!` to open the output of a command in a temp file.
|
||||
|
||||
Screencasts
|
||||
-----------
|
||||
## Screencasts
|
||||
|
||||
* [A complement to command line git](http://vimcasts.org/e/31)
|
||||
* [Working with the git index](http://vimcasts.org/e/32)
|
||||
@@ -55,25 +53,21 @@ Screencasts
|
||||
* [Browsing the git object database](http://vimcasts.org/e/34)
|
||||
* [Exploring the history of a git repository](http://vimcasts.org/e/35)
|
||||
|
||||
Installation
|
||||
------------
|
||||
## Installation
|
||||
|
||||
If you don't have a preferred installation method, I recommend
|
||||
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
||||
then simply copy and paste:
|
||||
If you don't have a preferred installation method, one option is to install
|
||||
[pathogen.vim](https://github.com/tpope/vim-pathogen), and then copy
|
||||
and paste:
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone git://github.com/tpope/vim-fugitive.git
|
||||
|
||||
Once help tags have been generated, you can view the manual with
|
||||
`:help fugitive`.
|
||||
vim -u NONE -c "helptags vim-fugitive/doc" -c q
|
||||
|
||||
If your Vim version is below 7.2, I recommend also installing
|
||||
[vim-git](https://github.com/tpope/vim-git) for syntax highlighting and
|
||||
other Git niceties.
|
||||
|
||||
FAQ
|
||||
---
|
||||
## FAQ
|
||||
|
||||
> I installed the plugin and started Vim. Why don't any of the commands
|
||||
> exist?
|
||||
@@ -109,32 +103,7 @@ to open after any grep invocation:
|
||||
|
||||
autocmd QuickFixCmdPost *grep* cwindow
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Before reporting a bug, you should try stripping down your Vim
|
||||
configuration and removing other plugins. The sad nature of VimScript
|
||||
is that it is fraught with incompatibilities waiting to happen. I'm
|
||||
happy to work around them where I can, but it's up to you to isolate
|
||||
the conflict.
|
||||
|
||||
If your [commit message sucks](http://stopwritingramblingcommitmessages.com/),
|
||||
I'm not going to accept your pull request. I've explained very politely
|
||||
dozens of times that
|
||||
[my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||
are absolute rules on my own repositories, so I may lack the energy to
|
||||
explain it to you yet another time. And please, if I ask you to change
|
||||
something, `git commit --amend`.
|
||||
|
||||
Beyond that, don't be shy about asking before patching. What takes you
|
||||
hours might take me minutes simply because I have both domain knowledge
|
||||
and a perverse knowledge of VimScript so vast that many would consider
|
||||
it a symptom of mental illness. On the flip side, some ideas I'll
|
||||
reject no matter how good the implementation is. "Send a patch" is an
|
||||
edge case answer in my book.
|
||||
|
||||
Self-Promotion
|
||||
--------------
|
||||
## Self-Promotion
|
||||
|
||||
Like fugitive.vim? Follow the repository on
|
||||
[GitHub](https://github.com/tpope/vim-fugitive) and vote for it on
|
||||
@@ -143,8 +112,7 @@ you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
||||
[Twitter](http://twitter.com/tpope) and
|
||||
[GitHub](https://github.com/tpope).
|
||||
|
||||
License
|
||||
-------
|
||||
## License
|
||||
|
||||
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
|
||||
See `:help license`.
|
||||
|
||||
+76
-36
@@ -34,6 +34,7 @@ that are part of Git repositories).
|
||||
window. The following maps, which work on the cursor
|
||||
line file where sensible, are provided:
|
||||
|
||||
g? show this help
|
||||
<C-N> next file
|
||||
<C-P> previous file
|
||||
<CR> |:Gedit|
|
||||
@@ -54,7 +55,7 @@ that are part of Git repositories).
|
||||
p |:Git| add --patch
|
||||
p |:Git| reset --patch (staged files)
|
||||
q close status
|
||||
R reload status
|
||||
r reload status
|
||||
S |:Gvsplit|
|
||||
|
||||
*fugitive-:Gcommit*
|
||||
@@ -62,12 +63,32 @@ that are part of Git repositories).
|
||||
to commit, |:Gstatus| is called instead. Unless the
|
||||
arguments given would skip the invocation of an editor
|
||||
(e.g., -m), a split window will be used to obtain a
|
||||
commit message. Write and close that window (:wq or
|
||||
|:Gwrite|) to finish the commit. Unlike when running
|
||||
the actual git-commit command, it is possible (but
|
||||
unadvisable) to muck with the index with commands like
|
||||
git-add and git-reset while a commit message is
|
||||
pending.
|
||||
commit message, or a new tab if -v is given. Write
|
||||
and close that window (:wq or |:Gwrite|) to finish the
|
||||
commit. Unlike when running the actual git-commit
|
||||
command, it is possible (but unadvisable) to alter the
|
||||
index with commands like git-add and git-reset while a
|
||||
commit message is pending.
|
||||
|
||||
*fugitive-:Gmerge*
|
||||
:Gmerge [args] Calls git-merge and loads errors and conflicted files
|
||||
into the quickfix list. Opens a |:Gcommit| style
|
||||
split window for the commit message if the merge
|
||||
succeeds. If called during a merge conflict, the
|
||||
conflicted files from the current index are loaded
|
||||
into the quickfix list.
|
||||
|
||||
*fugitive-:Gpull*
|
||||
:Gpull [args] Like |:Gmerge|, but for git-pull.
|
||||
|
||||
*fugitive-:Gpush*
|
||||
:Gpush [args] Invoke git-push, load the results into the quickfix
|
||||
list, and invoke |:cwindow| to reveal any errors.
|
||||
|:Dispatch| is used if available for asynchronous
|
||||
invocation.
|
||||
|
||||
*fugitive-:Gfetch*
|
||||
:Gfetch [args] Like |:Gpush|, but for git-fetch.
|
||||
|
||||
*fugitive-:Ggrep*
|
||||
:Ggrep [args] |:grep| with git-grep as 'grepprg'.
|
||||
@@ -83,6 +104,11 @@ that are part of Git repositories).
|
||||
previous commits rather than previous file revisions
|
||||
are loaded.
|
||||
|
||||
:{range}Glog [args] Use git-log -L to load previous revisions of the given
|
||||
range of the current file into the quickfix list. The
|
||||
cursor is positioned on the first line of the first
|
||||
diff hunk for each commit.
|
||||
|
||||
*fugitive-:Gllog*
|
||||
:Gllog [args] Like |:Glog|, but use the location list instead of the
|
||||
quickfix list.
|
||||
@@ -122,7 +148,7 @@ that are part of Git repositories).
|
||||
|
||||
:{range}Gread! [args] |:read| the output of a Git command after {range}.
|
||||
|
||||
*fugitive-:Gwrite*
|
||||
*fugitive-:Gw* *fugitive-:Gwrite*
|
||||
:Gwrite Write to the current file's path and stage the results.
|
||||
When run in a work tree file, it is effectively git
|
||||
add. Elsewhere, it is effectively git-checkout. A
|
||||
@@ -148,14 +174,16 @@ that are part of Git repositories).
|
||||
index is used (which means a three-way diff during a
|
||||
merge conflict, making it a git-mergetool
|
||||
alternative). The newer of the two files is placed
|
||||
to the right. Use |do| and |dp| and write to the
|
||||
index file to simulate "git add --patch".
|
||||
to the right or bottom, depending on 'diffopt' and
|
||||
the width of the window relative to 'textwidth'. Use
|
||||
|do| and |dp| and write to the index file to simulate
|
||||
"git add --patch".
|
||||
|
||||
*fugitive-:Gsdiff*
|
||||
:Gsdiff [revision] Like |:Gdiff|, but split horizontally.
|
||||
:Gsdiff [revision] Like |:Gdiff|, but always split horizontally.
|
||||
|
||||
*fugitive-:Gvdiff*
|
||||
:Gvdiff [revision] Identical to |:Gdiff|. For symmetry with |:Gsdiff|.
|
||||
:Gvdiff [revision] Like |:Gdiff|, but always split vertically.
|
||||
|
||||
*fugitive-:Gmove*
|
||||
:Gmove {destination} Wrapper around git-mv that renames the buffer
|
||||
@@ -171,18 +199,18 @@ that are part of Git repositories).
|
||||
|
||||
*fugitive-:Gblame*
|
||||
:Gblame [flags] Run git-blame on the file and open the results in a
|
||||
scroll bound vertical split. Press enter on a line to
|
||||
reblame the file as it was in that commit. You can
|
||||
give any of ltfnsewMC as flags and they will be passed
|
||||
along to git-blame. The following maps, which work on
|
||||
the cursor line commit where sensible, are provided:
|
||||
scroll bound vertical split. You can give any of
|
||||
ltfnsewMC as flags and they will be passed along to
|
||||
git-blame. The following maps, which work on the
|
||||
cursor line commit where sensible, are provided:
|
||||
|
||||
g? show this help
|
||||
A resize to end of author column
|
||||
C resize to end of commit column
|
||||
D resize to end of date/time column
|
||||
q close blame and return to blamed window
|
||||
gq q, then |:Gedit| to return to work tree version
|
||||
i q, then open commit
|
||||
<CR> q, then open commit
|
||||
o open commit in horizontal split
|
||||
O open commit in new tab
|
||||
- reblame at commit
|
||||
@@ -192,32 +220,40 @@ that are part of Git repositories).
|
||||
:[range]Gblame [flags] Run git-blame on the given range.
|
||||
|
||||
*fugitive-:Gbrowse*
|
||||
:[range]Gbrowse If the remote for the current branch is on GitHub,
|
||||
open the current file, blob, tree, commit, or tag
|
||||
(with git-web--browse) on GitHub. Otherwise, open the
|
||||
current file, blob, tree, commit, or tag in
|
||||
git-instaweb (if you have issues, verify you can run
|
||||
"git instaweb" from a terminal). If a range is given,
|
||||
it is appropriately appended to the URL as an anchor.
|
||||
:Gbrowse Open the current file, blob, tree, commit, or tag
|
||||
in your browser at the upstream hosting provider.
|
||||
If a range is given, it is appropriately appended to
|
||||
the URL as an anchor.
|
||||
|
||||
To use with GitHub FI, point g:fugitive_github_domains
|
||||
at a list of domains:
|
||||
>
|
||||
let g:fugitive_github_domains = ['git.example.com']
|
||||
~
|
||||
:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
|
||||
than opening it.
|
||||
Upstream providers can be added by installing an
|
||||
appropriate Vim plugin. For example, GitHub can be
|
||||
supported by installing rhubarb.vim, available at
|
||||
<https://github.com/tpope/vim-rhubarb>. (Native
|
||||
support for GitHub is currently included, but that is
|
||||
slated to be removed.)
|
||||
|
||||
:[range]Gbrowse {revision}
|
||||
Like :Gbrowse, but for a given |fugitive-revision|. A
|
||||
The hosting provider is determined by looking at the
|
||||
remote for the current or specified branch and falls
|
||||
back to "origin". In the special case of a "."
|
||||
remote, a local instance of git-instaweb will be
|
||||
started and used.
|
||||
|
||||
:Gbrowse {revision} Like :Gbrowse, but for a given |fugitive-revision|. A
|
||||
useful value here is -, which ties the URL to the
|
||||
latest commit rather than a volatile branch.
|
||||
|
||||
:[range]Gbrowse [...]@{remote}
|
||||
Force using the given remote rather than the remote
|
||||
:Gbrowse [...]@{remote} Force using the given remote rather than the remote
|
||||
for the current branch. The remote is used to
|
||||
determine which GitHub repository to link to.
|
||||
|
||||
:{range}Gbrowse [args] Appends an anchor to the URL that emphasizes the
|
||||
selected lines. You almost certainly want to give a
|
||||
"-" argument in this case to force the URL to include
|
||||
an exact revision.
|
||||
|
||||
:[range]Gbrowse! [args] Like :Gbrowse, but put the URL on the clipboard rather
|
||||
than opening it.
|
||||
|
||||
MAPPINGS *fugitive-mappings*
|
||||
|
||||
These maps are available everywhere.
|
||||
@@ -258,6 +294,10 @@ P Go to the current file in the [count]th parent.
|
||||
*fugitive-C*
|
||||
C Go to the commit containing the current file.
|
||||
|
||||
*fugitive-.*
|
||||
. Start a |:| command line with the current revision
|
||||
prepopulated at the end of the line.
|
||||
|
||||
*fugitive-a*
|
||||
a Show the current tag, commit, or tree in an alternate
|
||||
format.
|
||||
|
||||
+967
-410
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user