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.
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
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
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.
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.
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.
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.
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
* 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.
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
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.
* Use custom format for :Gstatus, not literal git status output.
* Inline diffing in :Gstatus, with support for staging individual hunks.
* List unpushed and unpulled commits in :Gstatus.
* Show rebase status in :Gstatus.
* Greatly expanded set of mappings in :Gstatus. Try g?, c?, and r?.
* :Gstatus p (add --patch) is changed to P.
* :Gstatus U (checkout/clean) is changed to X. New U behavior is global reset.
* :Gstatus 2X/3X performs checkout --ours/--theirs.
* :Gstatus gI ignores file.
* Smarter :Gstatus automatic reload.
* :Git subcommand calls :Gsubcommand when appropriate.
* :Git add --patch and similar commands use :terminal.
* :Git diff, :Git log, and :Git --no-pager display results in temp buffer.
* :Git and subcommand wrappers use custom quoting rather than shell escaping.
* :Git ... ./path is relative to working directory.
* Add --option completion to :Git and git wrappers.
* Provide :G as wrapper for both :Gstatus and :Git.
* Support for :Grebase --interactive.
* :Gblame accepts all arguments, including filenames and commits.
* Support :Gblame --reverse to navigate forwards through history.
* Support :Gblame with range to blame subset of current file.
* Allow disabling dynamic blame colors with let g:fugitive_dynamic_colors = 0.
* :Glog opens quickfix list instead of displaying raw log output.
* Cleaner :Glog quickfix list leveraging Vim's new "module" format.
* :Glog no longer defaults to current file. Use :0Glog for that.
* :0Glog follows file across renames.
* :Glog name softly deprecated in favor of :Gclog (named after :cfile).
* Provide :Grevert.
* :Gdiff renamed to :Gdiffsplit.
* :Gdiffsplit always opens one window. Use :Gdiffsplit! for conflicts.
* Support git grep --column.
* Chdir with git -C rather than :cd for most commands. (Git 1.8.5 required)
* Show all stderr hook output on :Gcommit.
* Provide core.askPass default for Gpush and friends.
* Require bang to :Gwrite from index.
* Bug fixes.
* Polish.