303 Commits
v3.1 ... v3.3

Author SHA1 Message Date
Tim Pope
f5451e4379 fugitive.vim 3.3
* Replace :! :Git backend with smart job runner.
* Replace special cased commit/revert/rebase/merge/etc. with regular :Git.
* Support :Git -c config.name=value and other common flags.
* Improve completion of :Git subcommands, including hiding plumbing commands.
* Improve completion of arguments to :Git subcommands.
* Show unpulled and unpushed sections for both upstream and push remote.
* Introduce capitalized naming scheme for :GMove/:GRename/:GRemove/:GDelete/:GBrowse.
* Expand SSH host aliases in remote URLs for :GBrowse.
* Enable opening arbitrary URLs with :GBrowse.
* Add warnings to deprecated commands.
* Remove all other temp buffer commands in favor of :Git --paginate.
* Don't automatically invoke :setlocal foldmethod=syntax in Fugitive buffers.
* Support colored :Git blame commits in 256 color terminals.
* Bug fixes.
2021-04-15 12:15:38 -04:00
Tim Pope
0365bcd76e Provide FugitiveConfigGetRegexp()
This is intended to double as way to check for the presence of any other
Fugitive 3.3 feature.
2021-04-15 10:15:29 -04:00
Tim Pope
2165884d13 Provide FugitiveResult() 2021-04-15 10:15:29 -04:00
Tim Pope
4139dc521c Support :Gwrite +aftercommand
Closes https://github.com/tpope/vim-fugitive/pull/562
2021-04-15 10:15:29 -04:00
Tim Pope
f72ad60097 Only do "guessed" :Gwrite behaviors with no argument
These seem pretty silly these days and should probably be removed, but
let's start by reducing their scope.
2021-04-15 10:15:29 -04:00
Tim Pope
8686eb17e0 Fix :Git difftool work-tree paths
I don't think the change that this reverts was necessarily wrong,
but this isn't the best time in the release cycle to play whack-a-mole
with unintended consequences.

Closes https://github.com/tpope/vim-fugitive/issues/1732
2021-04-15 09:05:31 -04:00
Tim Pope
1d00a7392b Fix :GBrowse :/ in bare repositories 2021-04-13 13:01:07 -04:00
Tim Pope
054fca2269 Return empty string on FugitiveFind() with no Git dir
Previously, we would return a path from the current working directory in
this case, which was a good fallback for :Gedit but unhelpful for
general programmatic usage.
2021-04-13 08:08:59 -04:00
Tim Pope
7866e83cc2 Fix :Gedit / 2021-04-13 08:07:40 -04:00
Tim Pope
503c22f1f5 Fix status in bare repository 2021-04-13 08:03:28 -04:00
Tim Pope
d4e8c29084 Account for invalid b:git_dir in FugitiveGitDir()
The "fugitive:" variant was set by a naive regexp in ftplugin/git*.vim
until a relatively recent fix.
2021-04-13 03:37:30 -04:00
Tim Pope
ae45609cfc Proactively detect Git dir if autocommand hasn't triggered
This is a little clunky, but enabling !empty(FugitiveGitDir()) to work
in autocommands that trigger before ours should provide an acceptable
replacement for the "User Fugitive" event and will hopefully enable us
to unltimately eliminate preemptive detection entirely.
2021-04-12 14:32:10 -04:00
Tim Pope
54cc9d01ad Always set b:git_dir
This makes it possible to tell when detection hasn't happened yet, and
is potentially a stepping stone to doing it on the fly.
2021-04-12 13:31:42 -04:00
Tim Pope
649cb2dc05 Add deprecation warnings to :Glog and :Gstatus 2021-04-12 12:07:52 -04:00
Tim Pope
47479a6cc2 Add :Glog and :Gstatus to list of opt-out legacy commands 2021-04-12 12:03:12 -04:00
Tim Pope
94bc89da0f Don't use pty on win32unix
This appears to work fine in some setups, but has the same problems
as regular win32 in others.  Most notably, for it to work properly with
the Vim included with Git for Windows, the experimental pseudo console
support must not be enabled.  Lacking a method to distinguish between
the two cases, I see no better option than disabling it on all win32unix
installations.

Closes https://github.com/tpope/vim-fugitive/issues/1726
2021-04-10 21:35:49 -04:00
Tim Pope
222c9ccbc6 Don't trigger BufWrite during :Git blame
Closes https://github.com/tpope/vim-fugitive/issues/1724
2021-04-08 21:26:55 -04:00
Tim Pope
8ede0aaf57 Provide :GBrowse behavior in blame buffers
If a line number is given, browse to the commit on that line.
Otherwise, browse to the file, same as if called from the original
buffer.

It would probably make more sense to open the corresponding blame page
on providers that support it, but that will have to wait on an API
change.

References https://github.com/tpope/vim-fugitive/issues/1214
2021-04-07 01:04:36 -04:00
Tim Pope
3a319cd5b8 Don't rely on current buffer's Git dir for :GBrowse
This makes :GBrowse fugitive://... work when the buffer name is from a
different repository.  It doesn't solve the harder problems of making it
work with a regular filename, or making it not bail early when the
current buffer doesn't belong to a repository at all.
2021-04-07 01:04:36 -04:00
Tim Pope
cd8bd39567 Support all <cword> style expansions
The previous implementation for <cfile> didn't handle <cfile>:h
correctly.  May as well support the rest of the gang while fixing this.
Note that unlike for % and #, these can return a commit in addition to a
file name.  Use a ":." expansion, as in "<cfile>:.", to get the
corresponding work tree file.
2021-04-07 01:04:36 -04:00
Tim Pope
d4d2b9c6b2 Ignore :GBrowse line numbers for non-blob objects
Pave the way to use these for other purposes.
2021-04-06 23:41:18 -04:00
Tim Pope
485251ec73 Provide "." and "<C-R><C-G>" in blame buffers 2021-04-06 23:41:18 -04:00
Tim Pope
50b57ba400 Fix double "fugitive:" in error message 2021-04-06 23:41:18 -04:00
Tim Pope
b4255d6679 Add notices to deprecated lowercase commands 2021-04-06 20:43:26 -04:00
Tim Pope
87b169728c Add aliases for blame "-" map
This is one of the more common conflicts people have with their own
maps, so make it available on "s" and "u".  This roughly lines up with
the status buffer maps, which I think is as good of decision as any,
lacking a better mnemonic.
2021-04-06 20:43:26 -04:00
Tim Pope
f29c9e5079 Support :GBrowse {url} outside of Git repository 2021-04-04 18:26:17 -04:00
Tim Pope
81074db0ee Pass <mods> along to URL opener
I don't know if there is a use for this, but it seems like the right
thing to do.
2021-04-03 23:35:42 -04:00
Tim Pope
2ef9d9a748 Use :echo not :echomsg for displaying :GBrowse URL
Logging the URL permanently to :messages was a mistake.
2021-04-03 23:35:42 -04:00
Tim Pope
ce58344c9e Jump to correct Unpushed/Unpulled section on reload 2021-04-03 20:44:31 -04:00
Tim Pope
e474785adb Handle non-config dictionary passed to FugitiveConfig() 2021-04-03 20:44:31 -04:00
Tim Pope
d3341147ef URL escape :command special characters
Handle the case where the :Browse or :OpenBrowser command we delegate to
is defined with -bar.
2021-04-03 20:44:31 -04:00
Tim Pope
1a765a46c1 Add git_dir key to :GBrowse API
This enables passing the whole options dictionary to helpers like
FugitiveWorkTree().
2021-04-03 20:44:31 -04:00
Tim Pope
5a54ea4333 Handle race condition closing job stdin
This race condition is there for any key press, but it's greatly
exaggerated by Vim's default one second timeout on Escape.  This delay
also disqualifies Escape as the official interface to this feature, but
leave it as a DWIM alternative to CTRL-D for now.

Closes https://github.com/tpope/vim-fugitive/issues/1722
2021-04-01 20:50:34 -04:00
Tim Pope
1d91517cdb Don't discard deleted submodules
There isn't a good command to use for the undo.

References https://github.com/tpope/vim-fugitive/issues/1705
2021-04-01 20:50:34 -04:00
Tim Pope
c028ea5a44 Add foldtext for hunk headers 2021-04-01 08:57:58 -04:00
Tim Pope
88f50bba60 Press escape to background :Git to preview window
This can one day hopefully be generalized to handle --paginate, but for
now, leave it as undocumented experiment.
2021-03-31 16:06:40 -04:00
Tim Pope
9bd7c26466 Expand <cfile>
This doesn't play well with :Git as it can result in a fugitive:// URL,
but it does make :Gedit <cfile> and :GBrowse <cfile> do what I mean.
2021-03-31 16:05:14 -04:00
Tim Pope
002ed8de2e Make FugitiveChanged event aware of :Git result
If g:fugitive_result is defined during the User FugitiveChanged event,
one can trigger a custom behavior based on the arguments in .args or the
output in .file.

References https://github.com/tpope/vim-fugitive/pull/1015
2021-03-30 13:33:23 -04:00
Tim Pope
a1cb01da5b Provide :Gedit - to open previous :Git output
Also, provide :GBrowse - to open the first URL contained in that output.
2021-03-29 21:20:28 -04:00
Tim Pope
6b39f6c641 Restore X on submodules
References https://github.com/tpope/vim-fugitive/issues/1705
2021-03-29 20:32:11 -04:00
Tim Pope
09cbabe793 Don't trigger FugitiveChanged until :Git finishes output
Since this user event can error or otherwise interrupt us, run it as
late as possible.  Also rearrange a bit so that a user error won't
cascade to "missing :endif".
2021-03-29 19:33:01 -04:00
Tim Pope
258dd16938 Fix undesired line wrap in :Git output
If Vim is 100 columns wide, and we echo a string exactly 100 characters
long, Vim will insert a line break that a terminal wouldn't.  This is
particularly noticeable with progress bars that Git erases with a screen
width's worth of whitespace.  Work around this by decreasing the number
of columns by 1.
2021-03-28 14:42:46 -04:00
Tim Pope
112310c026 Move edit sentinel removal out of resume handler
Enable using this function in cases other than pausing for edit.
2021-03-28 14:42:46 -04:00
Tim Pope
f4acdcc5b4 Eliminate blank line after resuming from GIT_EDITOR
Also add has_key(a:tmp, 'echo') checks to allow for future async
workflows.
2021-03-27 23:08:13 -04:00
Tim Pope
f7321f6d5b Allow close callback to run before leaving job wait loop
Apparently, both job_status() == "dead" and ch_status() == "closed"
isn't enough to guarantee all callbacks have run.  One last sleep seems
to do the trick, but let's also add a sanity check because this can
cause confusing, hard to debug behavior.
2021-03-27 23:08:13 -04:00
Tim Pope
00cb68e627 Echo from wait loop, not job callback
This makes the pager behave a better, allowing the -- More -- prompt to
actually display and not dropping output if the process exits while
there's a backlog.  An additional benefit is if Git for some reason
produces additional output while GIT_EDITOR is running, that output will
be buffered rather than interrupting the user.

The extracted s:RunTick() helper changes the Vim behavior to check the
process status after waiting as well as before.  This brings it in line
with how Neovim's jobwait() appears to work.

The zero argument :echo after the final s:RunEcho() clears up some weird
draw issues with `:Git command|someothercommand`.

References https://github.com/tpope/vim-fugitive/issues/1717
2021-03-27 15:38:29 -04:00
Tim Pope
af1a46edb7 Don't record last job until after completion
This prevents orphaning a :Git commit when calling a second :Git command
while editing the commit message, and is more predictable all around.
2021-03-27 15:38:29 -04:00
Tim Pope
eaee845aba Unify remote resolution
HTTP redirects and SSH host aliases are just different manifestations of
the same indirection, so handle them both in FugitiveRemoteUrl().  Also
make this function idempotent if a URL is passed in, and pass some
sensible options to cURL.
2021-03-26 12:26:27 -04:00
Tim Pope
6860c592ad Capture cwd of :Git command 2021-03-26 12:26:27 -04:00
Tim Pope
a12e88bcc2 Add error message when editing after Vim exit
I don't think it's possible to see this, but we can use this error
delivery system for other purposes.
2021-03-26 12:26:21 -04:00
Tim Pope
0713b84f97 Don't wait silently on :wall with 'confirm' 2021-03-26 12:26:21 -04:00
Tim Pope
93b434949b Don't try to send :Git process CTRL-C when stdin is closed
Curiously, this appears to work anyways in Neovim, but not Vim.
2021-03-25 19:32:50 -04:00
Tim Pope
7de9b5a04b Retool :Git blame colored commits
Use 3 characters of the commit hash rather than 6, limiting the maximum
total declarations to 4,096 rather than 16 million. Avoid color
components lower than 0x20 and higher than 0xdf to help avoid colors
that blend into the background, light or dark.  And for the terminal,
replace the use of CSApprox with a simple usage of the 6x6x6 color cube
found on 256 color terminals.  CSApprox aims to provide accurate
replication of the input colors, whereas our goal is simply to use all
colors in roughly equal amounts.
2021-03-25 11:34:29 -04:00
Tim Pope
b2195e7690 Extract fugitiveblame ftplugin
References https://github.com/tpope/vim-fugitive/issues/1425
2021-03-24 21:17:37 -04:00
Tim Pope
5e5ce843ea Automatically mkdir when editing .git/info/exclude 2021-03-24 19:56:08 -04:00
Tim Pope
a03444404a Capture exit status of :Git 2021-03-24 17:42:16 -04:00
Tim Pope
64a3f99d03 Pass private job state to s:RunWait() 2021-03-24 17:42:16 -04:00
Tim Pope
9103a738c7 Fix :GBrowse with no argument 2021-03-24 17:42:16 -04:00
Tim Pope
156dbcd738 Don't set foldmethod=syntax in historical buffers
This was originally implemented in part to address the marker fold
method triggering on diffs, so try to still solve that.
2021-03-24 14:21:32 -04:00
Tim Pope
133bf406c7 Accept alternate syntax for :GBrowse remote
The @ syntax is kind of weird as you can't use fnameescape() to get
around it.  Add an alternative syntax for programmatic usage.
2021-03-24 14:21:32 -04:00
Tim Pope
d5d436bfa3 Tweak default list of paginated commands
The only functional change here should be the exclusion of the diff-*
plumbing commands.
2021-03-24 14:21:17 -04:00
Tim Pope
53df837ac6 Don't complete directories as subcommands 2021-03-24 14:20:45 -04:00
Tim Pope
0205ae8d45 Handle tabs in commit subject
References https://github.com/tpope/vim-fugitive/pull/1713
2021-03-24 14:20:45 -04:00
Tim Pope
11b824a0ee Forcefully disable colors on paginated :Git output
References https://github.com/tpope/vim-fugitive/discussions/1711
2021-03-24 14:20:45 -04:00
Tim Pope
857496c32f Unify temp state and job state 2021-03-23 13:39:45 -04:00
Tim Pope
9715dbe19e Replace broken check for nvim 0.5.0
Apparently has('nvim-0.5.0') actually means "any nightly release after
0.4.4".  I guess we'll have to settle for 0.5.1?

Closes https://github.com/tpope/vim-fugitive/issues/1709
2021-03-23 13:39:45 -04:00
Tim Pope
58d2b25836 Use git --list-cmds= to complete subcommands
For older Git versions, use the list of subcommands from when
--list-cmds= was first added, and subtract out "worktree" for Git
versions too old to have it.  This one simple conditional gives us
accurate completion for Git versions up to a decade old.

The option is described as "internal/experimental", so make sure the
exit status is successful, and filter out anything that looks like a
warning or deprecation notice.  In case of failure, use the commands
provided by --list-cmds= as of the date of this commit.

Closes https://github.com/tpope/vim-fugitive/pull/1629
2021-03-21 10:13:42 -04:00
Tim Pope
1999aef8cd Retool completion of subcommands
Support configured completion commands and aliases using our cached
config helpers, and support --exec-path and $PATH git-* executables by
globbing once and caching indefinitely.

References https://github.com/tpope/vim-fugitive/pull/1629
2021-03-21 10:13:42 -04:00
Tim Pope
a55d6f39c8 Paginate :Git whatchanged 2021-03-21 10:13:42 -04:00
Tim Pope
4e285c8137 Clean up argument splitting utility functions 2021-03-21 07:08:16 -04:00
Tim Pope
ddea2ecb0f Expand ssh host aliases in remote urls
A common practice for using multiple accounts with a hosting service
such as GitHub is to alias the host in ~/.ssh/config and use an
alternate ssh key to authenticate as the alternate user:

	Host github.com-work
		HostName github.com
		IdentityFile ~/.ssh/id_rsa_work

By swapping in the original host name for the alias in
FugitiveRemoteUrl(), we can enable :GBrowse plugins to correctly
recognize the hosting service's domain name.

If for some reason you need the original URL without modification, pass
a true value as the third parameter:

	let url = FugitiveRemoteUrl('', bufnr(''), 1)

References https://github.com/tpope/vim-rhubarb/issues/60
2021-03-20 05:56:24 -04:00
Tim Pope
10ed587f65 Capture :Git job output to temp file
This is intended to support an upcoming job backed --paginate, but you
can also unofficially use g:_fugitive_last_job.file to get, for example,
the error messages from a failing pre-commit hook.
2021-03-19 23:39:42 -04:00
Tim Pope
04b0b26f84 Fix diff in status buffer
Half the reason I gave up and wholesale reverted in 4875dd34 was because
the entirely unnecessary abbreviation of "submodule" to "sub" was
difficult to search for, and I wanted the whole thing gone.

Closes https://github.com/tpope/vim-fugitive/issues/1707
2021-03-19 23:37:15 -04:00
Tim Pope
4ea84b29eb Default coo to identifier under cursor in temp buffers
I initially intended to do a :Git branch specific version of this, but
`:Git checkout bad-argument --` is mostly harmless, so hack it for now.

Closes https://github.com/tpope/vim-fugitive/issues/1572
2021-03-19 20:29:16 -04:00
Tim Pope
7bee1113e3 Don't automatically enable syntax folding in status buffer
Closes https://github.com/tpope/vim-fugitive/issues/1565

References https://github.com/tpope/vim-fugitive/issues/1317
2021-03-19 20:29:16 -04:00
Tim Pope
4e85dd3424 Revert "Support X for submodules"
I should have looked closer because because I didn't realize "Support X
for submodules" meant "make it do something completely unrelated".

This reverts commit a21ca7e86e.

References https://github.com/tpope/vim-fugitive/issues/1705
2021-03-19 03:13:52 -04:00
Tim Pope
0508885550 Don't clobber alt buffer with :Gread
Why does :read do this???
2021-03-19 02:49:08 -04:00
Tim Pope
99fccd08e2 Make :Gdiffsplit! from common ancestor stage open ours and theirs
References https://github.com/tpope/vim-fugitive/issues/1706
2021-03-19 02:48:56 -04:00
Tim Pope
0858688120 Don't expand # in :GBrowse http://example.com/#anchor 2021-03-19 02:48:56 -04:00
Tim Pope
91089715f4 Update env workarounds for nvim
Commit e85c8dff692c894a614192f6dd8a4c71c1c9fe30 in the neovim repository
appears to have addressed the bugs that prevent us from providing a
custom environment for a job.  This hasn't made it into a stable release
yet, so let's assume it will land in the next minor version.
2021-03-19 02:48:56 -04:00
Tim Pope
d70c42aa50 Support opting out of deprecated commands
Get this trash out of my tab complete.
2021-03-18 16:48:48 -04:00
Tim Pope
563faf95b8 Remove broken deprecated :Git merge calling mergetool
Closes https://github.com/tpope/vim-fugitive/issues/1704
2021-03-18 16:48:10 -04:00
Tim Pope
d7c2e50816 Partition public and private job state 2021-03-18 01:49:08 -04:00
Tim Pope
39d904051d Avoid :normal during status reload
This was clearing the last line of output when attempting to reload
status from a job close callback, so let's use a different method to
change the column.
2021-03-18 01:48:46 -04:00
Tim Pope
e89d22e5da Use unambiguous option keys for subcommand delegation 2021-03-18 01:44:28 -04:00
Tim Pope
d73fe3c192 Fix inline diff expansion when foldmethod is not syntax
Also rearrange, so any other errors here don't break the basics.
2021-03-16 20:11:32 -04:00
Tim Pope
caf2907fd8 Retool discard operation during conflict
The use of --theirs for Unstaged and --ours for Staged was based
entirely on the way conflicts were represented in git status --short,
except, that's backwards, the staged column contains our side of the
merge so discarding it should use --theirs.  I never noticed because I
don't use this feature.

Fixing this is guaranteed to burn anybody who learned the whole
behavior, so let's promote 2X and 3X to official status, and require
opting in to the flipped default.

Also, since --ours and --theirs only touch the worktree, the correct
analogous operations for deletion is *not* git rm, but rather to remove
the worktree file directly.  So let's do that, and add it to 2X and 3X
too.

Closes https://github.com/tpope/vim-fugitive/issues/1699

References https://github.com/tpope/vim-fugitive/issues/1648
2021-03-16 16:27:38 -04:00
Tim Pope
cc525c99df Fix remaining :Gremove and :Gmove references 2021-03-16 16:27:38 -04:00
Tim Pope
f5bbd4eea0 Tiny optimization to s:Slash()
References https://github.com/tpope/vim-fugitive/issues/1701
2021-03-16 16:27:38 -04:00
Tim Pope
3eb6f316c0 Act globally when invoking inline diff maps on Head: line
Closes https://github.com/tpope/vim-fugitive/issues/1563
2021-03-15 23:40:48 -04:00
Tim Pope
776ce315c4 Ensure open folds after expanding inline diff 2021-03-15 23:40:48 -04:00
Tim Pope
e3b7cce2e6 Feed custom file under cursor into netrw's gx
References https://github.com/tpope/vim-fugitive/issues/1550
2021-03-15 23:38:09 -04:00
Tim Pope
10121f34f2 Remove Git dir checks on FileType events
In order for these checks to work, :filetype on must be invoked *after*
Fugitive is loaded.  Otherwise, the FileType event triggers before
FugitiveDetect() is called.

These file types are used almost exclusively inside of Git repositories,
and in the rare case they are not, we're not doing anything particularly
intrusive, so dropping the conditional should have little practical
impact.  An exception is fugitive#MapJumps(), which is designed to be
used exclusively with historical buffers, the status buffer, and
captured :Git output, so let's lock it down to those particular
workflows.
2021-03-15 17:46:00 -04:00
Tim Pope
f2956a923d Set b:git_dir early in BufReadCmd
We call :setlocal filetype=git before manually triggering BufReadPost,
which means that the FileType events in the plugin file containing
len(FugitiveGitDir()) checks all short circuited.  This wasn't noticed
before because:

* They're mostly nonessential, save for fugitive#MapJumps() which we
  also explicitly invoke in BufReadCmd.
* If :filetype on is invoked *after* Fugitive is loaded, then it will
  set the filetype a second time *after* we've properly set b:git_dir.
  (This was the case on my machine, except when reloading the plugin
  redefined the autocommands and thus reversed the order.)

The load order issue is also relevant to plain file buffers.  This will
require an additional fix.
2021-03-13 23:34:13 -05:00
Tim Pope
36f9211da2 End the guioptions+=! reign of terror
Changing :! was bad enough, but I cannot possibly fathom why
this affects system() too. Didn't we learn our lesson about options
affecting VimL execution from 'ignorecase'?

Closes https://github.com/tpope/vim-fugitive/issues/1416

Closes https://github.com/tpope/vim-fugitive/issues/1437

Closes https://github.com/tpope/vim-fugitive/issues/1533

References https://github.com/tpope/vim-fugitive/issues/1042
2021-03-13 18:01:06 -05:00
Tim Pope
977e3c805d Fix staging partial hunk near EOF lacking newline
This is a blind, untested fix.

Closes https://github.com/tpope/vim-fugitive/issues/1609
2021-03-13 17:53:59 -05:00
Tim Pope
a4a9acf44e Add initial :echo before job
This fixes output for `:echo 123|Git status`.
2021-03-13 17:53:59 -05:00
Tim Pope
b962714fcd Replace blame shell fiddling with s:TempCmd()
References https://github.com/tpope/vim-fugitive/issues/1644
2021-03-12 23:42:11 -05:00
Tim Pope
e704d15787 Fix tab complete of tree objects
Closes https://github.com/tpope/vim-fugitive/issues/1529
2021-03-12 23:38:11 -05:00
Tim Pope
6356bbc4a7 Fix argument parsing of :Gedit fugitive:\\...
When expecting <f-args> with -nargs=*, Vim rudely halves sequences of
consecutive backslashes, mutilating our URLs on Windows in the process.
Resort to splitting <q-args> by hand instead.

Closes https://github.com/tpope/vim-fugitive/issues/1579
2021-03-12 22:07:19 -05:00
Tim Pope
423aed15fc Delete backing temp file upon wiping buffer
We should probably default buftype to wipe so that these don't stack up
indefinitely by default, but one step at a time.
2021-03-12 18:21:21 -05:00
Tim Pope
1ccb082753 Rename temp state bufnr field to origin_bufnr
I intend to expand the use of this temp state to contexts where this
field could be erroneously interpreted as the buffer number of the temp
file itself.
2021-03-12 17:25:52 -05:00
Tim Pope
d0e277c7be Don't try to reuse terminal buffers for status window edits
Closes https://github.com/tpope/vim-fugitive/issues/1652
2021-03-11 01:40:44 -05:00
Tim Pope
4fa53ad329 Add a FAQ about symlinks 2021-03-11 01:40:44 -05:00
Tim Pope
753318ef83 Smarter diff jumping in :Git log
Closes https://github.com/tpope/vim-fugitive/issues/1689
2021-03-09 21:06:52 -05:00
William Durand
9cba97f4db Add sourcehut plugin for :GBrowse to README 2021-03-01 01:13:34 -05:00
Tim Pope
601bf2e225 Provide some <mods> handling on quickfix commands
Most notably, don't force an early redraw with :silent.

Closes https://github.com/tpope/vim-fugitive/issues/1685
2021-02-27 08:37:41 -05:00
Tim Pope
fad16e502a Better handling of git blame variable width date formats 2021-02-27 08:37:41 -05:00
Ian Homer
6c4c7c9aeb Account for closing windows when reloading status 2021-02-21 22:51:23 -05:00
Tim Pope
9e378fd9aa Resolve temp name used in :Git
This will enable us to use the temp name in a job backed --paginate.
Since temp file names have been the subject of various issues on win32
in the past, let's make this change sooner rather than later to get a
head start on any bug reports.
2021-02-21 14:56:41 -05:00
Tim Pope
783ec701fe Work around 'suffixes' in :Git completion
Closes https://github.com/tpope/vim-fugitive/issues/1682
2021-02-21 14:54:43 -05:00
Tim Pope
d1e74ac267 Move :Git --paginate helper function into :Git section 2021-02-20 21:59:03 -05:00
Tim Pope
eb4d75efb6 Fix :Gedit worktree-file
Closes https://github.com/tpope/vim-fugitive/issues/1679

References https://github.com/tpope/vim-fugitive/issues/1667
2021-02-19 18:47:13 -05:00
Tim Pope
0a35937003 Provide error message when Netrw can't be loaded 2021-02-16 21:04:13 -05:00
Tim Pope
c63bc47c44 Remove obsolete push/fetch docs 2021-02-15 20:11:56 -05:00
Tim Pope
d6809e9ee4 Use stderr for in-band job communication
Since stdout can contain arbitrary user data, let's touch it as little
as possible.  When using a pty, this has no effect, as everything goes
through stdout, but I aim to move handle --paginate with this same
pipeline, and that will not use a pty.
2021-02-15 20:11:56 -05:00
Tim Pope
15f32b0008 Guard against diff.noprefix in commit buffers 2021-02-15 20:11:56 -05:00
Sam Cedarbaum
22384947a0 Add Azure DevOps :GBrowse extension to README 2021-02-15 14:31:45 -05:00
Tim Pope
d4bcc75ef6 Remove dispatch.vim backed fetch and push 2021-02-12 18:35:28 -05:00
Tim Pope
0cc2190889 Add deprecation notices to git subcommand wrappers 2021-02-12 18:35:28 -05:00
Tim Pope
4c5f6fcaf5 Retire old :Gsplit! family of temp buffer commands 2021-02-12 13:49:07 -05:00
Tim Pope
5c821eb78d Don't default to work tree on :Gedit invalidref:file
Closes https://github.com/tpope/vim-fugitive/issues/1667
2021-02-11 17:05:05 -05:00
Tim Pope
8cf0cf5bfb Emphasize poor quickfix performance in docs
References https://github.com/tpope/vim-fugitive/issues/1662
2021-01-25 22:44:03 -05:00
Andreas Hunkeler
bebe504e38 Fix typo in helpfile 2020-12-17 04:13:22 -05:00
Tim Pope
7afa1cfaa6 Avoid presenting verbose command output as error
References https://github.com/tpope/vim-fugitive/issues/1643
2020-12-07 18:59:28 -05:00
Tim Pope
7bcfe539be Avoid window shenanigans if :diffoff restores options
Closes https://github.com/tpope/vim-fugitive/issues/1634
2020-11-27 09:40:22 -05:00
Tim Pope
866ecfff4e Enable Help: header
This change was inadvertantly omitted from
d2abfca08f.

References https://github.com/tpope/vim-fugitive/issues/1513
2020-11-24 02:01:39 -05:00
Pavol Juhas
e90478511d Restore correct cursor position in commit buffer
Use `lockmarks` in fugitive#BufReadCmd to avoid offsetting marks.
2020-11-24 02:00:14 -05:00
Maksim Odnoletkov
660d2ba2b6 Fix jumps from blame commits with ignore marks
c212d854d5 added initial support for
marks added by blame.markIgnoredLines and blame.markUnblamableLines.

One more change is needed to parse the blame line properly to enable
jumps.
2020-11-20 21:01:21 -05:00
Tim Pope
1a77f1c00e Recover from deleted temp script
Closes https://github.com/tpope/vim-fugitive/issues/1616
2020-10-26 20:31:54 -04:00
Tim Pope
89e6b5e4e1 Disable 'swapfile' early
This should eliminate the need to disable 'swapfile' in
fugitive#BufReadCmd(), but I'm inclined not to fix what isn't broken.

Closes https://github.com/tpope/vim-fugitive/issues/1598
2020-10-11 20:42:35 -04:00
Tim Pope
4189bdb580 Don't override user :G
Closes https://github.com/tpope/vim-fugitive/issues/1607
2020-09-29 20:31:08 -04:00
Tim Pope
e12236b60a Fix reference to renamed function
Closes https://github.com/tpope/vim-fugitive/issues/1606
2020-09-27 06:05:05 -04:00
Ryosuke Ito
12011a475d Disable spell checking while blaming 2020-09-26 14:40:36 -04:00
Tim Pope
8080407ae9 Provide public diff closing function
Closes https://github.com/tpope/vim-fugitive/pull/1587
2020-09-26 12:21:52 -04:00
Tim Pope
49315d0c74 Fix :Gwrite DWIM in commit messages
Closes https://github.com/tpope/vim-fugitive/issues/1599
2020-09-24 07:32:12 -04:00
Tim Pope
4824b5b3fe Avoid empty string keys to prevent Vim 7 error
Closes https://github.com/tpope/vim-fugitive/issues/1113
2020-09-24 03:49:23 -04:00
Wu Yongwei
511d3035d4 Fix: digits in a user name was highlighted as time 2020-08-26 17:39:35 -04:00
Tim Pope
260182c65c Support partial staging after git add -N
Closes https://github.com/tpope/vim-fugitive/issues/1567
2020-07-30 21:36:29 -04:00
Tim Pope
9b6a24b131 Fix tab complete for :Git push --option
Closes https://github.com/tpope/vim-fugitive/issues/1570
2020-07-27 19:57:50 -04:00
Tim Pope
1da7c133b1 Recommend :Git log over :Gclog
Closes https://github.com/tpope/vim-fugitive/issues/1556
2020-06-27 16:39:43 -04:00
Tim Pope
27a5c3abd2 Trigger OptionSet on automatic :diffoff
Closes https://github.com/tpope/vim-fugitive/issues/1545
2020-05-31 00:50:49 -04:00
Tim Pope
03fa78141e Improve weird :Ggrep --column quickfix title 2020-05-31 00:50:49 -04:00
Tim Pope
f1a75478cb Tighten syntax highlighting for SHA 2020-05-31 00:50:49 -04:00
Tim Pope
0646a53c6b Add Help: header
Closes https://github.com/tpope/vim-fugitive/issues/1513
2020-05-31 00:50:49 -04:00
Tim Pope
d2abfca08f Refactor run loop 2020-05-31 00:50:49 -04:00
Tim Pope
e87fe092a2 Extract s:RunEdit() 2020-05-31 00:50:49 -04:00
Maksim Odnoletkov
5d32f75289 Fix stash map
`czz` used to act without confirmation before. But
6b40e51008 changed it to require `<CR>`.
Given that `czw` keeps working without confirmation and that there
is a separate `cz<Space>` map - seems like the change was not intended?
2020-05-28 17:05:45 -04:00
Tim Pope
caf3b1d569 Don't default :Git grep to --column
If you want this, you can pass --column yourself, or set the grep.column
config option.  This is probably going to change for :Ggrep, too.
2020-04-24 23:05:39 -04:00
Tim Pope
f17a91d010 Provide completion relative to working directory 2020-04-24 23:01:38 -04:00
Tim Pope
5dfe8581ca Extract :Ggrep/:Glgrep wrapper function 2020-04-24 23:01:38 -04:00
Tim Pope
92ad06f70d Use parameterized Git dir when completing heads 2020-04-24 23:01:37 -04:00
Tim Pope
05bbfcd0dc Remove commit entry from :{range}Glog 2020-04-21 13:44:34 -04:00
Tim Pope
85e2c73830 Favor :Ggrep over :Git grep
I'm starting to think :Git grep shouldn't be special cased.
Occasionally it is desirable to see grep results without clobbering the
quickfix list.

Reserve -O/--open-files-in-pager to opt into quickfix behavior, as this
fits well with Fugitive's use of a temp buffer as the Git pager.
2020-04-12 11:47:38 -04:00
Tim Pope
f5391f0bfc Fix race condition resuming job after editor invocation
Closes https://github.com/tpope/vim-fugitive/issues/1489
2020-04-12 11:47:38 -04:00
Tim Pope
53dd9b3957 Encapsulate update-index --index-info 2020-04-08 04:06:24 -04:00
Tim Pope
792f51a58b Leverage Git config retrieval helpers 2020-04-08 02:51:55 -04:00
Tim Pope
a9bf9de61d Move Quickfix section under Git section 2020-04-08 02:51:55 -04:00
James Wright
0e35c9bbc7 Fix typos in README
Fixes #1493
2020-03-21 21:36:07 -04:00
Tim Pope
9a4d730270 Drop support for :{windowheight}Git
Ever since Vim gained -addr=, it's been impossible to define a command
that accepts both marks like '< (requires -addr=lines) an and a count
that's beyond the end of the file (requires -addr=other).  This means
:Git needs to pick sides between :'<,'>Git blame and :{windowheight}Git
log, and the former is much more important than the latter.
2020-03-12 10:23:56 -04:00
Patrice Peterson
ccf582838b Fix some inconsistencies in help mappings
Some didn't use `<silent>` or `<C-U>`.
2020-03-12 09:30:14 -04:00
Patrice Peterson
d3cdb3208d Have remaining mappings use S:Map()
There were a few mappings left that weren't customizable with
g:[onx]remap. This makes them configurable.
2020-03-12 09:30:14 -04:00
Tim Pope
4a24804adc Rewrite feature summary in README 2020-03-10 12:46:26 -04:00
Tim Pope
5ad42e307f Factor in 8.2.0239 when checking for job env support 2020-03-10 12:46:26 -04:00
Tim Pope
68f570ec38 Enable closing stdin by pressing CTRL-D
This provides a way to use commands like :Git hash-object --stdin
without a PTY, which is not to say that there are any such commands that
one would actually want to use.  It also has debugging applications.
2020-03-10 12:46:26 -04:00
Tim Pope
12e43b62cc Don't use "Head:" header for commit under cursor
This is the first line of the file so it's an annoyingly aggressive
default.
2020-03-10 12:46:26 -04:00
Tim Pope
ffd7042c15 Fix echoed line during :Gread 2020-03-10 12:46:26 -04:00
Tim Pope
dbc8d9a32c Fix list indexing bug 2020-03-05 13:21:50 -05:00
Tim Pope
e06005a742 Fix staging hunk that comes after binary file
Closes https://github.com/tpope/vim-fugitive/issues/1462
2020-03-05 08:43:03 -05:00
Tim Pope
8388b6d0fb Use status headers for commit maps
Closes https://github.com/tpope/vim-fugitive/issues/1485
2020-03-04 10:30:20 -05:00
Tim Pope
7ae214e445 Fix erroneous temp buffer on non-listing :Git branch 2020-03-03 09:36:04 -05:00
Tim Pope
3c3e6ea67b Support most top level Git options 2020-03-02 04:24:26 -05:00
Tim Pope
5d7516d3c1 Don't override alternate implementations of legacy commands
This is primarily intended so users can define their own :Gpush and
:Gfetch when they lose their :Dispatch backed async.
2020-03-02 04:24:26 -05:00
Tim Pope
8aaf744f2a Don't rely on rebase --autosquash shorthand
I'm starting to think this is more confusing than helpful.
2020-03-02 04:24:26 -05:00
Tim Pope
d102dd92fd Fix :GRename ../
Closes https://github.com/tpope/vim-fugitive/issues/1481
2020-03-02 02:40:09 -05:00
0xACE
9acced1409 Fix typo 2020-03-01 19:32:25 -05:00
Tim Pope
3bd69748c3 Remove remaining :Gsubcmd calls from implementation 2020-02-29 22:37:57 -05:00
Tim Pope
abb4a26c1e Fix internal documentation command references 2020-02-29 22:37:57 -05:00
Tim Pope
3e59a79e48 Move :Ggrep docs near other :Gcommands 2020-02-29 22:37:57 -05:00
Tim Pope
e84f023edf Remove redundant exists(':Gblame') check
This command used to be restricted to file and blob buffers, but now
it's global, not to mention deprecated, and the check serves no purpose.
2020-02-29 22:37:57 -05:00
Tim Pope
d0dceb9feb Change subtopic help tag style from :Git- to :Git_
This is less Git-like, but a bit more Vim-like, and doesn't force us
into the awkward :Git---paginate.
2020-02-29 22:37:57 -05:00
Tim Pope
025151bc78 Fix deletion of trailing fold upon loading blob
Closes https://github.com/tpope/vim-fugitive/issues/1479
2020-02-29 22:37:45 -05:00
Tim Pope
aada6479cf Use :Gsubcmd completion for :Git subcmd 2020-02-29 07:38:35 -05:00
Tim Pope
6b40e51008 Remove most uses of s:EchoExec()
This function was intended to avoid the press ENTER prompt for brief
output, but the new :Git job based runner now does that more
effectively.  Remove all old uses of it except the U map, which I am
electing to keep quiet on older versions of Vim.
2020-02-29 07:38:35 -05:00
Tim Pope
c452181975 Remove old :Git! temp buffer behavior
Rip the band-aid off now so we can reclaim it for something else sooner
rather than later.

If you're trying to support both old and new versions of Fugitive,
exists('*FugitiveConfigGetAll') will be true on versions where
--paginate is supported.  In a pinch you can also swap in :Gsplit!, but
that's eventually going away too.
2020-02-23 18:10:47 -05:00
Tim Pope
430253c302 Drop support for non-PTY :!
The experience without a PTY is pretty lackluster, and if you're using a
GUI or Windows, there's probably nothing stopping you from upgrading to
a version of Vim with job support.
2020-02-23 18:10:47 -05:00
Tim Pope
a5c921190a Override existing config values on :Git -c config.option= 2020-02-23 15:41:10 -05:00
Tim Pope
31629d8bd1 Use :read for :{range}Git! --paginate 2020-02-23 00:26:37 -05:00
Tim Pope
5a5a95b90a Tease apart bang and non-bang variants of :Gread 2020-02-23 00:26:36 -05:00
Tim Pope
87f998e15f Remove erroneous :Gedit! deprecation
The ! to :Gedit has always been passed to :edit and not used for Git
execution like the others.
2020-02-22 20:56:27 -05:00
Tim Pope
2acea41bef Handle custom Git executable for :Git --paginate 2020-02-22 20:14:33 -05:00
Tim Pope
c0aad3ac78 Update internal uses of :Git! to :Git --paginate 2020-02-22 20:14:33 -05:00
Tim Pope
8b83d6ec6c Use :pedit for :Git! --paginate 2020-02-22 20:14:33 -05:00
Tim Pope
efb1c8a29d Add - map for Push header 2020-02-22 20:14:33 -05:00
Rob Pilling
9e4a5239ee Respect 'wildignorecase' when completing :Gedit 2020-02-20 16:07:24 -05:00
Rob Pilling
349b18d373 Pull out s:fileignorecase() 2020-02-20 16:07:24 -05:00
Tim Pope
2e67f82b79 Refine handling of pagination via temp buffer
Use temp buffer for output of any command for which the Git
configuration option of pager.<command> is true.  Avoid using a temp
buffer if the value is false, even for commands like "show" where we
normally would.  If the configuration value is present and can't be
interpreted as a Boolean, punt to a :terminal where Git will invoke it
directly.

Generate and use custom config dictionary that includes -c values passed
to :Git.  This enables `:Git -c pager.status status` to correctly use a
pager.

Paginate "config", "branch", and "tag" for certain argument lists,
matching the logic found in the Git source code as closely as possible.
These 3 commands were identified as having special pagination logic by
the presence of the DELAY_PAGER_CONFIG flag on their definitions in
git.c.

Paginate "am --show-current-patch".

References https://github.com/tpope/vim-fugitive/issues/1415
2020-02-18 21:00:01 -05:00
Tim Pope
a81ba999e8 Correctly treat config keys without values as true 2020-02-18 20:59:50 -05:00
Tim Pope
cb1300d751 Deprecate :Gsplit! family in documentation 2020-02-18 20:59:49 -05:00
Tim Pope
d10dc9ea93 Quarantine deprecated commands in documentation 2020-02-18 14:09:24 -05:00
Tim Pope
2401f1a7da Work around minibufexpl/autochdir induced error
Closes https://github.com/tpope/vim-fugitive/issues/1456
2020-02-18 12:33:58 -05:00
Appu Joseph
81ca98d7e8 Fix Trailing Characters, Invalid range error for :<count>Gstatus
Correct the position of newly added keepalt option from
'botright <count>keepalt split' to 'botright keepalt <count>split'
2020-02-18 10:15:07 -05:00
Tim Pope
9bbbb65888 Add capitalized versions of non-standard commands
The long term goal is to use :Gsomecommand for commands that wrap
Vim built-ins (e.g., :Gedit for :edit), :Git some-command for commands
that wrap Git built-ins, and :GSomeCommand for everything else.  For
:GRemove, :GDelete, :GMove, and :GRename, this gives us symmetry with
eunuch.vim, and for :GBrowse, this gives us symmetry with a hypothetical
:Browse command that I've long wanted to make a plugin for but probably
never will.

:GcLog and :GlLog get their names because they match Vim's :c and :l
prefixes but bring their own custom suffix.  This is rather unsatisfying
and I may change it if something better comes along.
2020-02-17 14:50:09 -05:00
Tim Pope
9f69019424 Partially support :Git difftool on old Git 2020-02-15 20:18:15 -05:00
Tim Pope
98f67310aa Parameterize subcommand Git executable 2020-02-15 20:18:09 -05:00
hitsuji no shippo
460664018a Fix typo --include-index to --keep-index in help 2020-02-05 20:25:34 -05:00
Tim Pope
0e6f72b005 Allow custom subcommands outside of Git repository 2020-02-05 14:40:22 -05:00
Tim Pope
e144a9f559 Extract helper for setting job environment 2020-02-05 14:40:22 -05:00
Tim Pope
df3ac9d278 Enable opening arbitrary URLs with :Gbrowse
This is still doing a lot of unnecessary processing looking for a
remote, but it doesn't seem to hurt anything.
2020-02-05 14:40:22 -05:00
Tim Pope
3c45ed0d13 Fix false positive on deprecated :.Glog usage 2020-02-05 14:27:27 -05:00
Tim Pope
a95972cefc Don't clobber alternate buffer on :Gstatus 2020-02-05 12:48:47 -05:00
Tim Pope
18582f4986 Remove deprecated C map to fix broken warning
https://github.com/tpope/vim-fugitive/issues/1458
2020-02-05 12:48:47 -05:00
Tim Pope
083f3c23cc Preserve existing 'scrollbind' arrangement with :Gblame
Closes https://github.com/tpope/vim-fugitive/issues/1449

Closes https://github.com/tpope/vim-fugitive/issues/1327
2020-02-03 11:25:49 -05:00
Tim Pope
9ecd6ebf92 Eliminate last temporary :cd
The new git_chomp and git_chomp_in_tree aren't 100% backwards
compatible, but these functions are deprecated anyways.  Use
system(FugitivePrepare(...)) instead.
2020-02-03 10:17:37 -05:00
Tim Pope
3221cdfbde Support :Git -c config.name=value 2020-02-02 15:31:02 -05:00
Tim Pope
8e90d82eb4 Use --no-optional-locks for :Gstatus
This clears up some intermittent errors during :Git rebase, although I
must admit I don't really understand why, as the status reload shouldn't
be happening at the same time :Git is running.
2020-02-01 10:49:35 -05:00
Tim Pope
1c1014a046 Continue running commands on Vim exit
Closes https://github.com/tpope/vim-fugitive/issues/1447
2020-01-30 13:01:17 -05:00
Tim Pope
268a9c1b8f Don't make assumptions about current line number when displaying commit 2020-01-26 17:39:32 -05:00
Tim Pope
fc0199555e Extend nvim carriage return workaround to ptys
References https://github.com/tpope/vim-fugitive/issues/1445
2020-01-26 15:37:02 -05:00
Tim Pope
d926e3beb4 Try to wipe out temp buffer from :read
Also try to preserve marks.
2020-01-26 10:57:19 -05:00
Tim Pope
40872a9555 Don't use job pty unless Vim supports it
Closes https://github.com/tpope/vim-fugitive/issues/1444
2020-01-26 08:01:34 -05:00
Tim Pope
279d56eb47 Show unpulled before unpushed
This is what Magit does and I *think* it makes sense because you have to
pull before you can push.
2020-01-26 07:24:02 -05:00
Tim Pope
54b308eedb Revert work in progress changes
This partially reverts commit cd7db1d57c.
2020-01-26 07:24:02 -05:00
Tim Pope
655f7c92f3 Show unpushed and unpulled sections for both upstream and push
References https://github.com/tpope/vim-fugitive/issues/1436

References https://github.com/tpope/vim-fugitive/issues/1172
2020-01-25 20:34:28 -05:00
Tim Pope
477f26cf50 Include refs/heads in constructed push commands
Also swap out :Gpush for :Git push while we are at it.
2020-01-25 20:20:02 -05:00
Tim Pope
76ffaf4e7d Recognize pull.rebase=preserve in :Gstatus 2020-01-25 18:31:03 -05:00
Tim Pope
90b7d98b6c Temporarily restore User Fugitive autocommand
References https://github.com/tpope/vim-fugitive/issues/1441
2020-01-25 11:29:13 -05:00
Tim Pope
4637aca145 Remove tags file warning
This was the last thing triggering the autoload file before using an
actual Fugitive feature.
2020-01-24 17:34:41 -05:00
Tim Pope
cd7db1d57c Replace old public detection API with hint errors 2020-01-24 17:15:25 -05:00
Tim Pope
036fe0f084 Job environment variables are broken on Neovim
Closes https://github.com/tpope/vim-fugitive/issues/1443
2020-01-24 05:46:41 -05:00
Tim Pope
22255613f7 Replace :Gcommit/:Grevert with standard job runner 2020-01-23 05:52:27 -05:00
Tim Pope
c989c1f59e Replace :Grebase/:Gmerge/:Gpull with standard job runner 2020-01-23 05:52:27 -05:00
Tim Pope
6b18f7b758 Remove :Gwrite in :Git diff 2020-01-23 05:52:27 -05:00
Tim Pope
8d6f9734c1 Use jobs for :Git 2020-01-23 05:52:27 -05:00
Tim Pope
4301c57f24 Extract helper script creator function 2020-01-23 05:52:27 -05:00
Tim Pope
7f22cc6167 Revert "Specify shell command, not wrapper, in b:dispatch"
This reverts commit 5bcb42164e.
2020-01-23 03:49:14 -05:00
Tim Pope
9d62c67737 Remove legacy autocommands 2020-01-22 09:44:07 -05:00
Tim Pope
71038e83f1 Try to use relative path for :Ggrep
References https://github.com/tpope/vim-fugitive/issues/1439
2020-01-21 15:29:29 -05:00
Tim Pope
21ed533001 fugitive.vim 3.2
* Provide :Git mergetool to load conflicts into quickfix list.
* Provide :Git difftool to load arbitrary changesets into quickfix list.
* Call FugitiveBlob/FugitiveCommit/etc autocommands on Fugitive buffer load.
* :Git --paginate display results in temp buffer.
* :Git --no-pager no longer displays results in temp buffer.
* Accomodate loading Fugitive buffers in popup window.
* Better PowerShell support.
* Bug fixes.
2020-01-21 04:33:16 -05:00
Tim Pope
29153d5ba1 Provide git config --get-all wrapper 2020-01-20 15:42:54 -05:00
Tim Pope
8d4b85ed09 Replace --format with --pretty=format for older Git 2020-01-20 15:42:54 -05:00
Tim Pope
708595d996 Fix comment typo 2020-01-20 15:42:45 -05:00
Chris DeLuca
dc6719e7b0 Fix :Gdiffsplit! help typo 2020-01-20 10:27:14 -05:00
Tim Pope
c48db08e4e Use appropriate slashes for :Dispatch working directory 2020-01-20 10:27:00 -05:00
Tim Pope
2ebdeef9e0 Change :Git --paginate from :terminal to temp buffer
The --paginate option to Git forces it to use $PAGER rather than its own
configuration, so it makes perfect sense for Fugitive to take on the
role of the pager.

This also removes the same behavior for --no-pager, allowing the command
to run with :! instead.  I really don't like sudden backwards
incompatible changes like this, but the old behavior was based on a bad
understanding of how these options work, and I'd rather rip the band-aid
off sooner rather than later.
2020-01-20 09:03:49 -05:00
Tim Pope
bc0b78ee84 Remove dead code 2020-01-20 08:42:02 -05:00
Tim Pope
5bcb42164e Specify shell command, not wrapper, in b:dispatch
This frees us up to change :Gfetch not to use :Make.
2020-01-20 07:28:55 -05:00
Tim Pope
1a6934fc7e Fix FugitiveParse() return value documentation 2020-01-20 07:03:48 -05:00
Tim Pope
397fb99921 Provide FugitiveBlob style autocommands
This is the real replacement for fugitive#buffer().type(), as the only
real world use of that seemed to be in BufReadPost autocommands.
2020-01-20 05:52:22 -05:00
Tim Pope
5b1213d0db Fix :Gmerge 2020-01-20 05:52:22 -05:00
Tim Pope
ae52b5a96a Better PowerShell support 2020-01-18 01:30:43 -08:00
Tim Pope
9f032ed040 Prevent alternate buffer change loading Fugitive buffer 2020-01-18 00:51:38 -05:00
Tim Pope
d428032600 Fix netrw gx in Fugitive buffers AGAIN 2020-01-18 00:45:17 -05:00
Tim Pope
c83355d5c5 Accomodate loading Fugitive buffers in popup window
Closes https://github.com/tpope/vim-fugitive/issues/1418
2020-01-15 01:26:31 -05:00
Tim Pope
4732bb964a Generalize :Git environment variable overrides 2020-01-14 22:56:11 -05:00
Tim Pope
3e32a55619 Avoid false positives on rebase todo handler 2020-01-14 22:56:11 -05:00
Tim Pope
a65db6fcf8 Move :Gmerge warning to top level function
The old location isn't long for this world.
2020-01-14 22:56:11 -05:00
Tim Pope
305337a9c1 Begin phasing out :Git --paginate special case
This was a mistake.  I took --paginate to be the opposite of --no-pager,
but it forces $PAGER over $GIT_PAGER and pager configuration.  This
defeats the purpose of using it as way to trick :Git into running a
regular command with :terminal.

References https://github.com/tpope/vim-fugitive/issues/1415
2020-01-14 20:43:21 -05:00
Tim Pope
6a638f2392 Match "* Unmerged path" in mergetool
This happens in leiu of a diff when one of the commits adds (or
presumably removes) the file rather than changing it.
2020-01-12 18:53:21 -05:00
Tim Pope
6bc345f6f1 Map cmt to :Git mergetool
References https://github.com/tpope/vim-fugitive/issues/1329
2020-01-10 20:29:58 -05:00
Tim Pope
def982ac4d Softly deprecate :Gmerge for quickfix conflicts 2020-01-10 20:29:15 -05:00
Tim Pope
5fe99dc5df Provide interface for subcommands to set execution options 2020-01-10 19:54:06 -05:00
Tim Pope
394c925381 Fix netrw gx in Fugitive buffers 2020-01-09 21:34:35 -05:00
Tim Pope
4074727343 Really fix packed ref handling in :Gbrowse
References https://github.com/tpope/vim-fugitive/issues/1428
2020-01-06 16:00:21 -05:00
Tim Pope
cfa7bdc82a Handle packed refs in :Gbrowse
Closes https://github.com/tpope/vim-fugitive/issues/1428
2020-01-06 13:33:49 -05:00
Tim Pope
ddd64fc4c5 Provide :Git difftool and :Git mergetool
Closes https://github.com/tpope/vim-fugitive/issues/132
2020-01-05 21:41:18 -05:00
Tim Pope
2bcf755c6e Run QuickFix autocommands on :Gclog 2020-01-05 16:36:11 -05:00
Tim Pope
295f41bbf4 Save diff context in :Gclog 2020-01-05 16:17:58 -05:00
Tim Pope
9ec6b55d03 Improve display of :Gclog --summary 2020-01-05 01:50:24 -05:00
Tim Pope
3604fab3b7 Fix whitespace in README 2020-01-05 01:50:24 -05:00
Tim Pope
6d011f1ea5 Improve :Gclog window title 2020-01-05 00:36:36 -05:00
Tim Pope
726fdf1c94 Support ...commit as HEAD...commit 2020-01-03 19:47:08 -05:00
Tim Pope
3bf602b13d Use underlying commit not tag for :Gedit tag:path 2019-12-27 17:19:42 -05:00
Tim Pope
3729c351e1 Fix unknown function error on Vim < 7.2.061 2019-12-27 17:19:42 -05:00
Tim Pope
7848779d3b Don't error if we can't :bwipeout
References https://github.com/tpope/vim-fugitive/issues/1418
2019-12-27 17:19:42 -05:00
Jon Parise
b68b6d4329 Mention vim-phabricator for Phabricator browsing 2019-12-11 17:49:38 -05:00
Tim Pope
6d4564a05e Fix timer invocation
References https://github.com/tpope/vim-fugitive/issues/1329
2019-12-07 10:14:14 -05:00
Tim Pope
5d37b17e34 Match Git semantics for GIT_CEILING_DIRECTORIES symlink resolution
Also support a generic g:ceiling_directories that can be shared with
other plugins that do this sort of detection.

References https://github.com/tpope/vim-fugitive/issues/1412
2019-12-06 18:03:32 -05:00
Tim Pope
b48a572475 Use timers to avoid Vim patch 8.1.1756
Closes https://github.com/tpope/vim-fugitive/issues/1329
2019-12-06 14:39:27 -05:00
Tim Pope
e1ab8fff09 Handle both amended and new commits during rebase
References https://github.com/tpope/vim-fugitive/issues/1329
2019-12-06 14:39:27 -05:00
Tim Pope
d3a2bdbe2c Don't abort rebase after committing on last step
References https://github.com/tpope/vim-fugitive/issues/1329
2019-12-06 14:12:35 -05:00
Tim Pope
42c6fd1440 Don't override explicit empty string for core.askPass
References https://github.com/tpope/vim-fugitive/issues/1410
2019-12-06 12:56:59 -05:00
Tim Pope
671a85daba Fix erroneous ? escaping in * pattern 2019-11-30 17:19:52 -05:00
Tim Pope
6d9dd103c0 Fix false positive matching filename in blame 2019-11-30 17:15:44 -05:00
Tim Pope
3b1da8b217 Remove debugging function 2019-11-27 16:34:28 -05:00
Tim Pope
67efbf66e0 Don't fall back to pwd for Git dir of blank filename
In particular, this fixes `FugitiveFind(..., '')` to respect the empty
Git dir argument rather than falling back to detection on the current
working directory.  Which in turn fixes :Gstatus using the current
working directory when called from a buffer that does not belong to a
repository.

References https://github.com/tpope/vim-fugitive/issues/1408
2019-11-27 15:27:52 -05:00
Tim Pope
eed46c1f24 Perform automatic :diffoff on :Gdiffsplit /external/file buffers
Closes https://github.com/tpope/vim-fugitive/issues/1402
2019-11-21 22:08:37 -05:00
Tim Pope
dc5320630d Provide explanatory error on :Gdiff ~
References https://github.com/tpope/vim-fugitive/issues/1402
2019-11-19 17:48:43 -05:00
Tim Pope
13fdeb5fa7 Don't show bogus unstaged changes in bare repository
References https://github.com/tpope/vim-fugitive/pull/1262
2019-11-17 22:19:33 -05:00
Omar Sandoval
3936a74584 Reset scrollbind/cursorbind after reblaming
The following sequence of commands leaves the buffer with scrollbind and
cursorbind set:

  :Gblame
  Reblame with one of -, ~, or P
  Quit with gq

What's happening here is:

1. In BlameSubcommand, we set scrollbind and cursorbind on the buffer.
   We also set w:fugitive_leave on the blame buffer to reset scrollbind
   and cursorbind when the blame buffer is closed.
2. In BlameJump, we execute Gedit, which changes the window to a new
   buffer. Then, we delete the blame buffer, at which point we try to
   reset scrollbind and cursorbind. However, the original buffer isn't
   on a window anymore, so this doesn't do anything.
3. In BlameQuit, we go back to the original buffer. Note this snippet
   from `:help local-options`: "if this buffer has been edited in this
   window, the [option] values from back then are used". When the
   original buffer was last used, scrollbind and cursorbind were still
   set. Therefore, the buffer ends up with scrollbind and cursorbind
   set after leaving Gblame.

The fix is to delete the blame buffer _before_ changing to the new
buffer in BlameJump. This ensures that we restore the options while the
original buffer is still around (which is how BlameQuit does it, too).
2019-11-17 21:08:23 -05:00
Tim Pope
a2d76c4583 Fix completion of stash@\{<Tab>
References https://github.com/tpope/vim-fugitive/issues/1396
2019-11-16 19:48:31 -05:00
Farid
fd029d83bf Add built-in package management installation way 2019-11-16 19:48:19 -05:00
Tim Pope
0004f585fd Don't use arrow notation for unstaged modifications
Closes https://github.com/tpope/vim-fugitive/issues/1392
2019-11-15 20:31:29 -05:00
Tim Pope
b24f98fbb1 Cache fugitive#Head() to minimize statusline IO
Closes https://github.com/tpope/vim-fugitive/issues/1384
2019-11-15 20:05:18 -05:00
Tim Pope
8c84ea6fdb Replace --no-patch with -s for Git < 1.8.4
Closes https://github.com/tpope/vim-fugitive/issues/1398
2019-11-12 21:31:36 -05:00
Tim Pope
1e57d678ba Add PayPal donation link 2019-11-08 17:41:09 -05:00
Tim Pope
f6acae50ea Improve robustness of status --porcelain=v1 parsing
References https://github.com/tpope/vim-fugitive/issues/1388
2019-10-27 18:53:19 -04:00
Tim Pope
0356edf6b8 Optimize away log calls in :Gstatus if no upstream changes 2019-10-26 09:05:49 -04:00
Tim Pope
e8c5b604db Improve robustness of status --porcelain=v2 parsing
Closes https://github.com/tpope/vim-fugitive/issues/1388
2019-10-26 08:49:23 -04:00
Tim Pope
b09c5d2523 Resolve symlinks in configured work tree
Closes https://github.com/tpope/vim-fugitive/issues/1382
2019-10-22 05:13:42 -04:00
Tim Pope
395d947644 Force --no-edit on squash maps
References https://github.com/tpope/vim-fugitive/pull/1378
2019-10-20 15:37:41 -04:00
Ben
0a77016ef5 Disable signcolumn during Gblame (#1379) 2019-10-17 18:14:07 -04:00
Tim Pope
06e34204af Fix error message on blank buffer with no Git dir 2019-10-11 17:21:16 -04:00
7 changed files with 2524 additions and 1454 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1 +1,2 @@
github: tpope
custom: ["https://www.paypal.me/vimpope"]

View File

@@ -1,62 +1,79 @@
# 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:
Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git
plugin for Vim? Either way, it's "so awesome, it should be illegal". That's
why it's called Fugitive.
Bring up an enhanced version of `git status` with `:G` (also known as
`:Gstatus`). Press `g?` to bring up a list of maps for numerous operations
including diffing, staging, committing, rebasing, and stashing.
The crown jewel of Fugitive is `:Git` (or just `:G`), which calls any
arbitrary Git command. If you know how to use Git at the command line, you
know how to use `:Git`. It's vaguely akin to `:!git` but with numerous
improvements:
View any blob, tree, commit, or tag in the repository with `:Gedit` (and
`:Gsplit`, `:Gvsplit`, `:Gtabedit`, ...). Edit a file in the index and
write to it to stage the changes. Use `:Gdiffsplit` to bring up the staged
version of the file side by side with the working tree version and use
Vim's diff handling capabilities to stage a subset of the file's
changes.
* The default behavior is to directly echo the command's output. Quiet
commands like `:Git add` avoid the dreaded "Press ENTER or type command to
continue" prompt.
* `:Git commit`, `:Git rebase -i`, and other commands that invoke an editor do
their editing in the current Vim instance.
* `:Git diff`, `:Git log`, and other verbose, paginated commands have their
output loaded into a temporary buffer. Force this behavior for any command
with `:Git --paginate` or `:Git -p`.
* `:Git blame` uses a temporary buffer with maps for additional triage. Press
enter on a line to view the commit where the line changed, or `g?` to see
other available maps. Omit the filename argument and the currently edited
file will be blamed in a vertical, scroll-bound split.
* `:Git mergetool` and `:Git difftool` load their changesets into the quickfix
list.
* Called with no arguments, `:Git` opens a summary window with dirty files and
unpushed and unpulled commits. Press `g?` to bring up a list of maps for
numerous operations including diffing, staging, committing, rebasing, and
stashing. (This is the successor to the old `:Gstatus`.)
* This command (along with all other commands) always uses the current
buffer's repository, so you don't need to worry about the current working
directory.
Commit, merge, and rebase with `:Gcommit`, `:Gmerge`, and `:Grebase`, using
the current Vim instance to edit commit messages and the rebase todo list.
Use `:Gpush`, `:Gfetch`, and `:Gpull` to send and retrieve upstream changes.
Additional commands are provided for higher level operations:
`:Gblame` brings up an interactive vertical split with `git blame`
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. `:Gdelete` does a `git rm` on a file and simultaneously deletes
the buffer.
Use `:Ggrep` to search the work tree (or any arbitrary commit) with
`git grep`, skipping over that which is not tracked in the repository.
`:Gclog` and `:Gllog` load all previous commits into the quickfix or location
list. Give them a range (e.g., using visual mode and `:'<,'>Gclog`) to
iterate over every change to that portion of the current file.
`:Gread` is a variant of `git checkout -- filename` that operates on the
buffer rather than the filename. This means you can use `u` to undo it
* View any blob, tree, commit, or tag in the repository with `:Gedit` (and
`:Gsplit`, etc.). For example, `:Gedit HEAD~3:%` loads the current file as
it existed 3 commits ago.
* `:Gdiffsplit` brings up the staged version of the file side by side with the
working tree version. Use Vim's diff handling capabilities to apply changes
to the staged version, and write that buffer to stage the changes. You can
also give an arbitrary `:Gedit` argument to diff against older versions of
the file.
* `:Gread` is a variant of `git checkout -- filename` that operates on the
buffer rather than the file itself. This means you can use `u` to undo it
and you never get any warnings about the file changing outside Vim.
`:Gwrite` writes to both the work tree and index versions of a file,
making it like `git add` when called from a work tree file and like
`git checkout` when called from the index or a blob in history.
Use `:Gbrowse` to open the current file on the web front-end of your favorite
* `:Gwrite` writes to both the work tree and index versions of a file, making
it like `git add` when called from a work tree file and like `git checkout`
when called from the index or a blob in history.
* `:Ggrep` is `:grep` for `git grep`. `:Glgrep` is `:lgrep` for the same.
* `:GMove` does a `git mv` on the current file and changes the buffer name to
match. `:GRename` does the same with a destination filename relative to the
current file's directory.
* `:GDelete` does a `git rm` on the current file and simultaneously deletes
the buffer. `:GRemove` does the same but leaves the (now empty) buffer
open.
* `:GBrowse` to open the current file on the web front-end of your favorite
hosting provider, with optional line range (try it in visual mode). Plugins
are available for popular providers such as [GitHub][rhubarb.vim],
[GitLab][fugitive-gitlab.vim], [Bitbucket][fubitive.vim],
[Gitee][fugitive-gitee.vim], and [Pagure][pagure].
[Gitee][fugitive-gitee.vim], [Pagure][pagure],
[Phabricator][vim-phabricator], [Azure DevOps][fugitive-azure-devops.vim],
and [sourcehut][srht.vim].
[rhubarb.vim]: https://github.com/tpope/vim-rhubarb
[fugitive-gitlab.vim]: https://github.com/shumphrey/fugitive-gitlab.vim
[fubitive.vim]: https://github.com/tommcdo/vim-fubitive
[fugitive-gitee.vim]: https://github.com/linuxsuren/fugitive-gitee.vim
[pagure]: https://github.com/FrostyX/vim-fugitive-pagure
[vim-phabricator]: https://github.com/jparise/vim-phabricator
[fugitive-azure-devops.vim]: https://github.com/cedarbaum/fugitive-azure-devops.vim
[srht.vim]: https://git.sr.ht/~willdurand/srht.vim
Add `%{FugitiveStatusline()}` to `'statusline'` to get an indicator
with the current branch in your statusline.
Last but not least, there's `:Git` for running any arbitrary command.
For more information, see `:help fugitive`.
## Screencasts
@@ -69,30 +86,34 @@ For more information, see `:help fugitive`.
## Installation
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:
Install using your favorite package manager, or use Vim's built-in package support:
cd ~/.vim/bundle
git clone https://github.com/tpope/vim-fugitive.git
vim -u NONE -c "helptags vim-fugitive/doc" -c q
mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/fugitive.git
vim -u NONE -c "helptags fugitive/doc" -c q
## FAQ
> Why can't I enter my password when I `:Gpush`?
> What happened to the dispatch.vim backed asynchronous `:Gpush` and
> `:Gfetch`?
It is highly recommended to use SSH keys or [credentials caching][] to avoid
entering your password on every upstream interaction. If this isn't an
option, the official solution is to use the `core.askPass` Git option to
request the password via a GUI. Fugitive will configure this for you
automatically if you have `ssh-askpass` or `git-gui` installed; otherwise it's
your responsibility to set this up.
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:
As an absolute last resort, you can invoke `:Git --paginate push`. Fugitive
recognizes the pagination request and fires up a `:terminal`, which allows for
interactive password entry.
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>
[credentials caching]: https://help.github.com/en/articles/caching-your-github-password-in-git
> So I have a symlink and...
Stop. Just stop. If Git won't deal with your symlink, then Fugitive won't
either. Consider using a [plugin that resolves
symlinks](https://github.com/aymericbeaumet/symlink.vim), or even better,
using fewer symlinks.
## Self-Promotion

File diff suppressed because it is too large Load Diff

View File

@@ -16,62 +16,31 @@ These commands are local to the buffers in which they work (generally, buffers
that are part of Git repositories).
*:Git* *fugitive-:G*
:Git {args} Run an arbitrary git command. Similar to :!git [args]
:G {args} but chdir to the repository tree first. For some
subcommands, a Fugitive command is called instead.
: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
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
loaded into a split window. Closing that window will
resume running the command. A few Git subcommands
have different behavior; these are documented below.
*:Git!*
:Git! {args} Like |:Git|, but capture the output into a temp file,
:Git --no-pager {args} and |:split| that temp file. Use :0Git to
:Git -P {args} |:edit| the temp file instead. A temp file is always
used for diff and log commands.
*: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.
*:Gstatus*
:Git Bring up a summary window vaguely akin to git-status.
:G Press g? or see |fugitive-maps| for usage.
:Gstatus
*fugitive-summary*
:Git With no arguments, bring up a summary window vaguely
:G akin to git-status. Press g? or see |fugitive-maps|
for usage.
*:Git-commit* *:Gcommit*
:Git commit [args] A wrapper around git-commit. Unless the arguments
:Gcommit [args] given would skip the invocation of an editor (e.g.,
-m), a split window will be used to obtain a commit
message, or a new tab if -v is given. Write and close
the window (:wq) to finish the commit. To cancel, use
an empty message.
*:Git-revert* *:Grevert*
:Git revert [args] A wrapper around git-revert. Similar to |:Gcommit|.
:Grevert [args]
*:Git-merge* *:Gmerge*
:Git merge [args] Calls git-merge and loads errors and conflicted files
:Gmerge [args] 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.
*:Git-pull* *:Gpull*
:Git pull [args] Like |:Gmerge|, but for git-pull.
:Gpull [args]
*:Git-rebase* *:Grebase*
:Git rebase [args] Like |:Gmerge|, but for git-rebase. Interactive
:Grebase [args] rebase is experimentally supported.
*:Git-push* *:Gpush*
:Git push [args] Invoke git-push, load the results into the |quickfix|
:Gpush [args] list, and invoke |:cwindow| to reveal any errors.
|:Dispatch| is used if available for asynchronous
invocation.
*:Git-fetch* *:Gfetch*
:Git fetch [args] Like |:Gpush|, but for git-fetch.
:Gfetch [args]
*:Git-blame* *:Gblame*
*:Git_blame*
:Git blame [flags] Run git-blame [flags] on the current file and open the
:Gblame [flags] results in a scroll-bound vertical split. The
results in a scroll-bound vertical split. The
following maps, which work on the cursor line commit
where sensible, are provided:
@@ -90,12 +59,32 @@ that are part of Git repositories).
~ reblame at [count]th first grandparent
P reblame at [count]th parent (like HEAD^[count])
:[range]Gblame [flags] If a range is given, just that part of the file will
:Gblame [flags] {file} be blamed, and a horizontal split without
:Git blame ... scrollbinding is used. You can also give an arbitrary
*g:fugitive_dynamic_colors*
In the GUI or a 256 color terminal, commit hashes will
highlighted in different colors. To disable this:
>
let g:fugitive_dynamic_colors = 0
<
:[range]Git blame [...] If a range is given, just that part of the file will
:Git blame [...] {file} be blamed, and a horizontal split without
scrollbinding is used. You can also give an arbitrary
filename.
*:Ggrep* *:Gcgrep* *:Git-grep*
*:Git_difftool*
:Git[!] difftool [args] Invoke `git diff [args]` and load the changes into the
quickfix list. Each changed hunk gets a separate
quickfix entry unless you pass an option like
--name-only or --name-status. Jumps to the first
change unless [!] is given.
:Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a
new tab, and invoke |:Gdiffsplit!| against the
appropriate commit.
*: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]
@@ -103,11 +92,15 @@ that are part of Git repositories).
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
:0Git[!] grep [args]
*:Gclog* *:Glog*
*:Gclog*
:Gclog[!] [args] Use git-log [args] to load the commit history into the
:Glog[!] [args] |quickfix| list. Jump to the first commit unless [!]
|quickfix| list. Jumps to the first commit unless [!]
is given.
The quickfix list can be awkward for many use cases
and exhibits extremely poor performance with larger
data sets. Consider using |:Git| log instead.
:{range}Gclog[!] [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
@@ -139,13 +132,6 @@ that are part of Git repositories).
*:Gpedit*
:Gpedit [object] |:pedit| a |fugitive-object|.
:Gsplit! [args] *:Gsplit!* *:Gvsplit!*
:Gvsplit! [args] *:Gtabedit!* *:Gpedit!*
:Gtabedit! [args] Capture the output of `git [args]` to a temp file and
:Gpedit! [args] open it in a split, tab, or preview window. Use
:0Gsplit! to suppress the split and open it in the
current window.
*:Gread* *fugitive-:Gr*
:Gread [object] Empty the buffer and |:read| a |fugitive-object|.
When the argument is omitted, this is similar to
@@ -194,7 +180,7 @@ that are part of Git repositories).
focus on the current window. During a merge conflict,
this is a three-way diff against the "ours" and
"theirs" ancestors. Additional d2o and d3o maps are
provided to to obtain the hunk from the "ours" or
provided to obtain the hunk from the "ours" or
"theirs" ancestor, respectively.
:Gdiffsplit! {object} Like |:Gdiffsplit|, but retain focus on the current
@@ -203,58 +189,57 @@ that are part of Git repositories).
*:Gvdiffsplit*
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*:Ghdiffsplit* *:Gsdiff*
*:Ghdiffsplit*
:Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally.
*:Gmove*
:Gmove {destination} Wrapper around git-mv that renames the buffer
*:GMove*
:GMove {destination} Wrapper around git-mv that renames the buffer
afterward. Add a ! to pass -f.
*:Grename*
:Grename {destination} Like |:Gmove| but operates relative to the parent
*:GRename*
:GRename {destination} Like |:GMove| but operates relative to the parent
directory of the current file.
*:Gdelete*
:Gdelete Wrapper around git-rm that deletes the buffer
*:GDelete*
:GDelete Wrapper around git-rm that deletes the buffer
afterward. When invoked in an index file, --cached is
passed. Add a ! to pass -f and forcefully discard the
buffer.
*:Gremove*
:Gremove Like :Gdelete, but keep the (now empty) buffer around.
*:GRemove*
:GRemove Like |:GDelete|, but keep the (now empty) buffer around.
*:Gbrowse*
:Gbrowse Open the current file, blob, tree, commit, or tag
*:GBrowse*
: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.
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>.
:Gbrowse {object} Like :Gbrowse, but for a given |fugitive-object|.
:GBrowse {object} Like :GBrowse, but for a given |fugitive-object|.
:Gbrowse [...]@{remote} Force using the given remote rather than the remote
for the current branch. The remote is used to
determine which upstream repository to link to.
:{range}Gbrowse [args] Appends an anchor to the URL that emphasizes the
:{range}GBrowse [args] Appends an anchor to the URL that emphasizes the
selected lines. This also forces the URL to include a
commit rather than a branch name so it remains valid
if the file changes. You can give a range of "0" to
force this behavior without including an anchor.
:[range]Gbrowse! [args] Like :Gbrowse, but put the URL on the clipboard rather
:GBrowse [...]@{remote} Force using the given remote rather than the remote
for the current branch. The remote is used to
determine which upstream repository to link to.
:GBrowse {url} Open an arbitrary URL in your browser.
:[range]GBrowse! [args] Like :GBrowse, but put the URL on the clipboard rather
than opening it.
MAPS *fugitive-maps*
These maps are available in both the |:Gstatus| buffer and Fugitive object
buffers, although not all maps 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.
These maps are available in both the |fugitive-summary| buffer and Fugitive
object buffers, although not all maps 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-staging-maps*
Staging/unstaging maps ~
@@ -275,10 +260,9 @@ U Unstage everything.
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. You can use this during
a merge conflict do discard "our" changes (--theirs)
in the "Unstaged" section or discard "their" changes
(--ours) in the "Staged" section.
`:messages` to see it again. During a merge conflict,
use 2X to call `checkout --ours` or 3X to call
`checkout --theirs` .
*fugitive_=*
= Toggle an inline diff of the file under the cursor.
@@ -301,7 +285,7 @@ P under the cursor. On untracked files, this instead
*fugitive_d*
Diff maps ~
*fugitive_dp*
dp Invoke |:Git!| diff on the file under the cursor.
dp Invoke |:Git| diff on the file under the cursor.
Deprecated in favor of inline diffs.
*fugitive_dd*
@@ -400,7 +384,7 @@ i Jump to the next file or hunk, expanding inline diffs
][ Jump [count] section ends forward.
*fugitive_star*
* One the first column of a + or - diff line, search for
* On the first column of a + or - diff line, search for
the corresponding - or + line. Otherwise, defer to
built-in |star|.
@@ -495,7 +479,7 @@ czz Push stash. Pass a [count] of 1 to add
`--include-untracked` or 2 to add `--all`.
czw Push stash of worktree. Like `czz` with
`--include-index`.
`--keep-index`.
czA Apply topmost stash, or stash@{count}.
@@ -604,7 +588,9 @@ Makefile The file named Makefile in the work tree
!:Makefile The file named Makefile in the commit owning the current file
!3^2 The second parent of the commit owning buffer #3
.git/config The repo config file
: Same as |:Gstatus|
: The |fugitive-summary| buffer
- A temp file containing the last |:Git| invocation's output
<cfile> The file or commit under the cursor
STATUSLINE *fugitive-statusline*
@@ -621,6 +607,39 @@ HEAD is detached, FugitiveHead() will return the empty string, unless the
optional argument is given, in which case the hash of the current commit will
be truncated to the given number of characters.
DEPRECATIONS *fugitive-deprecated*
The following commands are softly deprecated in favor of replacements that
adhere to a new naming scheme. They will eventually be removed, but probably
not in the near future.
Remember that |:Git| can be shortened to |:G|, so replacements using it are
just one space character longer than the legacy version.
*:Gremove* Superseded by |:GRemove|.
*:Gdelete* Superseded by |:GDelete|.
*:Gmove* Superseded by |:GMove|.
*:Grename* Superseded by |:GRename|.
*:Gbrowse* Superseded by |:GBrowse|.
*:Gdiff* Superseded by |:Gdiffsplit|
*:Gsdiff* Superseded by |:Ghdiffsplit|
*:Gvdiff* Superseded by |:Gvdiffsplit| or |:vert| |:Gdiffsplit|.
*:Gblame* Superseded by |:Git_blame|.
*:Gcommit* Superseded by |:Git| commit.
*:Gmerge* Superseded by |:Git| merge and |:Git_mergetool|.
*:Gpull* Superseded by |:Git| pull.
*:Grebase* Superseded by |:Git| rebase.
*:Grevert* Superseded by |:Git| revert.
*:Gpush* Superseded by |:Git| push.
*: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.
*:Gpedit!* Superseded by :Git! --paginate.
ABOUT *fugitive-about*
Grab the latest version or report a bug on GitHub:

View File

@@ -0,0 +1,6 @@
if exists("b:did_ftplugin") || !exists('*fugitive#BlameFileType')
finish
endif
let b:did_ftplugin = 1
call fugitive#BlameFileType()

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.1
" Version: 3.3
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
if exists('g:loaded_fugitive')
@@ -8,6 +8,8 @@ if exists('g:loaded_fugitive')
endif
let g:loaded_fugitive = 1
let s:bad_git_dir = '/$\|^fugitive:'
function! FugitiveGitDir(...) abort
if !a:0 || type(a:1) == type(0) && a:1 < 0
if exists('g:fugitive_event')
@@ -16,12 +18,21 @@ function! FugitiveGitDir(...) abort
let dir = get(b:, 'git_dir', '')
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$')
return FugitiveExtractGitDir(getcwd())
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
return b:git_dir
endif
return dir
return dir =~# s:bad_git_dir ? '' : dir
elseif type(a:1) == type(0)
return getbufvar(a:1, 'git_dir')
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
let dir = getbufvar(a:1, 'git_dir')
return dir =~# s:bad_git_dir ? '' : dir
elseif type(a:1) == type('')
return substitute(s:Slash(a:1), '/$', '', '')
elseif type(a:1) == type({})
return get(a:1, 'git_dir', '')
else
return ''
endif
@@ -66,8 +77,8 @@ function! FugitivePath(...) abort
endfunction
" FugitiveParse() takes a fugitive:// URL and returns a 2 element list
" containing the Git dir and an object name ("commit:file"). It's effectively
" then inverse of FugitiveFind().
" containing an object name ("commit:file") and the Git dir. It's effectively
" the inverse of FugitiveFind().
function! FugitiveParse(...) abort
let path = s:Slash(a:0 ? a:1 : @%)
if path !~# '^fugitive:'
@@ -81,6 +92,22 @@ function! FugitiveParse(...) abort
throw v:errmsg
endfunction
" FugitiveResult() returns an object encapsulating the result of the most
" recend :Git command. Will be empty if no result is available. Pass in the
" name of a temp buffer to get the result object for that command instead.
" Contains the following keys:
"
" * "args": List of command arguments, starting with the subcommand. Will be
" empty for usages like :Git --help.
" * "dir": Git dir of the relevant repository.
" * "exit_status": The integer exit code of the process.
" * "flags": Flags passed directly to Git, like -c and --help.
" * "file": Path to file containing command output. Not guaranteed to exist,
" so verify with filereadable() before trying to access it.
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
@@ -93,18 +120,66 @@ function! FugitivePrepare(...) abort
return call('fugitive#Prepare', a:000)
endfunction
" FugitiveConfig() get returns an opaque structure that can be passed to other
" FugitiveConfig functions in lieu of a Git directory. This can be faster
" when performing multiple config queries. Do not rely on the internal
" structure of the return value as it is not guaranteed. If you want a full
" dictionary of every config value, use FugitiveConfigGetRegexp('.*').
function! FugitiveConfig(...) abort
if a:0 == 2 && type(a:2) != type({})
if a:0 == 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir'))
return fugitive#Config(a:1, FugitiveGitDir(a:2))
elseif a:0 == 1 && a:1 !~# '^[[:alnum:]-]\+\.'
elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.')
return fugitive#Config(FugitiveGitDir(a:1))
else
return call('fugitive#Config', a:000)
endif
endfunction
" FugitiveConfigGet() retrieves a Git configuration value. An optional second
" argument provides the Git dir as with FugitiveFind(). Pass a blank string
" to limit to the global config.
function! FugitiveConfigGet(name, ...) abort
return call('FugitiveConfig', [a:name] + a:000)
endfunction
" FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of
" all values.
function! FugitiveConfigGetAll(name, ...) abort
if a:0 && type(a:1) ==# type({}) && !has_key(a:1, 'git_dir')
let config = a:1
else
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
endif
let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g')
return copy(get(config, name, []))
endfunction
" FugitiveConfigGetRegexp() retrieves a dictionary of all configuration values
" with a key matching the given pattern. Like git config --get-regexp, but
" using a Vim regexp. Second argument has same semantics as
" FugitiveConfigGet().
function! FugitiveConfigGetRegexp(pattern, ...) abort
if a:0 && type(a:1) ==# type({}) && !has_key(a:2, 'git_dir')
let config = a:1
else
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
endif
let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)')
if a:pattern !~# '\\\@<!\%(\\\\\)*\\z[se]'
return filtered
endif
let transformed = {}
for [k, v] in items(filtered)
let k = matchstr(k, a:pattern)
if len(k)
let transformed[k] = v
endif
endfor
return transformed
endfunction
function! FugitiveRemoteUrl(...) abort
return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1))
return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1), a:0 > 2 ? a:3 : 0)
endfunction
function! FugitiveHead(...) abort
@@ -116,7 +191,7 @@ function! FugitiveHead(...) abort
endfunction
function! FugitiveStatusline(...) abort
if !exists('b:git_dir')
if empty(get(b:, 'git_dir', ''))
return ''
endif
return fugitive#Statusline()
@@ -157,16 +232,16 @@ function! s:Tree(path) abort
let config = readfile(config_file,'',10)
call filter(config,'v:val =~# "^\\s*worktree *="')
if len(config) == 1
let worktree = s:Slash(FugitiveVimPath(matchstr(config[0], '= *\zs.*')))
let worktree = FugitiveVimPath(matchstr(config[0], '= *\zs.*'))
endif
elseif filereadable(dir . '/gitdir')
let worktree = s:Slash(fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h'))
let worktree = fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h')
if worktree ==# '.'
unlet! worktree
endif
endif
if exists('worktree')
let s:worktree_for_dir[dir] = worktree
let s:worktree_for_dir[dir] = s:Slash(resolve(worktree))
let s:dir_for_worktree[s:worktree_for_dir[dir]] = dir
endif
endif
@@ -177,10 +252,29 @@ function! s:Tree(path) abort
endif
endfunction
function! s:CeilingDirectories() abort
if !exists('s:ceiling_directories')
let s:ceiling_directories = []
let resolve = 1
for dir in split($GIT_CEILING_DIRECTORIES, has('win32') ? ';' : ':', 1)
if empty(dir)
let resolve = 0
elseif resolve
call add(s:ceiling_directories, resolve(dir))
else
call add(s:ceiling_directories, dir)
endif
endfor
endif
return s:ceiling_directories + get(g:, 'ceiling_directories', [])
endfunction
function! FugitiveExtractGitDir(path) abort
let path = s:Slash(a:path)
if path =~# '^fugitive:'
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
elseif empty(path)
return ''
elseif isdirectory(path)
let path = fnamemodify(path, ':p:s?/$??')
else
@@ -201,7 +295,7 @@ function! FugitiveExtractGitDir(path) abort
if root =~# '\v^//%([^/]+/?)?$'
break
endif
if index(split($GIT_CEILING_DIRECTORIES, ':'), root) >= 0
if index(s:CeilingDirectories(), root) >= 0
break
endif
if root ==# $GIT_WORK_TREE && FugitiveIsGitDir(env_git_dir)
@@ -233,18 +327,29 @@ function! FugitiveExtractGitDir(path) abort
endfunction
function! FugitiveDetect(path) abort
if exists('b:git_dir') && b:git_dir =~# '^$\|/$\|^fugitive:'
if exists('b:git_dir') && b:git_dir =~# '^$\|' . s:bad_git_dir
unlet b:git_dir
endif
if !exists('b:git_dir')
let dir = FugitiveExtractGitDir(a:path)
if dir !=# ''
let b:git_dir = dir
let b:git_dir = FugitiveExtractGitDir(a:path)
endif
if empty(b:git_dir) || !exists('#User#Fugitive')
return ''
endif
if exists('b:git_dir')
return fugitive#Init()
if v:version >= 704 || (v:version == 703 && has('patch442'))
doautocmd <nomodeline> User Fugitive
elseif &modelines > 0
let modelines = &modelines
try
set modelines=0
doautocmd User Fugitive
finally
let &modelines = modelines
endtry
else
doautocmd User Fugitive
endif
return ''
endfunction
function! FugitiveVimPath(path) abort
@@ -259,13 +364,15 @@ function! FugitiveGitPath(path) abort
return s:Slash(a:path)
endfunction
function! s:Slash(path) abort
if exists('+shellslash')
function! s:Slash(path) abort
return tr(a:path, '\', '/')
else
return a:path
endif
endfunction
else
function! s:Slash(path) abort
return a:path
endfunction
endif
function! s:ProjectionistDetect() abort
let file = s:Slash(get(g:, 'projectionist_file', ''))
@@ -285,6 +392,9 @@ function! s:ProjectionistDetect() abort
endif
endfunction
if v:version + has('patch061') < 703
runtime! autoload/fugitive.vim
endif
let g:io_fugitive = {
\ 'simplify': function('fugitive#simplify'),
\ 'resolve': function('fugitive#resolve'),
@@ -309,22 +419,19 @@ augroup fugitive
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<amatch>')), ':p'))
autocmd FileType git
\ if len(FugitiveGitDir()) |
\ call fugitive#MapJumps() |
\ call fugitive#MapCfile() |
\ endif
\ call fugitive#MapCfile()
autocmd FileType gitcommit
\ if len(FugitiveGitDir()) |
\ call fugitive#MapCfile('fugitive#MessageCfile()') |
\ call fugitive#MapCfile('fugitive#MessageCfile()')
autocmd FileType git,gitcommit
\ if &foldtext ==# 'foldtext()' |
\ setlocal foldtext=fugitive#Foldtext() |
\ endif
autocmd FileType fugitive
\ if len(FugitiveGitDir()) |
\ call fugitive#MapCfile('fugitive#StatusCfile()') |
\ endif
\ call fugitive#MapCfile('fugitive#StatusCfile()')
autocmd FileType gitrebase
\ let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' |
\ if len(FugitiveGitDir()) |
\ let &l:includeexpr = 'v:fname =~# ''^\x\{4,\}$'' ? FugitiveFind(v:fname) : ' .
\ if &l:includeexpr !~# 'Fugitive' |
\ let &l:includeexpr = 'v:fname =~# ''^\x\{4,\}$'' && len(FugitiveGitDir()) ? FugitiveFind(v:fname) : ' .
\ (len(&l:includeexpr) ? &l:includeexpr : 'v:fname') |
\ endif |
\ let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc='
@@ -362,30 +469,40 @@ let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete G exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete Git exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
if exists(':G') != 2
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
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)
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echo ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE'
endif
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#CommitComplete Gcommit exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "commit " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RevertComplete Grevert exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "revert " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#MergeComplete Gmerge exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "merge " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RebaseComplete Grebase exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "rebase " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PullComplete Gpull exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "pull " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PushComplete Gpush exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "push " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#FetchComplete Gfetch exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "fetch " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#BlameComplete Gblame exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "blame " . <q-args>)'
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)
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
\ 'echohl WarningMSG|echo ":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>)'
endif
endfor
unlet s:cmd
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(<q-args>, 0)"
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#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#Command(0, <count> > 0 ? <count> : 0, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
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)
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
\ '|echohl WarningMSG|echo ":Glog is deprecated in favor of :Gclog"|echohl NONE'
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")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GlLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
@@ -407,12 +524,32 @@ exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GRemove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GDelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
if exists(':Gremove') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
\ '|echohl WarningMSG|echo ":Gremove is deprecated in favor of :GRemove"|echohl NONE'
endif
if exists(':Gdelete') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
\ '|echohl WarningMSG|echo ":Gdelete is deprecated in favor of :GDelete"|echohl NONE'
endif
if exists(':Gmove') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
\ '|echohl WarningMSG|echo ":Gmove is deprecated in favor of :GMove"|echohl NONE'
endif
if exists(':Grename') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
\ '|echohl WarningMSG|echo ":Grename is deprecated in favor of :GRename"|echohl NONE'
endif
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
if exists(':Gbrowse') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
\ '|if <bang>1|redraw!|endif|echohl WarningMSG|echo ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE'
endif
if get(g:, 'fugitive_no_maps')
finish

View File

@@ -8,6 +8,9 @@ syn spell notoplevel
syn include @fugitiveDiff syntax/diff.vim
syn match fugitiveHeader /^[A-Z][a-z][^:]*:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
syn match fugitiveBareHeader /^Bare:/
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
syn match fugitiveHelpTag /\S\+/ contained
syn region fugitiveSection start=/^\%(.*(\d\+)$\)\@=/ contains=fugitiveHeading end=/^$/
syn cluster fugitiveSection contains=fugitiveSection
@@ -20,8 +23,8 @@ syn match fugitiveDone /^done\>/ contained containedin=@fugitiveSection nextgrou
syn match fugitiveStop /^stop\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSection
syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@<!/ contained
syn match fugitiveHash /^\x\{4,\}\>/ contained containedin=@fugitiveSection
syn match fugitiveHash /\<\x\{4,\}\>/ contained
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=@fugitiveDiff containedin=@fugitiveSection fold
@@ -33,7 +36,10 @@ for s:section in ['Untracked', 'Unstaged', 'Staged']
endfor
unlet s:section
hi def link fugitiveBareHeader fugitiveHeader
hi def link fugitiveHelpHeader fugitiveHeader
hi def link fugitiveHeader Label
hi def link fugitiveHelpTag Tag
hi def link fugitiveHeading PreProc
hi def link fugitiveUntrackedHeading PreCondit
hi def link fugitiveUnstagedHeading Macro