Commit Graph

725 Commits

Author SHA1 Message Date
Tim Pope
5853cb0fc3 Tweak documentation for FugitiveResult() 2021-08-10 02:35:52 -04:00
Tim Pope
d1970112f4 Rename #Prepare to #ShellCommand
Shell commands are on their way out.  Let's start reclaiming this verb.
2021-08-10 00:35:17 -04:00
Tim Pope
dfae8191f4 Fix FugitiveIsGitDir() 2021-08-08 05:04:38 -04:00
Tim Pope
89c9f96d49 Fix FugitiveHead() for certain arities 2021-08-08 01:39:05 -04:00
Tim Pope
b8ba07f7d8 Improve flexibility of public API argument order
This allows tomfoolery like FugitiveConfig(dir)->FugitiveConfigGet(key).
I'm not sure I want to officially endorse this usage, but if nothing
else it makes interactive debugging a bit more fluid.
2021-08-08 00:48:27 -04:00
Tim Pope
f58ac20359 Generalize FugitiveIsGitDir() to check for buffer Git dir 2021-08-08 00:48:08 -04:00
Tim Pope
2ee6a48d0b Apply insteadOf to raw remote URLs in addition to remote names
This also retools FugitiveRemoteUrl() argument handling to be a bit more
flexible.
2021-08-07 15:51:07 -04:00
Tim Pope
7a087725ee Encourage FugitiveFind() over FugitiveGitDir() 2021-08-03 11:45:25 -04:00
Tim Pope
5f87622277 Add methods to config object
Do not rely on these.  The FugitiveConfigGet() family of functions
remains official, for now.
2021-07-26 12:04:52 -04:00
Tim Pope
d6edaf7a4d Document autocommands 2021-07-26 07:09:30 -04:00
Tim Pope
8820f3f89c Document FugitiveRemoteUrl() 2021-07-26 07:09:30 -04:00
Tim Pope
7ab4ab9796 Document FugitiveGitDir() 2021-07-26 07:09:30 -04:00
Tim Pope
295780c507 Tweak phrasing of FugitiveConfig() family documentation 2021-07-26 07:09:30 -04:00
Tim Pope
07b8277475 Move FugitiveHead() documentation to plugin file 2021-07-24 07:56:45 -04:00
Tim Pope
1c2663f516 Use :echomsg for deprecation warnings
Resolves: https://github.com/tpope/vim-fugitive/issues/1789
2021-07-12 15:56:27 -04:00
Tim Pope
3e2d531322 Fix error parsing worktree out of config
Resolves: https://github.com/tpope/vim-fugitive/issues/1788
2021-07-11 23:12:13 -04:00
Tim Pope
4cdeff8c33 Remove unnecessary -complete on command with no arguments
References https://github.com/vim/vim/pull/8544
2021-07-11 11:33:31 -04:00
Tim Pope
78d41a014e Don't abbreviate :vertical
Change the :Gvdiffsplit definition so that we're consistent with <mods>.
And make everything else consistent with that.
2021-07-10 17:49:17 -04:00
Tim Pope
957d962e06 Error when core.worktree expected but missing 2021-07-09 12:52:20 -04:00
Tim Pope
b498607aa7 Don't assume FugitiveGitDir() is actual directory
This is currently a valid assumption, but it boxes us in.  Instead use
fugitive#Find('.git/'), which is guaranteed to return a path to an
actual directory.

Also use fugitive#Find('.git/refs/..') to determine the common
directory.
2021-07-05 16:45:54 -04:00
Tim Pope
0ec3bb2bdd Use cwd to find Git repository for terminal window
Closes https://github.com/tpope/vim-fugitive/issues/1520
2021-07-05 16:45:54 -04:00
Tim Pope
ca0ff578ad Move config getter implementation into autoload file 2021-07-03 06:00:36 -04:00
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