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