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.
Use temp buffer for output of any command for which the Git
configuration option of pager.<command> is true. Avoid using a temp
buffer if the value is false, even for commands like "show" where we
normally would. If the configuration value is present and can't be
interpreted as a Boolean, punt to a :terminal where Git will invoke it
directly.
Generate and use custom config dictionary that includes -c values passed
to :Git. This enables `:Git -c pager.status status` to correctly use a
pager.
Paginate "config", "branch", and "tag" for certain argument lists,
matching the logic found in the Git source code as closely as possible.
These 3 commands were identified as having special pagination logic by
the presence of the DELAY_PAGER_CONFIG flag on their definitions in
git.c.
Paginate "am --show-current-patch".
References https://github.com/tpope/vim-fugitive/issues/1415
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.