Commit Graph

803 Commits

Author SHA1 Message Date
Tim Pope
da8d532b1a Support default value as third FugitiveConfigGet() argument 2021-05-26 09:23:34 -04:00
Tim Pope
9a1dab0b27 Require Vim 7.4 or newer
This renders a lot of other version checks inside the plugin obsolete,
but I'm going to hold off on cleaning them up until I'm sure this change
is permanent.
2021-04-16 09:27:25 -04:00
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
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
b4255d6679 Add notices to deprecated lowercase commands 2021-04-06 20:43:26 -04:00
Tim Pope
e474785adb Handle non-config dictionary passed to FugitiveConfig() 2021-04-03 20:44:31 -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
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
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
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
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
0cc2190889 Add deprecation notices to git subcommand wrappers 2021-02-12 18:35:28 -05: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
5dfe8581ca Extract :Ggrep/:Glgrep wrapper function 2020-04-24 23:01:38 -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
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
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
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
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
9d62c67737 Remove legacy autocommands 2020-01-22 09:44:07 -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
708595d996 Fix comment typo 2020-01-20 15:42:45 -05:00
Tim Pope
1a6934fc7e Fix FugitiveParse() return value documentation 2020-01-20 07:03:48 -05:00
Tim Pope
3729c351e1 Fix unknown function error on Vim < 7.2.061 2019-12-27 17:19:42 -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
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
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
427ac52d7d fugitive.vim 3.1
* Commands are now global, not buffer local.
* Calling a command in an unnamed buffer uses the working directory.
* Preserve line number on :Gedit to return to work tree buffer.
* Better submodule support in :Gstatus.
* Support git-blame revision ignoring features.
* Show first parent diff in merge commit buffer.
* Remove deprecated support for .git/tags.
* Bug fixes.
2019-10-10 19:47:39 -04:00
Tim Pope
8c29bf1bb9 Tab complete > arguments 2019-10-10 19:45:25 -04:00
Tim Pope
c9cf1b3cb2 Make remaining buffer commands global 2019-10-02 14:40:38 -04:00
Tim Pope
621ffb087a Fix :'<,'>Gclog on some Vim versions
This was an attempt to get out in front of issues like
https://github.com/tpope/vim-scriptease/issues/43, but looks like it has
problems of its own.

Closes https://github.com/tpope/vim-fugitive/issues/1358
2019-09-30 19:07:04 -04:00
Tim Pope
ab26e9fdb3 Trigger User FugitiveChanged on events that change repository
Note that in the context of this event, Fugitive functions will use the
changed repository, which might not be the same as the current buffer's
repository.  Pass bufnr() as the optional dir argument to force the
current buffer.

Closes https://github.com/tpope/vim-fugitive/issues/458
2019-09-27 09:30:40 -04:00
Tim Pope
49287b6e87 Remove redundant autocommands 2019-09-05 16:42:39 -04:00
Tim Pope
ec918b9a79 Support blank buffers
Closes https://github.com/tpope/vim-fugitive/issues/1000
2019-09-05 15:46:27 -04:00
Teo Ljungberg
2d0df5842a Fix :Glog
`"<mods>"` was forgotten to be passed in during the refactoring in:
68da9a2
2019-09-04 15:54:36 -05:00
Tim Pope
1937bc3cd9 Experimental support for blank buffers 2019-09-04 15:22:28 -04:00
Tim Pope
40bc5aff18 Make universal maps global 2019-09-04 15:11:59 -04:00
Tim Pope
68da9a2be3 Make :Glog and :Ggrep global 2019-09-04 15:11:59 -04:00
Tim Pope
804957a3e6 Make :Gbrowse global 2019-09-04 15:11:59 -04:00
Tim Pope
cf88ce96c9 Make :Gmove and :Gremove global 2019-09-04 15:11:59 -04:00
Tim Pope
2464b0c29a Make :Gcd global 2019-09-04 15:11:59 -04:00
Tim Pope
99ad1a89fa Relocate 'path' adjustment
I'm not sure where we should do this (if at all), but after loading the
appropriate buffer (and thus applying the file type) is a better place
than during general activation.
2019-09-04 13:17:20 -04:00