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
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".
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.
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.
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
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.
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.
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
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
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
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.
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
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
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.
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.