125 Commits

Author SHA1 Message Date
Tim Pope
2a53d79248 fugitive.vim 3.4
* Use jobs for all Git execution.  Faster and less prone to user error.
* Stream :Git! to the preview window.
* Make :Git grep behave like other :Git commands, not :Ggrep.
* Silence output and open quickfix list on :Ggrep -q.
* Support :Ggrep outside repository with --no-index.
* Expand ##, $ENVVAR, and ~/path in arguments to :Git.
* Expand "%" and other special sequences during tab completion.
* Improve tab completion for :Git push.
* Disable -- More -- prompt on :Git push, fetch, and --no-pager.
* Provide FugitiveObject/FugitiveStageBlob/FugitivePager events.
* Simplify :Gdiffsplit "smart" split direction.
* Support jump to commit in :Git log --graph.
* Use local not upstream branch name for :GBrowse default.
* Better support for ssh config in :GBrowse.
* Replace older deprecation warnings with error messages.
* Assorted public API enhancements.
* Require Git 1.8.5 or newer.
* Require Vim 7.3 or newer.  Full functionality requires Vim 8.1.
* Directly echo :Git output for trivial commands like "add" on Vim 7.
* Fix E1208 when loading plugin on Vim 8.2.3141.
2021-09-02 13:03:27 -04:00
Tim Pope
2e395fa450 Provide FugitiveDidChange() 2021-09-01 19:20:46 -04:00
Tim Pope
46404ad937 Enforce 'autowrite' in all subcommands 2021-09-01 19:20:46 -04:00
Tim Pope
2f3cd4715d Remove :Gcgrep
This was a hedge in case I decided to go all in with symmetry with
:Gclog.  I have decided to to.
2021-09-01 19:20:46 -04:00
Tim Pope
90ef74fddd Fix :Git difftool on Vim 7 2021-09-01 18:40:29 -04:00
Tim Pope
ebc7ddac6d Fix :Ggrep on Vim 7 2021-09-01 18:36:52 -04:00
Tim Pope
8bdbbf88a4 Change :Gstatus to error stub 2021-09-01 17:39:28 -04:00
Tim Pope
ef8e771b25 Document ++curwin 2021-09-01 09:57:26 -04:00
Tim Pope
a7d224bfd1 Support :Git ++curwin blame % 2021-09-01 09:57:26 -04:00
Tim Pope
46a4387054 Change :0,1Git blame to split by default
The 0,0 solution had issues so let's go ahead and rip the band-aid off
now.  The repeated get(a:options, 'curwin') && a:line2 < 0 ternary is
really gross but I estimate it to be the lowest impact change that moves
us in the right direction.
2021-09-01 09:42:30 -04:00
Tim Pope
3d30a2a6d3 Expand ~~ as cwd
This is a hedge to allow a way to force a cwd path even if the
handling of "./" ever changes.
2021-09-01 08:48:41 -04:00
Tim Pope
254cc8e81d Tab complete !bufnr 2021-09-01 07:54:47 -04:00
Tim Pope
5b0a4af8fc Improve fallback go-to-file in temp buffers 2021-08-31 23:19:31 -04:00
Tim Pope
b96e1a3967 Update :Gpush FAQ entry to mention :Git! 2021-08-31 17:51:46 -04:00
Tim Pope
a5d997fe8b Pre-expand argument when completing Git objects 2021-08-31 17:51:46 -04:00
Tim Pope
8920453f5d Return full ref name on FugitiveHead(-1) 2021-08-31 17:51:46 -04:00
Tim Pope
2016ce1db4 Fix check for maps disabled by dictionary
Resolves: https://github.com/tpope/vim-fugitive/issues/1822
2021-08-31 16:33:21 -04:00
Tim Pope
2b37219021 Fix check for -addr=other on nvim
I arrived at 0.4.0 by blaming the documentation, but apparently the
feature didn't land until later.
2021-08-31 16:33:21 -04:00
Tim Pope
9ace6c6aca Expand :GMove and :GRename arguments 2021-08-31 14:59:50 -04:00
Tim Pope
4efb697fce Document :Ggrep -q 2021-08-31 14:59:50 -04:00
Tim Pope
97505a4c37 Expand :(literal)./ arguments to use cwd 2021-08-31 14:59:50 -04:00
Tim Pope
3e032f295f Clean up job dictionary entry after nvim job completes 2021-08-31 14:59:50 -04:00
Tim Pope
0d8dc0f31c Add stdin support to FugitiveExecute() 2021-08-31 13:49:39 -04:00
Tim Pope
cabcbc263a Further tweak to direct :Git blame count handling
I want to reclaim :0,1Git blame for :split, since we can use that even
with -addr=other, so go ahead and add 0,6 as our backwards compatible
way to force :edit.
2021-08-31 12:27:29 -04:00
Tim Pope
404f8a2d34 Replace #ReloadStatus() with #DidChange() 2021-08-31 12:02:17 -04:00
Tim Pope
30bf224453 Fix direct blame maps in short files
Patch 8.1.560 is the gift that keeps on giving.  Let's work around this
for now by bolting on a new behavior to the previously unused :0,0Git
blame.  Long term, we probably want to come up with a different
interface.
2021-08-31 12:01:21 -04:00
Tim Pope
328501d4f0 Make "q" error maps consistent 2021-08-31 12:01:21 -04:00
Tim Pope
b64c426fd2 Try :Git for default dispatch in status buffer
The downside of this approach is it has a different interaction model
than the quickfix list.  The upside is that it's more or less what I
actually want.  To those finding this wondering why it's now
synchronous, you can make it asynchronous by pressing CTRL-D.
2021-08-31 06:59:37 -04:00
Tim Pope
d6e1a57b58 Accept a dictionary in fugitive#RemoteHttpHeaders() 2021-08-31 06:59:37 -04:00
Tim Pope
6b546f37d0 Better HTTP redirect detection
These HTTP headers may have other :GBrowse applications, so if we're
parsing them, we may as well hang onto them.
2021-08-30 09:25:52 -04:00
Tim Pope
dfd7be2294 Fix error on :GBrowse remote/branch@remote 2021-08-29 16:32:22 -04:00
Tim Pope
10b44345b0 Extend :Gdiffsplit zero argument positioning to ">" arguments
And change the jump to file map to use it, eliminating the behavior
change there (at least for now).

Resolves: https://github.com/tpope/vim-fugitive/issues/1821
2021-08-29 12:15:51 -04:00
Tim Pope
acfcb068ed Don't append another filename when expanding ">commit:file"
This opens up the possibility of using ">" to navigate to a renamed
version of a file, for example.
2021-08-29 12:14:55 -04:00
Tim Pope
6f0ff0ed00 Favor ssh:// URL over scp style when possible
This is much easier to deal with on other end, so if a :GBrowse provider
doesn't care about relative scp paths, allow them to ditch the scp
parsing entirely.
2021-08-29 12:13:14 -04:00
Tim Pope
a6be4a301c Limit size based :Gdiffsplit orientation to no argument variant
I don't think anybody liked this except for me.  This brings :Gdiffsplit
one step closer to :diffsplit.  The no argument version will probably be
removed eventually as well, but let's take it one step at a time.
2021-08-29 03:53:21 -04:00
Tim Pope
c9aaf78541 Force :leftabove for :Gdiffsplit! with argument
After receiving feedback, I have decided that the forced direction is
what most people expect, so let's limit our :diffsplit matching to the
non-bang variant, for now at least.
2021-08-29 03:53:21 -04:00
Tim Pope
d523feebe9 Respect 'splitbelow' on :Gdiffsplit with argument
When calling :Gdiffsplit with no argument, we always end up with the
work tree version as half of the diff, and it is helpful to position
that consistently.  I generalized this to a consistent older versus
newer ordering when given an argument, but I don't think that has proven
very useful in practice.

This also introduces a minor behavior change where calling the bang
variant in the initial commit now loads an empty version of the buffer,
rather than falling back to the work tree.
2021-08-28 11:47:13 -04:00
Tim Pope
4603d77424 Provide :Gdiffsplit ++novertical
Maybe one day we can kill :Ghdiffsplit.
2021-08-28 11:47:13 -04:00
Tim Pope
6b7892dc7b Fix edge case in s:Map() short circuiting
When called with multiple modes, don't bail after the first disabled
mode.

This also restructures in a way to allow for transition to :exe s:Map(),
which will provide the correct line number on :verbose map <whatever>.
2021-08-28 11:47:13 -04:00
Tim Pope
cdf60a312c Provide User FugitivePager autocommand event 2021-08-28 08:14:50 -04:00
Tim Pope
385c0fb4ee Use <cfile> not <cword> for temp file "." map
Also, skip over that "+" that marks work-tree branches in :Git branch
output.
2021-08-28 08:14:50 -04:00
Tim Pope
4f747add5e Support jump to commit in :Git log --graph 2021-08-27 11:28:45 -04:00
Tim Pope
18fd27e2cc Provide slightly less bad "." map in temp buffers
Doing this right isn't on the horizon, so hack up something that's
better than nothing.
2021-08-27 11:28:45 -04:00
Tim Pope
fa5892dcac Map "(" and ")" in blame buffers
For symmetry with the other buffers.  A nice enhancement would be to
jump between distinct commits but this is good enough for now.
2021-08-27 11:28:45 -04:00
Tim Pope
46a2f58e1d Provide utility function to expire cached config
This is primarily for troubleshooting, but might also be handy for
users of includeIf.
2021-08-27 11:28:45 -04:00
Tim Pope
126363be5a Tweak Vim 7 more prompt behavior 2021-08-26 13:35:55 -04:00
Tim Pope
4ff2c8ce30 Disable -- More -- prompt on push/fetch
These commands have slow, potentially verbose output, especially in the
case where pushing triggers a real time deploy.
2021-08-26 10:11:25 -04:00
Tim Pope
5aa8a3489e Directly echo :Git output for a few trivial commands on Vim 7
If this works out, we can change the status buffer to directly call
:Git rather than routing through FugitiveExecute().
2021-08-26 10:11:25 -04:00
Tim Pope
ad8c1c80cc Work around hostile ftplugin/man.vim
References: https://github.com/neovim/neovim/issues/15487
2021-08-26 09:12:20 -04:00
Tim Pope
7e21d414a8 Trigger FugitiveChanged after writing stage buffer
I deliberately omitted this event when adding FugitiveChanged, because I
figured it made sense for consumers to instead tap into BufWritePost to
see which file changed exactly.  This would enable, say, vim-gitgutter,
to only refresh signs for the file that actually changed, rather
than for every file in the repository.  In practice, however,
vim-gitgutter doesn't even bother with "in the repository", let alone
the exact file, opting instead to refresh every loaded buffer.  I give
up.

Resolves: https://github.com/tpope/vim-fugitive/issues/1819
2021-08-25 22:56:12 -04:00
Tim Pope
09d3551627 Don't show "Bare" status for worktrees attached to bare repos
I tried to make this foolproof and once again someone has invented a
bigger fool.
2021-08-25 07:38:41 -04:00
Tim Pope
74b0960f5b Add deprecation warning to FugitivePrepare()
I am eager to reclaim this verb, so let's deprecate sooner rather than
later.
2021-08-25 05:00:04 -04:00
Tim Pope
de02a4ba84 Change deprecated Git wrappers to error stubs 2021-08-25 05:00:04 -04:00
Tim Pope
93174147cd Provide FugitiveGitVersion()
I should have made fugitive#GitVersion() official a long time ago.
Better late than never.
2021-08-25 05:00:04 -04:00
Tim Pope
b06ad2a839 Provide FugitiveExecute() 2021-08-25 05:00:04 -04:00
Tim Pope
61e1e94785 Make FugitiveConfig(callback) asynchronous 2021-08-25 05:00:04 -04:00
Tim Pope
b07632a616 Fix :Git merge
Resolves: https://github.com/tpope/vim-fugitive/issues/1817
2021-08-25 05:00:01 -04:00
Tim Pope
e91d17ddc2 Adjust User events for fugitive:// buffers 2021-08-24 19:16:04 -04:00
Tim Pope
6dd18b5c98 Support :Git ++curwin
The special case on :0Git is so weird that I am starting to think about
an exit strategy.
2021-08-24 19:16:04 -04:00
Tim Pope
7c1f2ed185 Move config --list parsing into Execute callback
This is 80% of the way to an asynchronous config retrieval.  Do we
really want to make a 10 millisecond Git call asynchronous?  Hard to
say.
2021-08-24 14:43:10 -04:00
Tim Pope
8cdb51622f Focus quickfix list after :Ggrep! -q
This just feels right.  If we're not jumping to a file, we probably want
to scroll the list.
2021-08-23 03:00:44 -04:00
Tim Pope
5c39cde202 Don't match git grep "BUG:" lines as filename
Found this playing around with git grep --no-index /absolute/path.
2021-08-23 03:00:44 -04:00
Tim Pope
f7de229fe7 Default :Git grep to pager, not quickfix
And bring back the column default when we do use the quickfix, why not?
2021-08-23 01:51:50 -04:00
Tim Pope
1a4552da8d Support :Ggrep --no-index/--no-cached 2021-08-23 01:51:50 -04:00
Tim Pope
22fff8213e Better :Ggrep quickfix patterns 2021-08-23 01:49:55 -04:00
Tim Pope
0bd41bd387 Expand ~ and $VAR in :Git arguments 2021-08-23 01:26:52 -04:00
Tim Pope
490e03c3ad Fix line number inclusion in :Ggrep 2021-08-22 23:34:10 -04:00
Tim Pope
06b0bf147f Handle jump to file in :Git -p grep without line number 2021-08-22 23:16:42 -04:00
Tim Pope
bbfbfaa0a2 Fix command preparation bug 2021-08-22 23:16:42 -04:00
Tim Pope
a41810fa86 Better support for --no-literal-pathspecs
When given an argument list including --no-literal-pathspecs and a
buffer number, convert the buffer number to an argument by prepending
":(top,literal)" to the filename rather than "./".  This allows
operating on file names that include special characters like "*" and
"?".
2021-08-22 22:40:36 -04:00
Tim Pope
89ab2d95cd Drop Vim requirement to 7.3
The code base still supports 7.3 (7.2.061 to be precise) so no harm in
dropping this for one final release.
2021-08-22 22:09:48 -04:00
Tim Pope
557ef84c6d Improve public API argument order flexibility 2021-08-22 22:09:48 -04:00
Tim Pope
e7d2e87690 Do what I mean for :Git -c alias.foo=blame foo 2021-08-22 02:48:58 -04:00
Tim Pope
5d1a276b45 Distinguish between uses of Git dir
We use the Git dir for a few purposes:

* Direct filesystem access.
* Passing to Git as --git-dir=.
* Embedding in fugitive:// URLs.
* Referring to the repository without otherwise using it.

As a start to teasing these apart, introduce s:GitDir() to handle the
first 2 cases, s:DirUrlPrefix() for the 3rd case, and keep using s:Dir()
as a generic reference.
2021-08-22 02:48:49 -04:00
Tim Pope
7c0a7727c1 Allow FugitiveRemoteUrl(name, ':noresolve') 2021-08-22 02:47:00 -04:00
Tim Pope
baffbd6291 Fix config functions with config dictionary as first argument 2021-08-22 02:44:38 -04:00
Tim Pope
e7be4e4af9 Fix false positive "unknown Git error" 2021-08-22 00:21:33 -04:00
Tim Pope
c7a93960c7 Fix FugitiveRemoteUrl() 2021-08-22 00:21:33 -04:00
Tim Pope
b5a3775b64 Remove unused keys from :GBrowse options
I was hoping to one day introduce a new, backwards incompatible API
here, but adoption has gotten widespread enough that I think we're stuck
with it.  So let's go ahead and clean up some cruft that I've verified
is not in use in any known plugin.  A couple of plugins do use
repo.rev_parse(), but only inside conditionals should never be
triggered.
2021-08-21 21:26:45 -04:00
Tim Pope
1bd77bec75 Include remote_name in :GBrowse options
Uses for this are limited, but it does allow for retrieving the raw URL
before resolution, or for getting other properties from the remote's Git
config.

Also, allow FugitiveRemoteUrl(browse_opts) to directly retrieve the URL.
2021-08-21 21:26:45 -04:00
Tim Pope
39ff394b4e Rearrange fugitive#ResolveRemote()
This came out of a refactor to return the various URL components
separately.  I'm not ready to merge that, but this change feels like
enough of an improvement to merge for its own sake.
2021-08-21 21:26:45 -04:00
Tim Pope
57eeed2545 Add alternatives to :GBrowse ++remote=
In the same way Vim requires custom commands to start with an uppercase
letter, I'm starting to think we should self-impose the same constraint
on custom ++options.  Also, let's throw "Git" in there, just to allow
this to be truly unique if necessary.

This also allows a special remote argument of ".git" to refer to the
local repository.  A possible use of this would be a local gitweb
handler.
2021-08-21 21:26:45 -04:00
Tim Pope
4e6b7b6ce9 Don't accept 0 to refer to alternate buffer
This allows a sensible interpretation when using 0 as a stand-in for
"false".  You can use bufnr('#') if you need the old behavior.
2021-08-21 19:55:43 -04:00
Tim Pope
199dbb1164 Fix duplicate help tag
Pretty sure basically nobody used the old usage so this is fine.
2021-08-20 19:43:52 -04:00
Tim Pope
46358f87e7 Fix U in status window
Must have fat fingered this at the last second.  I mean, I forgot the
<C-U>, but I most definitely did not forget the colon.
2021-08-20 18:50:11 -04:00
Tim Pope
7e53b2aef9 Update documentation for :Git 2021-08-20 17:23:28 -04:00
Tim Pope
66a070ab14 Use :Git --no-pager in Vim 7 to directly echo output
At long last we will have a way to directly invoke :Git from inside
various status maps without subjecting Vim 7 users to a press enter
prompt.
2021-08-20 17:23:28 -04:00
Tim Pope
98039f3349 Move FugitivePath() away from documented functions
This function has weird semantics and does not rise to the level of its
peers.
2021-08-20 13:09:20 -04:00
Tim Pope
05a443cd6e Add unofficial raw argument list support to fugitive#Execute()
Hedging our bets for the future.
2021-08-20 13:09:20 -04:00
Tim Pope
2c6bd3bd2d Improve tab completion for :Git push
References: https://github.com/tpope/vim-fugitive/issues/1813
2021-08-20 11:50:05 -04:00
Tim Pope
aae36024b8 Introduce FugitiveShellCommand() to replace FugitivePrepare()
We've moved on from the shell as the one true way, so let's demote the
one true preparation function.
2021-08-20 10:24:57 -04:00
Tim Pope
3125b07645 Fix :Ggrep argument parsing off-by-one error 2021-08-20 10:24:57 -04:00
Tim Pope
f674916597 Eliminate speck of repetition around :Git --no-pager
It's not the repetition that bothers me so much as the fact these two
things belong side by side.
2021-08-20 10:24:57 -04:00
Tim Pope
b70c10f2bd Disable 'more' on :Git --no-pager 2021-08-20 08:59:51 -04:00
Tim Pope
9cf20dbff5 Don't set $COLUMNS on legacy :! implementation
It's unnecessary and offensive to the eye.
2021-08-20 08:59:51 -04:00
Tim Pope
2f51a93e89 Fix pseudo-job execution on Vim 7
Closes https://github.com/tpope/vim-fugitive/issues/1815
2021-08-20 08:59:51 -04:00
Tim Pope
fd24cb2acd Add -z to :Ggrep quickfix opening flags
I mean, it's not like we can do anything else with it.
2021-08-20 00:47:49 -04:00
Tim Pope
86a45846fc Use :Ggrep -q to eschew output in favor of quickfix window
The q works on 2 levels!
2021-08-20 00:31:41 -04:00
Tim Pope
e716ebdda9 Avoid more possibilities for :Ggrep more prompt
I think this could only happen with a screen one line high, but let's
avoid tempting fate
2021-08-19 22:25:07 -04:00
Tim Pope
771d1e3711 Avoid line echo during jump to file in :Git -p grep 2021-08-19 19:36:22 -04:00
Tim Pope
01e843c21d Avoid :Ggrep interrupt leaving behind result without file 2021-08-19 19:35:33 -04:00
Tim Pope
0cbc28ba33 Avoid -- More -- prompt during :Ggrep
Resolves: https://github.com/tpope/vim-fugitive/issues/1814
2021-08-19 16:36:44 -04:00
Tim Pope
81f293852e Stream to preview window on :Git! command 2021-08-19 13:51:20 -04:00
Tim Pope
e93d45e4ce Fix constructing Git shell commands 2021-08-19 13:50:42 -04:00
Tim Pope
eafb44a720 Use jobs for :Git --paginate 2021-08-19 13:31:37 -04:00
Tim Pope
952a49f688 Tweak check for Git in PATH
First attempt was overthinking it.
2021-08-19 13:23:20 -04:00
Tim Pope
9ba2680ad5 Add special case error for failure to find Git in PATH 2021-08-19 12:13:03 -04:00
Tim Pope
98bd8428b5 Add optional callback to FugitiveConfig()
Obvious next step is to make this asynchronous, but let's settle for
getting the API in place for now.
2021-08-19 11:09:47 -04:00
Tim Pope
9ab7ac303a Accept Git dir as first argument to FugitiveRemoteUrl() 2021-08-18 13:11:57 -04:00
Tim Pope
286bf9096d Use jobs for :Ggrep 2021-08-17 22:49:39 -04:00
Tim Pope
6c18adaf98 Use jobs for quickfix commands 2021-08-17 21:47:24 -04:00
Tim Pope
9a2299038b Standardize on 'git_dir' as dictionary key
We've been moving this way for a while, but progress is slow, so let's
help it along a bit.
2021-08-17 21:47:24 -04:00
Tim Pope
809efd3f62 Fix :Gedit .git with nonstandard .git dir 2021-08-17 20:43:53 -04:00
Tim Pope
9216210b86 Pass --git-dir= alongside -C for nontrivial cases
References: https://github.com/tpope/vim-fugitive/issues/1796
2021-08-17 20:29:09 -04:00
Tim Pope
64133cae30 Avoid unnecessary -C when querying Git config
Let's keep this low level operation away from any wonkiness caused by a
missing or bad core.worktree.
2021-08-17 20:29:09 -04:00
Tim Pope
9b31f4bee5 Include cwd in fugitive#Execute() result
I guess we should allow for the future possibility the working directory
can be specified.
2021-08-17 19:59:04 -04:00
Tim Pope
40542f1dd1 Include --no-literal-pathspecs in FugitiveResult().flags
This allows for passing the result to helpers like
fugitive#ShellCommand() without its own path munging behaviors kicking
in.
2021-08-17 19:11:30 -04:00
Tim Pope
2039676d97 Respect environment variable overrides when opening terminal 2021-08-17 17:19:46 -04:00
Tim Pope
f047d8250d Improve check for job environment variable support
The patch specified was incorrect for Vim, and this api_info() malarkey
appears to be the only way to check for Neovim 0.5.0 proper.
2021-08-17 17:19:46 -04:00
Tim Pope
2fc1a0017c Accept buffer numbers and dictionaries in FugitiveDetect()
This makes it easier to use FugitiveDetect() to initialize a temp file
that sits outside of the repository.
2021-08-17 17:19:46 -04:00
Tim Pope
80e7c63fb1 Support jump to file under cursor in :Git -p grep
This also adds support for :Git -p status, since we basically already
have an implementation for it.
2021-08-17 17:18:20 -04:00
Tim Pope
2d3e83abe3 Improve git grep argument handling
Add a parsing special case for --count, and improve the handling of
--open-files-in-pager.
2021-08-17 13:07:41 -04:00
Tim Pope
b5e7e1ba24 Don't match :0: as line number in :Ggrep
This is explicitly to help with false positives in surrounding context
while grepping this very file, as :0: is used in numerous places to
reference blobs in the index.  We also use :1: and company in a few
places, but a robust fix is much harder.
2021-08-16 18:28:27 -04:00
Tim Pope
f3e92c7721 Deprecate CTRL-N and CTRL-P 2021-08-14 10:23:57 -04:00
Tim Pope
bec8e7b7c7 Don't override user maps with removal notices
Resolves: https://github.com/tpope/vim-fugitive/issues/1811
2021-08-14 10:23:28 -04:00
4 changed files with 1121 additions and 548 deletions

View File

@@ -99,14 +99,9 @@ Install using your favorite package manager, or use Vim's built-in package suppo
> `:Gfetch`?
This behavior was divisive, confusing, and complicated inputting passwords, so
it was removed. Use `:Dispatch git push` for effectively the same behavior,
or provide your own asynchronous `:Gpush` and `:Gfetch` by adding the
following to your vimrc:
command! -bang -bar -nargs=* Gpush execute 'Dispatch<bang> -dir=' .
\ fnameescape(FugitiveGitDir()) 'git push' <q-args>
command! -bang -bar -nargs=* Gfetch execute 'Dispatch<bang> -dir=' .
\ fnameescape(FugitiveGitDir()) 'git fetch' <q-args>
it was removed. Use `:Git! push` to use Fugitive's own asynchronous
execution, or retroactively make `:Git push` asynchronous by pressing
`CTRL-D`.
> So I have a symlink and...

File diff suppressed because it is too large Load Diff

View File

@@ -15,9 +15,12 @@ COMMANDS *fugitive-commands*
These commands are local to the buffers in which they work (generally, buffers
that are part of Git repositories).
*:Git* *fugitive-:G*
*fugitive-:G*
:G [args] Same as :Git, but two characters shorter.
*:Git*
:Git {args} Run an arbitrary git command and display any output.
:G {args} On UNIX this uses a pty and on other platforms it uses
On UNIX this uses a pty and on other platforms it uses
a pipe, which will cause some behavior differences
such as the absence of progress bars. Any file the
command edits (for example, a commit message) will be
@@ -25,17 +28,28 @@ that are part of Git repositories).
resume running the command. A few Git subcommands
have different behavior; these are documented below.
*:Git!*
:Git! {args} Run an arbitrary git command in the background and
stream the output to the preview window. Requires a
Vim with |setbufline()|. Press CTRL-D during an
interactive :Git invocation to switch to this mode
retroactively.
*:Git_--paginate* *:Git_-p*
:Git --paginate {args} Run an arbitrary git command, capture output to a temp
:Git -p {args} file, and |:split| that temp file. Use :0Git to
:G --paginate {args} |:edit| the temp file instead. A temp file is always
:G -p {args} used for commands like diff and log that typically
user a pager, and for any command that has the
pager.<cmd> Git configuration option set.
:Git -p {args} file, and |:split| that temp file. Pass ++curwin as
the first argument to |:edit| the temp file instead.
A temp file is always used for commands like diff and
log that typically uses a pager, and for any command
that has the pager.<cmd> Git configuration option set.
:{range}Git! --paginate {args}
:{range}Git! -p {args} Run an arbitrary git command, and insert the output
after {range} in the current buffer.
*fugitive-summary*
:Git With no arguments, bring up a summary window vaguely
:G akin to git-status. Press g? or see |fugitive-maps|
akin to git-status. Press g? or see |fugitive-maps|
for usage.
*:Git_blame*
@@ -84,13 +98,17 @@ that are part of Git repositories).
*:Git_mergetool*
:Git mergetool [args] Like |:Git_difftool|, but target merge conflicts.
*:Ggrep* *:Gcgrep* *:Git_grep*
:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'.
:Git[!] grep [args]
*:Ggrep* *:Git_grep*
:Ggrep[!] [args] An approximation of |:grep|[!] with git-grep as
:Git[!] grep -O [args] 'grepprg'.
:Ggrep[!] --quiet [args]
:Ggrep[!] -q [args] Like |:Ggrep|, but instead of displaying output, open
the quickfix list.
*:Glgrep*
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
:0Git[!] grep [args]
:Glgrep[!] [args] :Ggrep but for |:lgrep|.
:0Git[!] grep -O [args]
*:Gclog*
:Gclog[!] [args] Use git-log [args] to load the commit history into the
@@ -170,10 +188,10 @@ that are part of Git repositories).
:Gdiffsplit [object] Perform a |vimdiff| against the given file, or if a
commit is given, the current file in that commit.
With no argument, the version in the index or work
tree is used. The newer of the two files is placed to
the right or bottom, depending on 'diffopt' and the
width of the window relative to 'textwidth'. Use
Vim's |do| and |dp| to stage and unstage changes.
tree is used, and the work tree version is always
placed to the right or bottom, depending on available
width. Use Vim's |do| and |dp| to stage and unstage
changes.
*:Gdiffsplit!*
:Gdiffsplit! Diff against any and all direct ancestors, retaining
@@ -190,7 +208,10 @@ that are part of Git repositories).
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*:Ghdiffsplit*
:Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally.
:Gdiffsplit ++novertical [object]
:Ghdiffsplit [object] Like |:Gdiffsplit|, but with "vertical" removed from
'diffopt'. The split will still be vertical if
combined with |:vertical|.
*:GMove*
:GMove {destination} Wrapper around git-mv that renames the buffer
@@ -606,11 +627,8 @@ AUTOCOMMANDS *fugitive-autocommands*
A handful of |User| |autocommands| are provided to allow extending and
overriding Fugitive behaviors. Example usage:
>
autocmd User FugitiveBlob call s:BlobOverrides()
autocmd User FugitiveBlob,FugitiveStageBlob call s:BlobOverrides()
<
*User_FugitiveIndex*
FugitiveIndex After loading the |fugitive-summary| buffer.
*User_FugitiveTag*
FugitiveTag After loading a tag object.
@@ -621,10 +639,22 @@ FugitiveCommit After loading a commit object.
FugitiveTree After loading a tree (directory) object.
*User_FugitiveBlob*
FugitiveBlob After loading a blob (file) object. This includes
both committed blobs which are read only, and staged
blobs which can be edited and written. Check
&modifiable to distinguish between the two.
FugitiveBlob After loading a committed blob (file) object.
*User_FugitiveObject*
FugitiveObject After loading any of the 4 above buffer types.
*User_FugitiveStageBlob*
FugitiveStageBlob After loading a staged blob (file) object. These
buffers are 'modifiable' and oftentimes don't want the
same behavior as the other buffer types.
*User_FugitiveIndex*
FugitiveIndex After loading the |fugitive-summary| buffer.
*User_FugitivePager*
FugitivePager After loading a temp file created by a command like
:Git --paginate or :Git blame.
*User_FugitiveChanged*
FugitiveChanged After any event which can potentially change the
@@ -661,7 +691,6 @@ version.
*:Gfetch* Superseded by |:Git| fetch.
*:Glog* Superseded by |:Gclog|.
*:Gstatus* Superseded by |:Git| (with no arguments).
*:Git!* Superseded by |:Git_--paginate|.
*:Gsplit!* Superseded by |:Git_--paginate|.
*:Gvsplit!* Superseded by :vert Git --paginate.
*:Gtabsplit!* Superseded by :tab Git --paginate.

View File

@@ -1,6 +1,6 @@
" fugitive.vim - A Git wrapper so awesome, it should be illegal
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 3.3
" Version: 3.4
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
if exists('g:loaded_fugitive')
@@ -16,9 +16,9 @@ let s:bad_git_dir = '/$\|^fugitive:'
" Fugitive is active in the current buffer. Do not rely on this for direct
" filesystem access; use FugitiveFind('.git/whatever') instead.
function! FugitiveGitDir(...) abort
if v:version < 704
if v:version < 703
return ''
elseif !a:0 || type(a:1) == type(0) && a:1 < 0
elseif !a:0 || type(a:1) == type(0) && a:1 < 0 || a:1 is# get(v:, 'true', -1)
if exists('g:fugitive_event')
return g:fugitive_event
endif
@@ -30,7 +30,7 @@ function! FugitiveGitDir(...) abort
return b:git_dir
endif
return dir =~# s:bad_git_dir ? '' : dir
elseif type(a:1) == type(0)
elseif type(a:1) == type(0) && a:1 isnot# 0
if a:1 == bufnr('') && (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
endif
@@ -55,7 +55,11 @@ endfunction
" exists, call FooReal("foo://bar").
function! FugitiveReal(...) abort
let file = a:0 ? a:1 : @%
if file =~# '^\a\a\+:' || a:0 > 1
if type(file) ==# type({})
let dir = FugitiveGitDir(file)
let tree = s:Tree(dir)
return FugitiveVimPath(empty(tree) ? dir : tree)
elseif file =~# '^\a\a\+:' || a:0 > 1
return call('fugitive#Real', [file] + a:000[1:-1])
elseif file =~# '^/\|^\a:\|^$'
return file
@@ -72,25 +76,13 @@ endfunction
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
function! FugitiveFind(...) abort
if a:0 && type(a:1) ==# type({})
if a:0 && (type(a:1) ==# type({}) || type(a:1) ==# type(0))
return call('fugitive#Find', a:000[1:-1] + [FugitiveGitDir(a:1)])
else
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
endif
endfunction
function! FugitivePath(...) abort
if a:0 > 2 && type(a:1) ==# type({})
return fugitive#Path(a:2, a:3, FugitiveGitDir(a:1))
elseif a:0 && type(a:1) ==# type({})
return FugitiveReal(a:0 > 1 ? a:2 : @%)
elseif a:0 > 1
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
else
return FugitiveReal(a:0 ? a:1 : @%)
endif
endfunction
" FugitiveParse() takes a fugitive:// URL and returns a 2 element list
" containing an object name ("commit:file") and the Git dir. It's effectively
" the inverse of FugitiveFind().
@@ -107,6 +99,14 @@ function! FugitiveParse(...) abort
throw v:errmsg
endfunction
" FugitiveGitVersion() queries the version of Git in use. Pass up to 3
" arguments to return a Boolean of whether a certain minimum version is
" available (FugitiveGitVersion(2,3,4) checks for 2.3.4 or higher) or no
" arguments to get a raw string.
function! FugitiveGitVersion(...) abort
return call('fugitive#GitVersion', a:000)
endfunction
" FugitiveResult() returns an object encapsulating the result of the most
" recent :Git command. Will be empty if no result is available. During a
" User FugitiveChanged event, this is guaranteed to correspond to the :Git
@@ -125,15 +125,43 @@ function! FugitiveResult(...) abort
return call('fugitive#Result', a:000)
endfunction
" FugitivePrepare() constructs a Git command string which can be executed with
" functions like system() and commands like :!. Integer arguments will be
" treated as buffer numbers, and the appropriate relative path inserted in
" their place.
" FugitiveExecute() runs Git with a list of arguments and returns a dictionary
" with the following keys:
"
" If the first argument is a string that looks like a path or an empty string,
" it will be used as the Git dir. If it's a buffer number, the Git dir for
" that buffer will be used. The default is the current buffer.
" * "exit_status": The integer exit code of the process.
" * "stdout": The stdout produced by the process, as a list of lines.
" * "stderr": The stdout produced by the process, as a list of lines.
"
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
"
" An optional final argument is a callback Funcref, for asynchronous
" execution.
function! FugitiveExecute(args, ...) abort
return call('fugitive#Execute', [a:args] + a:000)
endfunction
" FugitiveShellCommand() turns an array of arugments into a Git command string
" which can be executed with functions like system() and commands like :!.
" Integer arguments will be treated as buffer numbers, and the appropriate
" relative path inserted in their place.
"
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
function! FugitiveShellCommand(...) abort
return call('fugitive#ShellCommand', a:000)
endfunction
" FugitivePrepare() is a deprecated alias for FugitiveShellCommand(). If you
" are using this in conjunction with system(), consider using
" FugitiveExecute() instead.
function! FugitivePrepare(...) abort
if !exists('s:did_prepare_warning')
let s:did_prepare_warning = 1
echohl WarningMsg
unsilent echomsg 'FugitivePrepare() has been superseded by FugitiveShellCommand()'
echohl NONE
endif
return call('fugitive#ShellCommand', a:000)
endfunction
@@ -182,6 +210,18 @@ function! FugitiveRemoteUrl(...) abort
return call('fugitive#RemoteUrl', a:000)
endfunction
" FugitiveDidChange() triggers a FugitiveChanged event and reloads the summary
" buffer for the current or given buffer number's repository. You can also
" give the result of a FugitiveExecute() and that context will be made
" available inside the FugitiveChanged() event.
"
" Passing the special argument 0 (the number zero) softly expires summary
" buffers for all repositories. This can be used after a call to system()
" with unclear implications.
function! FugitiveDidChange(...) abort
return call('fugitive#DidChange', a:000)
endfunction
" FugitiveHead() retrieves the name of the current branch. If the current HEAD
" is detached, FugitiveHead() will return the empty string, unless the
" optional argument is given, in which case the hash of the current commit
@@ -190,7 +230,7 @@ endfunction
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
function! FugitiveHead(...) abort
if a:0 && type(a:1) ==# type({})
if a:0 && (type(a:1) ==# type({}) || type(a:1) ==# type('') && a:1 !~# '^\d\+$')
let dir = FugitiveGitDir(a:1)
let arg = get(a:, 2, 0)
elseif a:0 > 1
@@ -206,6 +246,18 @@ function! FugitiveHead(...) abort
return fugitive#Head(arg, dir)
endfunction
function! FugitivePath(...) abort
if a:0 > 2 && type(a:1) ==# type({})
return fugitive#Path(a:2, a:3, FugitiveGitDir(a:1))
elseif a:0 && type(a:1) ==# type({})
return FugitiveReal(a:0 > 1 ? a:2 : @%)
elseif a:0 > 1
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
else
return FugitiveReal(a:0 ? a:1 : @%)
endif
endfunction
function! FugitiveStatusline(...) abort
if empty(get(b:, 'git_dir', ''))
return ''
@@ -299,7 +351,13 @@ function! s:CeilingDirectories() abort
endfunction
function! FugitiveExtractGitDir(path) abort
if type(a:path) ==# type({})
return get(a:path, 'git_dir', '')
elseif type(a:path) == type(0)
let path = s:Slash(a:path >= 0 ? bufname(a:path) : bufname(''))
else
let path = s:Slash(a:path)
endif
if path =~# '^fugitive:'
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
elseif empty(path)
@@ -355,15 +413,15 @@ function! FugitiveExtractGitDir(path) abort
return ''
endfunction
function! FugitiveDetect(path) abort
if v:version < 704
function! FugitiveDetect(...) abort
if v:version < 703
return ''
endif
if exists('b:git_dir') && b:git_dir =~# '^$\|' . s:bad_git_dir
unlet b:git_dir
endif
if !exists('b:git_dir')
let b:git_dir = FugitiveExtractGitDir(a:path)
let b:git_dir = FugitiveExtractGitDir(a:0 ? a:1 : bufnr(''))
endif
if empty(b:git_dir) || !exists('#User#Fugitive')
return ''
@@ -424,7 +482,7 @@ function! s:ProjectionistDetect() abort
endif
endfunction
let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
let s:addr_other = has('patch-8.1.560') || has('nvim-0.5.0') ? '-addr=other' : ''
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
@@ -433,16 +491,22 @@ if exists(':G') != 2
endif
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 1)
if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 0)
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echomsg ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE'
elseif exists(':Gstatus') != 2 && !exists('g:fugitive_legacy_commands')
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus'
\ ' echoerr ":Gstatus has been removed in favor of :Git (with no arguments)"'
endif
for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame']
if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 1)
if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 0)
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
\ 'echohl WarningMSG|echomsg ":G' . tolower(s:cmd) . ' is deprecated in favor of :Git ' . tolower(s:cmd) . '"|echohl NONE|'
\ 'exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "' . tolower(s:cmd) . ' " . <q-args>)'
elseif exists(':G' . tolower(s:cmd)) != 2 && !exists('g:fugitive_legacy_commands')
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
\ 'echoerr ":G' . tolower(s:cmd) . ' has been removed in favor of :Git ' . tolower(s:cmd) . '"'
endif
endfor
unlet s:cmd
@@ -451,12 +515,14 @@ exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(<q-args>, 1)"
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#GrepCommand(0, <count> > 0 ? <count> : 0, +"<range>", <bang>0, "<mods>", <q-args>)'
if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 1)
if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 0)
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
\ '|echohl WarningMSG|echomsg ":Glog is deprecated in favor of :Gclog"|echohl NONE'
elseif exists(':Glog') != 2 && !exists('g:fugitive_legacy_commands')
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog'
\ ' echoerr ":Glog has been removed in favor of :Gclog"'
endif
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
@@ -510,7 +576,7 @@ if exists(':Gbrowse') != 2 && get(g:, 'fugitive_legacy_commands', 1)
\ '|if <bang>1|redraw!|endif|echohl WarningMSG|echomsg ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE'
endif
if v:version < 704
if v:version < 703
finish
endif
@@ -546,7 +612,7 @@ augroup fugitive
\ setlocal foldtext=fugitive#Foldtext() |
\ endif
autocmd FileType fugitive
\ call fugitive#MapCfile('fugitive#StatusCfile()')
\ call fugitive#MapCfile('fugitive#PorcelainCfile()')
autocmd FileType gitrebase
\ let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' |
\ if &l:includeexpr !~# 'Fugitive' |