1772 Commits
v2.1 ... master

Author SHA1 Message Date
Tim Pope
61b51c09b7 Fix race conditions generating sequencer sections
Resolves: https://github.com/tpope/vim-fugitive/issues/2411
2025-07-15 17:27:19 -04:00
Tim Pope
e0715fe729 Fix check for revert/cherry-pick
Undoing a bad search and replace in
4bc9d98993
2025-07-15 17:27:19 -04:00
Tim Pope
53d6ba99bc Remove unnecessary include guard 2025-07-15 17:27:19 -04:00
Josh Priddle
d3e2b58dec Fix GBrowse for newer Netrw versions
In vim/vim@ef92555 the arity of `netrw#BrowseX` changed from 2 to 1.
There is now a `netrw#os#Open()` function that can be used to open URLs
instead.
2025-07-11 20:18:39 -04:00
Tim Pope
593f831d6f Fix interpretation of :% when % is absolute
We're trying to support two different Git syntaxes here that were never
meant to be mixed.  We want :/foo/bar to be interpreted as the pathspec
:(top)foo/bar, but we want :% to be interpreted as the % file in the
index, even when % is /foo/bar.

Resolves: https://github.com/tpope/vim-fugitive/issues/2404
2025-06-19 14:33:59 -04:00
Tim Pope
4a745ea72f Remove antiquated a map
Resolves: https://github.com/tpope/vim-fugitive/issues/2380
2025-02-19 17:44:04 -05:00
Tim Pope
b068eaf1e6 Drop */# maps in visual mode
Resolves: https://github.com/tpope/vim-fugitive/issues/2374
2025-02-02 23:33:54 -05:00
Tim Pope
d74a7cff4c Add cW map as commit --fixup=reword:
References: https://github.com/tpope/vim-fugitive/pull/2369
2025-01-20 01:35:07 -05:00
Tim Pope
f4e8453ce7 Replace cA map with cn
Following Magit's lead.

References: https://github.com/tpope/vim-fugitive/pull/2369
2025-01-20 01:35:07 -05:00
Tim Pope
de42a732ee Fix help tag for g?
References: https://github.com/tpope/vim-fugitive/issues/2320
2025-01-20 01:21:42 -05:00
Tim Pope
174230d6a7 Make :GRename ./ and ../ respect parent dir of current file
References: https://github.com/tpope/vim-eunuch/issues/114
2024-12-29 02:29:26 -05:00
embedded
fcb4db52e7 Use netrw#Open if available (#2361) 2024-12-15 18:44:08 -05:00
Kevin Hwang
320b18fba2 Fix tab Gdiffsplit opening empty buffer 2024-11-19 12:16:44 -05:00
Tim Pope
d4877e54ce Use keepalt for diff maps
Resolves: https://github.com/tpope/vim-fugitive/issues/2336
2024-09-06 21:00:15 -04:00
Julio B
1d18c696c4 Disable modelines for status buffers
Regression introduced in 8c8cdf4405.
Resolves: https://github.com/tpope/vim-fugitive/issues/2333
2024-09-02 14:43:35 -04:00
Tim Pope
0444df68cd Use nvim vim.ui.open as a fallback
Resolves: https://github.com/tpope/vim-fugitive/pull/2322
2024-07-18 19:59:03 -04:00
Tim Pope
8c8cdf4405 Use callback based workflow for status buffer 2024-07-05 12:04:03 -04:00
David Briscoe
5661dea7be Format the full body instead of separating title
Fix #2315: Gedit strips newlines when commit lacks a blank line

%B is the "raw body (unwrapped subject and body)". Since we're
displaying both, we can use that to avoid any changes to the message
content. %B was added to git in 1.7.2 (2010) in commit
1367b12ad623e28546ba40c435015d94e7fbb248, and fugitive requires 1.8.5 so
it's safe to use.
2024-07-05 11:59:21 -04:00
Tim Pope
d0c1a43753 Clarify dq behavior
Resolves: https://github.com/tpope/vim-fugitive/issues/2196
2024-06-25 22:34:34 -04:00
Tim Pope
64d6cafb9d Rearrange :Git documentation
Resolves: https://github.com/tpope/vim-fugitive/issues/2314
2024-06-12 12:59:20 -04:00
Tim Pope
4f59455d23 Use rev-parse to get abbrev length for status buffer 2024-05-19 10:52:16 -04:00
Tim Pope
7493b78e6b Fix :Git difftool without -y
Resolves: https://github.com/tpope/vim-fugitive/issues/2307
2024-05-19 10:52:16 -04:00
Tim Pope
09ffa8fc08 Fix :Git difftool -y
Resolves: https://github.com/tpope/vim-fugitive/issues/2306
2024-05-19 00:37:06 -04:00
Tim Pope
5a9bd42dd8 Make push map available on P
I think matching the Magit interface is probably a better use of P than
wrapping --patch.  As a baby step in that direction, allow P to invoke
the same experimental behavior as "s" or "-".
2024-05-17 16:10:36 -04:00
Tim Pope
a0b0c1ddc1 Normalize path before quoting it 2024-05-17 14:01:06 -04:00
Tim Pope
10fb874d7e Filter out bold/underline typesetting in man output
Resolves: https://github.com/tpope/vim-fugitive/issues/2300
2024-05-17 13:16:03 -04:00
Tim Pope
110e7ca00c Ignore missing ssh include files 2024-05-15 12:46:29 -04:00
Tim Pope
19ca61c78c Support ~ in ssh config include
Resolves: https://github.com/tpope/vim-rhubarb/issues/79
2024-05-15 12:44:27 -04:00
lakshayg
5b0347b523 Fix syntax error in autoload/fugitive.vim
The error was introduced in ed9e21fb9b
2024-05-15 02:12:36 -04:00
Tim Pope
ed9e21fb9b Support :Git difftool --check
Resolves: https://github.com/tpope/vim-fugitive/issues/2303
2024-05-14 23:46:05 -04:00
Tim Pope
ce882460cf Support Git flags inside of aliases
Resolves: https://github.com/tpope/vim-fugitive/issues/2298
2024-05-01 18:17:05 -04:00
Yida Zhang
dac8e5c2d8 Fix TempReadPost returning 0 2024-04-08 01:40:26 -04:00
Tim Pope
c0b03f1cac Restore winfixbuf consideration in status blur
The revert in a83135b55b was a bit too
aggressive.  We can support winfixbuf being set on the status buffer
without setting it ourselves.
2024-03-31 16:12:45 -04:00
Tim Pope
a83135b55b Revert "Set winfixbuf on status windows"
This reverts commit 8d4e8d4538.  Once the
dust has settled I'll reconsider.

References: https://github.com/tpope/vim-fugitive/issues/2272
References: https://github.com/tpope/vim-fugitive/discussions/2275
References: https://github.com/tpope/vim-fugitive/issues/2276
References: https://github.com/tpope/vim-fugitive/issues/2278
References: https://github.com/tpope/vim-fugitive/issues/2282
References: https://github.com/tpope/vim-fugitive/issues/2286
2024-03-28 16:43:46 -04:00
Tim Pope
2377e16e66 Fix misfire of User FugitivePager
Resolves: https://github.com/tpope/vim-fugitive/issues/2283
2024-03-26 14:15:09 -04:00
Yifan Hu
193ba9b393 Fix typo for advice.statusHints 2024-03-21 10:17:05 -07:00
Tim Pope
8d4e8d4538 Set winfixbuf on status windows
Resolves: https://github.com/tpope/vim-fugitive/issues/2272
2024-03-16 12:42:25 -04:00
Tim Pope
549e283d15 Set winfixbuf on blame windows
References: https://github.com/tpope/vim-fugitive/issues/2272
2024-03-16 12:37:29 -04:00
Tim Pope
fe4ba848ba Avoid reuse of winfixbuf windows
References: https://github.com/tpope/vim-fugitive/issues/2272
2024-03-16 12:35:36 -04:00
Tim Pope
41beedabc7 For push map, never push to fetch remote
There are legitimate reasons to push to the fetch remote, but making it
possible from the push map makes it too easy to do by default.
2024-03-03 19:57:59 -05:00
Tim Pope
ded6eb9da3 Use fewer buffer variables for status buffer 2024-03-02 14:35:07 -05:00
Tim Pope
eedb203ba7 Introduce stat.push and stat.merge 2024-03-02 14:19:32 -05:00
Tim Pope
840ce4a9d9 Move push_remote and fetch_remote into stat 2024-03-02 13:53:14 -05:00
Tim Pope
16ffd9623e Move pull_type into stat 2024-03-02 13:50:23 -05:00
Tim Pope
85eef8003e Don't assume default value for branch.*.merge
Commands like git-merge and git-pull seem not to make this assumption,
so neither should we.
2024-03-02 13:50:21 -05:00
Tim Pope
2e88f14a58 Avoid settabvar()
Still seeing ml_get errors on older Vim.  I give up.

Resolves: https://github.com/tpope/vim-fugitive/pull/2262
2024-02-24 14:01:27 -05:00
Tim Pope
69687f28d4 Move props into stat 2024-02-18 01:09:49 -05:00
Tim Pope
4bc9d98993 Replace status buffer contents atomically 2024-02-18 01:08:14 -05:00
Tim Pope
011cf4fcb9 Give status exec result variable a clearer name 2024-02-11 21:57:03 -05:00
Tim Pope
801b0417a5 Fix shortened :call command 2024-02-11 21:57:03 -05:00
Tim Pope
9f92ff14d9 Update tabpagenr('#') version constraint to fix ml_get error
References: https://github.com/tpope/vim-fugitive/pull/2262
2024-02-11 20:53:40 -05:00
Tim Pope
2a388ef5ba Allow for numeric tab argument in <mods>
Support was added in Vim 9.0.0786.
2024-02-11 20:06:40 -05:00
Tim Pope
ddedd5bd20 Add corresponding nvim check for tabpagenr('#') 2024-02-11 16:13:25 -05:00
Tim Pope
8376227c9d Avoid tabpagenr('#') on Vim versions without it
References: https://github.com/tpope/vim-fugitive/pull/2262
2024-02-11 12:32:23 -05:00
Tim Pope
e3cdf27e19 Remove error handler from status BufReadCmd
The only error that should be possible here now is the version check, so
do that explicitly instead.
2024-02-10 19:46:54 -05:00
Tim Pope
3d9cace1ff Reorder status BufReadCmd
Put all the stuff that actually updates the buffer together, so we can
soft reload without triggering autocommands or doing redundant work.

The reason for the previous ordering was to allow a bit of parallelism
while the diff commands ran in the background.  Let's try to preserve
that for map definitions by running them in parallel to the status
command instead.

I'm not sure why 'nomodifiable' was set after BufReadPost.  Let's try
the more natural ordering and see if anything breaks.
2024-02-10 16:28:13 -05:00
Tim Pope
41ef77c058 Defer initializing b:fugitive_files until rendering status 2024-02-10 16:28:13 -05:00
Tim Pope
fab00f7c0f Always use absolute path for :Ggrep quickfix list
Ran into an issue where a running Vim (Neovim 0.9.5) consistently
treated a relative path not as the file in the current directory, but as
a different open buffer that matched the file name.  The relative path
was just for cosmetics; let's switch to absolute so Vim doesn't butcher
it.
2024-02-08 14:08:06 -05:00
Luke Davis
e7bf502a6a Avoid resetting 'last accessed tab' status 2024-02-02 11:57:28 -05:00
Alex Klapheke
f116dcc8e2 Fix misaligned output of :G blame -s
Due to a regex not capturing (and concealing) all the spaces behind
the current file's line numbers, the close parentheses after the line
numbers are misaligned, and the blame buffer is made too wide.
2024-01-27 14:36:55 -05:00
Tim Pope
854a8df0d0 Support edit script when temp dir name contains space
Looks like GIT_EDITOR supports quotes now.

Resolves: https://github.com/tpope/vim-fugitive/issues/2255
2024-01-19 18:01:25 -05:00
Tim Pope
ec8f7eed10 Fix handling of Include in SSH config
The Include directive behaves very literally.  The old implementation
assumed a level of encapsulation that just doesn't match the actual
implementation.
2024-01-17 18:49:30 -05:00
Tim Pope
ac673f1e08 Relay stdin in s:StdoutFile() on Vim 7
Resolves: https://github.com/tpope/vim-fugitive/issues/2254
2024-01-17 18:48:07 -05:00
Tim Pope
c4a38c92dc Return first, not last, value for FugitiveConfigGet() 2024-01-17 18:33:54 -05:00
Tim Pope
2c999d4a69 Fix write to index on Vim 7
Resolves: https://github.com/tpope/vim-fugitive/issues/2254
2024-01-17 18:25:41 -05:00
Gregory Anders
5965909358 Buffer output when using the pager
As of 10ed587f65 all output is captured to
a temp file before being displayed. When the output is not buffered, the
stdout/stderr callback is called to perform post-processing for each
output chunk. Instead, buffer all output and perform the post-processing
all at once.

This results in a substantial performance improvement for repositories
with many commits.
2023-12-15 18:17:17 -05:00
Tim Pope
46eaf8918b Fix variable scope 2023-10-29 13:00:04 -04:00
Tim Pope
df36d194ce Prototype "reverse :GBrowse"
Use `:Gedit https://github.com/...` (or any other URL supported by an
installed :GBrowse provider) to edit the corresponding `fugitive://`
URL.  The dictionary g:fugitive_url_origins maps between homepage URLs
and local repositories:

	let g:fugitive_url_origins = {
	      'https://github.com/me/my-repo': '~/Projects/my-repo'}

It also checks the remotes of the repository that the currently edited
buffer belongs to.

This is an experimental prototype.  That means no documentation, and no
guarantees about behavior.  In particular, g:fugitive_url_origins and
the current contortions to leverage the existing :GBrowse API will
likely be dropped once a better API has been developed.

References: https://github.com/tpope/vim-fugitive/issues/2223
2023-10-09 20:53:12 -04:00
Tim Pope
cbe9dfa162 Salvage :Ggrep ... commit:path/
Resolves: https://github.com/tpope/vim-fugitive/issues/2224
2023-10-09 20:53:12 -04:00
Tim Pope
f6ec378d1d Decouple running git-status from parsing output 2023-09-27 20:50:43 -04:00
Tim Pope
99db68d9b3 Handle status diff file arguments more rigorously 2023-09-18 11:19:09 -04:00
Tim Pope
b9cf6ad994 Avoid implicit repository when rendering status buffer
Enable this code to run asynchronously by removing any assumptions about
the current buffer.
2023-09-18 11:19:09 -04:00
Tim Pope
7679842b90 Only diff known changed files for status
This should improve performance on large repositories.

References: https://github.com/tpope/vim-fugitive/issues/2207
2023-09-17 21:11:14 -04:00
Tim Pope
86a372d8c3 Respect GIT_INDEX_FILE when diffing for status buffer 2023-09-17 21:11:14 -04:00
Tim Pope
f2133ca50b Expire cached blank Git dir on active Fugitive invocation
Resolves: https://github.com/tpope/vim-fugitive/issues/2213
2023-09-17 21:11:14 -04:00
Tim Pope
7e72fb9cde Decouple s:DirCheck() from s:VersionCheck() 2023-09-17 19:21:30 -04:00
Tim Pope
2e6cf7287c Don't bother with sleep!
Neovim doesn't properly support this.  I guess the regular behavior is
*fine*.
2023-09-17 19:21:30 -04:00
Tim Pope
b4bb0c27f1 Close stdin for nvim jobs, to match vim 2023-09-17 19:21:30 -04:00
Tim Pope
6fcb0ad039 Fix p map in blame buffers
Resolves: https://github.com/tpope/vim-fugitive/issues/2211
2023-09-08 16:21:16 -04:00
Tim Pope
ba0b3163ca Avoid double reload of status window triggered by BufEnter
The second reload was short-circuited by a reltime() check, so no big
deal, but it does get in the way when trying to make the reload
conditional.

References: https://github.com/tpope/vim-fugitive/issues/2207
2023-09-07 16:44:12 -04:00
Tim Pope
c7333f63e7 Clean up optional arguments around status reload
Best I can tell the ability to pass a line number or tab number argument
has never been used.

Cleaning this up in anticipating of adding actually useful arguments,
and in anticipation of that, I'm preemptively making ReloadWinStatus()
blindly relay any arguments to ReloadStatusBuffer().

References: https://github.com/tpope/vim-fugitive/issues/2207
2023-09-07 16:44:12 -04:00
Tim Pope
d4914b361b Discourage use of P and ~ in blame window.
Since 09908d82ef, I've been getting a
parade of issues and PRs about "missing" documentation.

Resolves: https://github.com/tpope/vim-fugitive/pull/2210
References: https://github.com/tpope/vim-fugitive/issues/2070
2023-09-06 14:33:40 -04:00
Tim Pope
f71fb99360 Clarify behavior of :G summary window
Resolves: https://github.com/tpope/vim-fugitive/issues/2192
2023-09-03 15:27:15 -04:00
Tim Pope
572c851012 Never jump to invalid entry after quickfix command
In particular, if the first :Ggrep result is a binary file, skip over
it.  I'm also leaning strongly towards not filling in the filename field
at all for binary files, but I'll address that separately.
2023-08-27 15:39:21 -04:00
Tim Pope
b3b838d690 Show current revert/cherry-pick in status buffer
Resolves: https://github.com/tpope/vim-fugitive/issues/2175
2023-07-04 17:44:53 -04:00
Tim Pope
43f18ab915 Support netrw buffers with blank buffer names
Resolves: https://github.com/tpope/vim-fugitive/pull/2179
2023-06-12 19:27:31 -04:00
David Briscoe
5f0d280b51 Always fire BufReadStatus's autocmd
Fix #2161.

Always execute BufReadStatus's return value because that's the code that
fires the FugitiveIndex autocmd.
2023-04-28 23:23:46 -04:00
Tim Pope
e6651a79fa Allow ftplugin maps to override historical buffer maps
Resolves: https://github.com/tpope/vim-fugitive/issues/2151
2023-04-14 15:14:03 -04:00
Tim Pope
ef99f1d90c Support :GBrowse with paths outside current repo
Resolves: https://github.com/tpope/vim-fugitive/issues/2144
2023-03-30 11:01:58 -04:00
Tim Pope
9acbad1335 Try harder to match diff headers with ambiguous spacing
Resolves: https://github.com/tpope/vim-fugitive/issues/2135
2023-03-25 04:58:39 -04:00
Tim Pope
309c68117e Restore status commit lists for "." remote
Resolves: https://github.com/tpope/vim-fugitive/issues/2137
2023-03-23 07:43:56 -04:00
Tim Pope
66e8d19f89 Document czs
References: https://github.com/tpope/vim-fugitive/issues/1941
2023-03-22 02:52:30 -04:00
Tim Pope
8ad2b96cdf Guard against missing win_id2win on Vim 7.4
Resolves: https://github.com/tpope/vim-fugitive/issues/2136
2023-03-21 10:33:14 -04:00
Tim Pope
5b52a0f395 Provide default merge head for "." remote
Almost included this in f75dbb1967, but
dropped it because it always equal to the current branch, guaranteeing
an empty log, and because unlike the "origin" default, it shouldn't
really happen in practice.  However if a user screws up their config in
a way that forces it to happen, we should still try to avoid the same
"Push" header issue.
2023-03-09 14:20:42 -05:00
Karl Yngve Lervåg
d4941aec93 Use the dir variable in fugitive#Head 2023-03-09 11:55:42 -05:00
Tim Pope
82a9af133c Reject remotes without appropriate push/fetch key
Verifying by URL is insufficient, as git clone --bare will create a
remote with a URL but not a fetch key, resulting in no refs in
refs/remotes/.

Resolves: https://github.com/tpope/vim-fugitive/issues/2129
2023-03-07 19:11:04 -05:00
Tim Pope
13ed146694 Fix duplicate "Unpulled" section when push and pull match 2023-03-07 19:07:28 -05:00
Tim Pope
9b72d0c7c8 Don't default to origin remote in bare repos
Resolves: https://github.com/tpope/vim-fugitive/issues/2129
2023-03-07 14:57:08 -05:00
Tim Pope
f75dbb1967 Default pull ref to branch of same name
If we defaulted branch.x.remote to "origin", then we should also default
branch.x.merge to the obvious choice.  Otherwise we can end up in the
situation of a push ref without a pull ref, which leads to a rather
confusing "Push" header without a "Merge"/"Rebase" header.

References: https://github.com/tpope/vim-fugitive/issues/2129
2023-03-07 14:57:08 -05:00
yasuda
c9c08ff9ef Fix dropped quote of entries 2023-03-06 22:03:53 -05:00
Tim Pope
01964fa859 When push ref is missing, show unpushed upstream commits instead
This is a lie, but it matches what I (and probably most people) expect
to happen.
2023-03-06 20:34:16 -05:00
Tim Pope
d5758be511 Refactor retrieval of push/pull refs in status buffer, again
My last attempt at this gave up and combined retrieving the list of
commits and rendering the list of commits into a single function.  This
restores that distinction, albeit with a different approach, as I now
aim to use the same list of commits twice, in some circumstances.
2023-03-06 20:34:16 -05:00
Tim Pope
caf1bc99b6 Fall back to "Unpushed to *" when no upstream head is found
This allows local history to be shown before the initial push to a brand
new repository.

References: https://github.com/tpope/vim-fugitive/issues/2106
2023-03-05 20:02:07 -05:00
Tim Pope
b265dba99a Retool retrieval of push/pull refs in status buffer
This is mostly a refactor, but it fixes a bug where we could end up with
a push ref but not a pull ref when the underlying remote didn't exist,
resulting in a "Push:" header but not a "Pull:" header, which is
nonsensical.  This changes it to produce a "Pull:" header but not a
"Push:" header, which is arguably still incorrect, but at least makes
logical sense.
2023-03-05 20:02:07 -05:00
Tim Pope
891b0a92fe Don't show "Unpushed to *" if no remotes
If there are no remotes, then this section will always contain the
entire branch history, or a truncated version thereof.  I want all
sections to be meaningfully bounded.
2023-03-05 20:02:07 -05:00
Tim Pope
fa33145cc1 Make commit/rebase maps available in blame buffers
Resolves: https://github.com/tpope/vim-fugitive/issues/2035
2023-03-02 19:36:21 -05:00
Tim Pope
bba8d1beb3 Avoid narrow :Git subcommand splits in blame windows
If commit maps are to made available in blame buffers, then the existing
behavior of editing the commit message in a horizontal split of a narrow
window isn't going to cut it.  My ideal solution would be to create a
split that spans both the blame buffer and the original file, but I
don't think there's a practical way to do that, so I've instead settled
for using :topleft/:botright instead, as appropriate.  The other natural
solution would be to switch to the original file and split there, but
that means we'd end up with a scroll-bound window with a mismatched
height, which behaves exactly as poorly as you would expect.

Furthermore, I've made the decision to extend this behavior to paginated
output windows (e.g., `:Git log`), but *not* to other window creation
commands like :Gsplit.

References: https://github.com/tpope/vim-fugitive/issues/2035
2023-03-01 23:07:06 -05:00
Tim Pope
e5f9fda842 Tighten matches for URL buffer names 2023-03-01 16:42:10 -05:00
Tim Pope
b54ee90d56 Avoid blurring status when :Gedit argument parsing throws an error 2023-03-01 16:42:10 -05:00
Tim Pope
d507d00bd0 Drop g:fugitive_defer_to_existing_maps
This doesn't actually work correctly as in a few places we deliberately
override a map.  I'll accept a PR to bring it back, but it will need to
fix said issues.  Until then, unmapping undesired maps is the
recommended solution.
2023-02-27 21:52:52 -05:00
Tim Pope
ad2dcd628a Undo inadvertent revert
This reverts commit dd538bb046.
2023-02-27 21:08:30 -05:00
Tim Pope
dd538bb046 Fix typo 2023-02-27 20:49:41 -05:00
Tim Pope
853ec6f58d Focus correct window after gq in :Git blame
Resolves: https://github.com/tpope/vim-fugitive/issues/770
2023-02-27 20:47:22 -05:00
Ben Morgan
62f42f013d Fix Gdelete error message 2023-02-09 16:44:40 -05:00
Tim Pope
2019e0e413 Support folding sections
Resolves: https://github.com/tpope/vim-fugitive/issues/2111
References: https://github.com/tpope/vim-fugitive/issues/1317
2023-02-05 18:40:33 -05:00
Tim Pope
2febbe1f00 Make statusline redraw less aggressive
Mainly trying to avoid tainting `:verbose set readonly?`.
2023-01-16 22:04:38 -05:00
Tim Pope
9b50074e44 Better error message when :GBrowse remote not found
Resolves: https://github.com/tpope/vim-fugitive/issues/2103
2023-01-16 22:04:38 -05:00
Tim Pope
9c5f675db5 Allow PTY for paginated shortlog, to prevent stdin read
This workaround only works where PTY jobs are supported.  The real fix
is to give an explicit argument: `:Git shortlog HEAD`.

Resolves: https://github.com/tpope/vim-fugitive/issues/2100
2023-01-11 20:22:15 -05:00
Tim Pope
99cdb88bc6 Improve horizontal scrolling performance of :Git blame
References: https://github.com/tpope/vim-sensible/pull/124
2022-12-30 00:44:37 -05:00
Maksim Odnoletkov
5b0b138483 Fix parsing of diff hunk headers with omitted length
7dd76231e6 made the comma and the second
number required in a line range. But they can be omitted, for example:

* Adding a single line file:

    @@ -0,0 +1 @@

* Modifying a single line file:

    @@ -1 +1 @@
2022-12-02 06:51:11 -05:00
Eric Milford
49cc58573e Tighten match for commit under cursor
Using `coo` to open a branch under the cursor that started with 4+ hex
digits (e.g., 1111-feat) would fail with the error `fatal: invalid
reference: 1111.`

This happened because the prior regex would consider these branch names
as commits when determining whether to treat what was under the cursor
as a branch or commit.

This changes the regex to use a negative look-ahead to further tighten
the match for a commit and require that a match on 4+ hex digits also
not end with a non-hex digit.

Resolves #2085.
2022-11-23 13:57:13 -05:00
Zhizhen He
23b9b9b2a3 Fix typo 2022-11-16 07:28:20 -05:00
Ernst Widerberg
362201bce5 Fix typo 2022-11-15 04:53:25 -05:00
Tim Pope
01f3e0af92 Account for escaping differences when expanding on win32
The core issue here is that on UNIX, fnameescape() always doubles
backslashes, while on Windows, it leaves them be.  But it's a lot more
complicated than that, because Vim also avoids escaping other
characters, to minimize ambiguity.  This can mostly be compensated for
by removing the corresponding characters from s:fnameescape, including
backslash itself.  I'm a little worried that removing backslash will
have other implications, so keep an eye out for regressions here.

One character we can't remove is "!", because we need a way to escape
our own "the commit owning the current file" syntax.  As a long term
strategy to address this, I'm introducing new !% and !# variations to
replace it.  This is a bit on the ugly side, so I'm going to hold off on
committing to it as a documented interface until I've had more time to
muse on alternatives.

See also 6356bbc4a7, wherein I fixed a bug
with the exact same description.  This suggests a change in Vim prompted
this new variation, but then again, there's no proof that I actually
tested my fix on Windows.

Resolves: https://github.com/tpope/vim-fugitive/issues/2071
2022-11-01 00:04:08 -04:00
Tim Pope
09908d82ef Remove ~ and P maps from blame documentation
These maps are not nearly as useful as they seem.  Let's avoid tempting
newcomers to use them.  I recommend to instead use <CR>, which shows the
change in context.

References: https://github.com/tpope/vim-fugitive/issues/2070
2022-10-31 15:28:49 -04:00
Tim Pope
dd8107cabf Avoid invalid glob during tab complete
Resolves: https://github.com/tpope/vim-fugitive/issues/2050
2022-09-04 05:38:13 -04:00
Tim Pope
b411b753f8 Add deprecation warning on editing .git/index 2022-08-17 10:20:51 -04:00
Tim Pope
9fcac5b380 Fix broken blame maps
This was accidentally mapping `0` or `1` instead.

Switch to :exe while we're at it.

Resolves: https://github.com/tpope/vim-fugitive/issues/2031
2022-08-17 10:20:35 -04:00
Tim Pope
3485e22a0a Restore popular fugitive#repo() functions
I'm quite eager to kill the "chomp" functions, as they're the last use
of system().  However, the successor, FugitiveExecute(),  is only a year
old, and isn't a drop-in replacement.  So let's bring them back for
awhile to avoid the need for a massive conditional to give backwards
compatibility.

The rest are pretty benign to support, so I guess they can stick around
until the band-aid is officially ripped off.
2022-08-02 13:48:01 -04:00
Tim Pope
66a921bbe3 Consistently handle missing command jobs across platforms
* On UNIX, jobs proceed normally, and exit with status 122.
* On Windows, jobs fail early, and no callbacks run.
* On Neovim, an exception is thrown.

Normalize the second and third cases to behave like the first, as that
was my assumed behavior during the initial implementation.

References: https://github.com/tpope/vim-fugitive/issues/1815
2022-07-28 08:52:00 -04:00
Tim Pope
23570688d2 Drop g:fugitive_legacy_quoting 2022-07-28 08:52:00 -04:00
Tim Pope
6955915af5 Account for ch_status() == 'fail'
References: https://github.com/tpope/vim-fugitive/issues/1815
2022-07-27 07:18:42 -04:00
Tim Pope
9a13fc87c4 Move status buffer to fugitive:// URL
Having already implemented this for better symlink support, we may as
well leverage it to phase out the "index" path leaky abstraction.
2022-07-22 01:45:41 -04:00
yut23
23b321b740 Fix backward navigation from the middle of a line
Ensure backward searches don't match the current line. This shows up
more in neovim, which sets 'nostartofline' by default.
2022-07-21 22:45:56 -04:00
yut23
4e11f9dabf Fix [c from the first hunk of a file
This makes the rest of the function operate on the previous file rather
than the file of the hunk under the cursor.
2022-07-21 22:45:56 -04:00
Tim Pope
d84582d5f7 Drop URL encoding workaround from :GBrowse API
No longer necessary as all known providers handle URL encoding
correctly.

References: https://github.com/cedarbaum/fugitive-azure-devops.vim/issues/3
2022-07-18 16:19:49 -04:00
Tim Pope
ff04324bff Don't use "~" for in-band signaling in :GBrowse API
I figured "~" was unlikely to have legitimate uses, but it turns out
sourcehut uses it to prefix usernames in all of its URLs.  Let's go with
a control character instead.

Resolves: https://github.com/tpope/vim-fugitive/issues/2021
2022-07-08 02:44:51 -04:00
Tim Pope
32b61c1665 URL encode "=" 2022-07-08 00:58:02 -04:00
Tim Pope
b8c5128f89 Fix automatic status reload when at fugitive:// URL 2022-07-08 00:47:00 -04:00
Tim Pope
f809dde0e7 Use URL encoding for Fugitive URLs
This makes them conform to whatever the RFC for URLs is.
2022-06-29 21:06:46 -04:00
Tim Pope
8fd6bad4a4 Handle URL-unsafe characters in :GBrowse API
Of the 8 :GBrowse providers listed in the README, 7 make no attempt to
handle URL encoding.  So it makes sense for Fugitive to take
responsibility for this.  By transposing "%" and "~" in API parameters
and then reversing the process on the generated URL, we can accommodate
both usages.  This is transitional and will later be ditched in favor of
straightforward URL encoding.

References: https://github.com/cedarbaum/fugitive-azure-devops.vim/issues/3
2022-06-29 15:50:16 -04:00
Tim Pope
224b65ef58 URL decode FugitiveRemote().path and .user
This is technically backwards incompatible, but I've never seen a remote
with URL encoding in practice.  (Also I don't think anyone is actually
using this function.)  One can use .pathname if they need the encoded
version.
2022-06-29 14:20:57 -04:00
Tim Pope
f0acd25d45 Accept multiple arguments to :Gdrop, like :drop 2022-06-29 14:20:56 -04:00
Tim Pope
69ead802d7 Don't default :Gedit to cwd in empty window 2022-06-28 15:39:18 -04:00
Tim Pope
09dfed092a Use forward slashes for non-Fugitive URLs on win32
Might do this for everything but let's start here.  I initially went
with backslashes for URLs because that's how Vim on win32 normalizes
buffer names, and figured it might simplify things like equality checks.
But Vim itself breaks in some places.  Editing a `file://` URL doesn't
work if backslashes are in use, and Vim unescapes incorrectly when
constructing <q-args> (see 6356bbc4a7).
2022-06-27 01:05:06 -04:00
Tim Pope
ecc5e8fa40 Tease apart :Gedit argument parsing and expansion 2022-06-26 21:38:01 -04:00
Tim Pope
c545a7d451 Correctly handle :Gedit + +SecondCommand 2022-06-26 21:38:01 -04:00
Tim Pope
47cbfc00cc Reject invalid URLs from GBrowse providers 2022-06-26 17:28:20 -04:00
Tim Pope
e80c460e48 Fix misc errors on Vim 7.4 2022-06-26 17:28:20 -04:00
Tim Pope
36b80c190c Remove inadvertent dict function flag 2022-06-26 16:59:59 -04:00
Tim Pope
87b3891c77 Encapsulate appending relative path to Fugitive URL
This gives us a central place to add URL encoding
2022-06-26 16:47:32 -04:00
Tim Pope
e7a33baccc Sync up win32 and UNIX fugitive:// regexps
Remove support for an optional second slash delimiter that was
accidentally committed in the previous win32 change.
2022-06-26 15:53:23 -04:00
Tim Pope
0bd3885169 Fix match of fugitive:////unchost/path// on win32 2022-06-26 15:41:23 -04:00
Tim Pope
9af6de1668 Use fugitive:///c:/ instead of fugitive://c:/ on win32
This avoids a bogus use of the host field in a standard URL and matches
how file:// URLs work.
2022-06-26 15:24:12 -04:00
Jaehwang Jung
00cc23868a Don't silence cmap 2022-06-25 14:55:04 -04:00
Tim Pope
33a7cdf213 Fix FugitiveExtractGitDir() with dict argument
Resolves: https://github.com/tpope/vim-fugitive/issues/2018
2022-06-24 17:00:33 -04:00
Tim Pope
80cd9c876e Move FugitiveParse() implementation into autoload file
Anticipating changes here, so let's try to avoid the dreaded "old plugin
file loads new autoload file" edge case burning us.
2022-06-23 18:09:40 -04:00
Tim Pope
8165eada59 Fix Projectionist root for .git/info/projections.json 2022-06-23 17:55:27 -04:00
Tim Pope
eac5ffd35b Don't reuse status window for :Gdrop 2022-06-23 14:41:20 -04:00
Tim Pope
aafbdf84cd Look for "fugitive_dir" as dictionary key
Work trees and submodules have two things that could be called the Git
dir: the directory itself, and the ".git" at the root of the work tree.
Introduce "fugitive_dir" as our name for the one we consider canonical.
2022-06-22 12:30:47 -04:00
Tim Pope
8b39d29d94 Rework ref handing in :GBrowse
This is still a garbage fire, but at least now the use of `.git/refs/`
paths has been relegated to the public interface.  This also fixes a lot
of quirks, and hopefully doesn't introduce too many new ones.
2022-06-19 09:42:26 -04:00
Tim Pope
3fd2c21ee0 DWIM for :GBrowse remote-name
Previously I had worried about the ambiguity this would produce, but
that can be resolved by calling `:GBrowse remote-name/HEAD`.
2022-06-18 23:05:27 -04:00
Tim Pope
a95f1c11ad Remove redundant URL escaping in :GBrowse
See b42f95c0c2.
2022-06-18 23:05:27 -04:00
Tim Pope
a337eb5114 Compute correct line numbers in blame buffer 2022-06-18 10:28:37 -04:00
Tim Pope
9ea1f43a6a Delete temp files created computing :GBrowse line numbers 2022-06-18 00:33:00 -04:00
Tim Pope
763f42cab5 Simplify conditional around :GBrowse line number computation
This is solely to improve the readability of upcoming diffs.
2022-06-18 00:33:00 -04:00
Tim Pope
bef885fd00 Fix :GBrowse in :Git blame window 2022-06-18 00:33:00 -04:00
Tim Pope
1aefa1aed2 Cope gracefully with missing .git/index 2022-06-17 13:17:43 -04:00
Tim Pope
abe29d4891 Restore .git_dir on fugitive#repo()
This will enable functions like FugitiveFind() to use fugitive#repo() as
the optional second parameter, which should make transitioning to the
new API a bit easier to do incrementally.
2022-06-17 13:17:43 -04:00
Tim Pope
9fadd7a778 Provide :Gdrop 2022-06-16 09:41:34 -04:00
Tim Pope
acee967384 Remove :Gcommit family of error stubs 2022-06-16 09:41:34 -04:00
Tim Pope
7dd76231e6 Extract helper to determine position in diff hunk
References: https://github.com/tpope/vim-fugitive/issues/1171
2022-06-16 09:29:01 -04:00
Tim Pope
6ae79e75a4 Handle quoted filenames in diff --git headers 2022-06-15 08:19:23 -04:00
Tim Pope
3f5975e906 Include "\ No newline at end of file" in status buffer 2022-06-14 14:15:47 -04:00
Tim Pope
d9059413e2 Fix inconsistent whitespace matching in regexps
The \s and \S atoms consider space and tabs to be the only valid
whitespace characters, while the [:space:] character class also includes
control characters like newline and form feed.
2022-06-14 13:20:17 -04:00
Tim Pope
0996bae836 Partially support ".git" files and symlinks without core.worktree
This is not and can never be 100% perfect.  There's no way to work back
from a file like info/exclude COMMIT_EDITMSG to the work tree.  So
core.worktree continues to be recommended.

References: https://github.com/tpope/vim-fugitive/issues/1920
2022-06-13 12:15:48 -04:00
Tim Pope
d72fbcb0a4 Loosen autocommand patterns for fugitive:// URLs
Allow for potential upcoming changes to the format.
2022-06-13 10:09:36 -04:00
Tim Pope
d002715084 Optimize inline expansion for large diffs
Resolves: https://github.com/tpope/vim-fugitive/issues/2011
2022-06-13 10:09:36 -04:00
Tim Pope
0680c3ae3c Remove last vestiges of :Gread! 2022-06-13 07:13:34 -04:00
Tim Pope
8c63ac0f2f Fix error message on fugitive#repo().config() 2022-06-13 07:13:34 -04:00
Tim Pope
b42f95c0c2 DWIM for % and # in URL argument 2022-06-13 07:13:34 -04:00
Tim Pope
020802475c Add error stubs for old fugitive#repo() object
This is still used in the wild, so provide error messages to aid in
transitioning.
2022-06-12 12:47:36 -04:00
Tim Pope
535389b9a6 Improve performance of FugitiveStatusline()
Avoiding fugitive#Find() saves a millisecond or 2.  Not a big deal but
still worth avoiding given how often this function is called.
2022-06-11 09:32:50 -04:00
Tim Pope
d1d485cdef Leverage FugitiveActualDir() abstraction 2022-06-11 09:32:50 -04:00
Tim Pope
8378b329b8 Drop obsolete public functions 2022-06-07 05:40:49 -04:00
Tim Pope
92c73bb050 Set b:git_dir in FugitiveEditor buffers
This should make us a bit more robust in the face of things like
symlinks.
2022-06-07 05:40:49 -04:00
Tim Pope
1d6e601298 Extract helper to initialize b:git_dir 2022-06-07 05:40:49 -04:00
Tim Pope
118e9de937 Define global <Plug> maps regardless of g:fugitive_no_maps 2022-06-07 04:03:42 -04:00
Tim Pope
4aeca0c566 Drop support for Vim older than 7.4 2022-06-07 03:14:49 -04:00
Tim Pope
55256c7de2 Fix syntax error
Resolves: https://github.com/tpope/vim-fugitive/issues/2008
Resolves: https://github.com/tpope/vim-fugitive/issues/2009
2022-06-07 02:10:42 -04:00
Tim Pope
2386b9b39f Drop support for autocmd User Fugitive 2022-06-07 01:09:56 -04:00
Tim Pope
96c1009fcf fugitive.vim 3.7
Move "Unpushed" sections above "Unpulled".
Show commits that are unpushed anywhere when no upstream is set.
Provide czs map as :Git stash push --staged.
Support the MSYS Vim bundled with Git for Windows.
Turn remaining deprecated commands (:Gbrowse, etc.) into error stubs.
2022-06-07 01:03:24 -04:00
Tim Pope
5920f807f5 Expire b:git_dir on buffer rename 2022-06-03 20:33:48 -04:00
Tim Pope
f60fc79e53 Avoid unnamed buffer with :set hidden
Resolves: https://github.com/tpope/vim-fugitive/issues/2004
2022-06-01 12:54:13 -04:00
Tim Pope
fb07620878 Retool $GIT_INDEX_FILE handling
* Don't attempt to handle relative paths, as there's no guarantee the
  current working directory is the one Vim was started with.  In
  practice, the only relative path I've seen is `.git/index`, which is
  already the default and thus harmless to ignore.
* Cache the result of FugitiveVimPath(), to allow for slow
  implementations.
2022-05-31 16:11:22 -04:00
Tim Pope
8fba012775 Fix fugitive#simplify() with summary URL 2022-05-31 16:11:22 -04:00
Tim Pope
596621dc6e Support Git for Windows bundled MSYS Vim
References: https://github.com/tpope/vim-fugitive/issues/1970
2022-05-30 16:48:48 -04:00
Tim Pope
5bf3fd40f6 Provide FugitiveActualDir()
This is intended to free up FugitiveGitDir() to refer to the ".git" file
in that work tree and submodule repositories use.  I wish I had better
names for these two.  Settling for "Actual" as that at least has a
pleasing 6 letter symmetry with "Common".
2022-05-30 14:03:43 -04:00
Tim Pope
950f9c49fc Introduce helper to normalize to backslashes on win32
FugitiveVimPath() is intended to potentially convert between UNIX and
Windows paths in mixed environments.  Let's separate uses that require
that from those that simply normalize slashes.
2022-05-30 14:03:43 -04:00
Tim Pope
92870eb6d2 Remove dead code for resolving symlinked buffer name
The `:p` flag resolves symlinks, so the resolve() call is a no-op, and
the subsequent conditional is always false.  It also appears to be no
longer necessary, though I'd have to do a bit more digging to figure out
why.
2022-05-28 21:57:21 -04:00
Tim Pope
5ec0793b88 Accept both fugitive://C:/ and fugitive:///C:/ on win32
The 2 slash version slots the drive letter into the host field, which
I'm worried will cause problems when the URLs are used non-opaquely, for
example, with an LSP.  Let's start transitioning to the convention used
by file:// URLs.
2022-05-28 21:00:24 -04:00
Tim Pope
a504abb8b8 Avoid reusing variable 2022-05-28 21:00:24 -04:00
Tim Pope
ad16275775 Fix statusline indicator on older Vim
Vim was clearing the statusline due to an error, despite the fact the
exception was caught and ignored.
2022-05-27 22:56:20 -04:00
Tim Pope
41939b09cb Move s:SameRepo() next to other Git dir functions 2022-05-27 21:01:42 -04:00
Tim Pope
097ce939da Make summary buffer available at fugitive:// URL
Using $GIT_DIR/index for the summary buffer has 2 problems:

* It requires a BufReadCmd for all files named "index", necessitating
  special handling for false positives.
* It forces us to resolve ".git" files and symlinks, decoupling us from
  the worktree and thus forcing us to depend on `core.worktree`.  Git
  always sets this when necessary, but users and third-party tooling
  sometimes do not.

Using a fugitive:// URL for the buffer solves both.

This is a large, breaking change, so let's leave $GIT_DIR/index as the
default for now.
2022-05-27 19:50:53 -04:00
Tim Pope
9a4f1e9df2 Extract helper for checking for same repository 2022-05-27 18:20:45 -04:00
Tim Pope
0e9f763c7b Allow :GBrowse : to browse to repository homepage 2022-05-22 22:26:45 -04:00
Tim Pope
fb32927ff5 Use correct normalization of URL in fugitive#Path() 2022-05-22 22:26:45 -04:00
Tim Pope
22a843f8e6 Add missing ! to function definition 2022-05-22 22:26:45 -04:00
Tim Pope
9f30e4d904 Experimentally allow passing Git dir to fugitive#Command()
References: https://github.com/tpope/vim-fugitive/issues/1981
2022-05-22 17:33:53 -04:00
Tim Pope
cdacef342d Distinguish between uses of Git dir, part 2
See 5d1a276b45.
2022-05-21 21:35:50 -04:00
Tim Pope
f48cbb92c5 Read more of config file for core.worktree check
References: https://github.com/tpope/vim-fugitive/issues/1920
2022-05-21 21:35:50 -04:00
Tim Pope
589e8b51c2 Track correct window when blaming twice-open buffer
Resolves: https://github.com/tpope/vim-fugitive/issues/1992
2022-05-21 21:35:49 -04:00
Tim Pope
5b62c75238 Extract Git dir cache keys to local variables
Allow for a non-string representation of the repository to replace the
dir parameter.
2022-05-14 02:35:39 -04:00
Tim Pope
a8139d37b2 Properly normalize Git dir in 'keywordprg' 2022-05-13 01:56:20 -04:00
Tim Pope
f529acef74 Force Vim path normalization in fugitive#Path()
This only matters for use cases where the paths differ by more than just
slashes (theoretically possible with mixed WSL setups).
2022-05-11 02:12:21 -04:00
Tim Pope
87923d1b1b Fix HEAD cache expiry on FugitiveDidChange() 2022-05-11 00:23:14 -04:00
Tim Pope
af8b352dbf Remove redundant "dir" keys from dictionaries 2022-05-11 00:23:14 -04:00
Tim Pope
b81c59bd6a Remove fugitive#head() 2022-05-10 22:47:05 -04:00
Tim Pope
b7287bd542 Provide explicit explanation of command naming 2022-04-26 16:21:33 -04:00
Tim Pope
b5bbd0d181 Clarify ~ and P maps in blame window
Resolves: https://github.com/tpope/vim-fugitive/issues/1980
2022-04-21 15:05:35 -04:00
Tim Pope
b04708af2d Revert "Avoid IO from ":p" during detection"
This change failed to account for the directory edge case, where ":p:h"
has the very nice property of giving us back the original input, due to
":p" appending a trailing slash.  Without this, we fail to detect when
editing the root of the repository.

This reverts commit 1b811b88a4.

Resolves: https://github.com/tpope/vim-fugitive/issues/1978
Resolves: https://github.com/tpope/vim-fugitive/issues/1979
2022-04-20 23:25:14 -04:00
Tim Pope
1b811b88a4 Avoid IO from ":p" during detection 2022-04-20 18:29:45 -04:00
Tim Pope
ed1ff363df Remove another acwrite check 2022-04-20 18:29:45 -04:00
Tim Pope
e064f42770 Don't consider buftype=acwrite buffers to have real filenames
Immediately after I changed this I rediscovered the documentation at
`:help E676`.
2022-04-20 18:28:44 -04:00
Maksim Odnoletkov
70251a915f Show local commits when no upstream is set
References: https://github.com/tpope/vim-fugitive/issues/1963
Resolves: https://github.com/tpope/vim-fugitive/issues/1977
2022-04-20 14:47:15 -04:00
Tim Pope
200593827e Adjust handling of 'buftype' during detection 2022-04-19 18:35:15 -04:00
Tim Pope
4b0f2b6045 Default g:ceiling_directories to parent of $HOME
References: https://github.com/tpope/vim-fugitive/issues/1457
2022-04-14 02:31:49 -04:00
Tim Pope
a252be79c0 Check for ch_close_in() to ensure full Vim jobs support
Resolves: https://github.com/tpope/vim-fugitive/issues/1973
2022-04-12 19:51:42 -04:00
Tim Pope
cba863444c Move unpushed sections above unpulled, again
This reverts commit 279d56eb47
(effectively).

References: https://github.com/tpope/vim-fugitive/issues/1963
2022-04-05 12:13:40 -04:00
Tim Pope
d725ef529e Turn remaining deprecated commands into error stubs 2022-04-01 18:27:49 -04:00
Tim Pope
8f169a84ff Allow simultaneous blames in diffed buffers
References: https://github.com/tpope/vim-fugitive/pull/1327
2022-04-01 18:27:49 -04:00
Tim Pope
d9a914b14d Replace 'cursorbind' in blame with manual line syncing
This is the only way to sync the line without also syncing the column.
Syncing the column is particularly problematic when it causes the blame
window to vertically scroll while typing.
2022-04-01 18:27:44 -04:00
Tim Pope
c0701f7a0e Fix expansion of SSH host aliases
Resolves: https://github.com/tpope/vim-fugitive/issues/1962
2022-03-30 11:08:14 -04:00
Tim Pope
321328c6c5 Avoid I/O from ":p" when handling temp files
This isn't a big deal for temp files themselves, but if we're checking
an arbitrary buffer, it's possible we'll end up hitting a slow network
share just to find out if the path is relative.

This new s:AbsoluteVimPath() helper could potentially be reused in a lot
of places.  But this diff is big enough as is; save that for later.
2022-03-26 15:41:55 -04:00
Tim Pope
8157efff49 Provide g:fugitive_defer_to_existing_maps
References: https://github.com/tpope/vim-fugitive/issues/1425
2022-03-25 18:08:01 -04:00
Tim Pope
b6405d8908 Provide literally named <Plug> maps
For every map X, also provide a map <Plug>fugitive:X.

References: https://github.com/tpope/vim-fugitive/issues/1425
2022-03-25 17:50:32 -04:00
Tim Pope
5716e11776 Fix line wrap in README 2022-03-24 08:02:43 -04:00
Tim Pope
46652a304f Add :GUnlink, like in eunuch.vim
This currently mirrors :GRemove, but gives us the option to add a third
variant.
2022-03-09 10:50:24 -05:00
Tim Pope
afd6c13c6b Fix infinite loop when summary window contains no sections
Resolves: https://github.com/tpope/vim-fugitive/issues/1954
2022-03-01 07:35:31 -05:00
Tim Pope
485ce07c27 Match FugitiveRemote() interface to window.location in JS 2022-02-11 13:02:45 -05:00
Tim Pope
c29ef11cd6 Parse anchor in remote URL
I've never seen this in practice, but if it does happen, we shouldn't
include it in the value for "path".
2022-02-11 13:02:45 -05:00
Tim Pope
6c19f1ddfb More robut escaping of +cmd arguments
Resolves: https://github.com/tpope/vim-fugitive/issues/1938
2022-02-02 11:53:01 -05:00
Tim Pope
a443104489 Add czs as :Git stash push --staged
Resolves: https://github.com/tpope/vim-fugitive/issues/1941
2022-02-02 05:49:09 -05:00
Roger Bongers
59529a2c36 Add basic bisect subcommand completion 2022-01-24 21:13:07 -05:00
Tim Pope
a93ceff61f Support extensions.worktreeConfig
Resolves: https://github.com/tpope/vim-fugitive/issues/1898
2022-01-13 14:06:42 -05:00
Tim Pope
f4d94c5985 Move CommonDir() from autoload to plugin 2022-01-11 18:47:38 -05:00
Tim Pope
bb4f9e660b Add core.worktree to FAQ 2022-01-11 18:39:40 -05:00
Tim Pope
189e3c406e Eliminate filereadable() guards by catching readfile() error 2022-01-11 18:36:36 -05:00
Tim Pope
944dc602c6 Require core.bare=true for bare repositories
Resolves: https://github.com/tpope/vim-fugitive/issues/1920
2022-01-11 13:50:55 -05:00
Tim Pope
fa20e5e77c Remove :silent from all :checktime uses
This can appear to hang with 'noautoread', or if the buffer has changed
in memory.  In reality it's not hanging, it's just silenced the
interactive prompt.

Resolves: https://github.com/tpope/vim-fugitive/issues/1917
2022-01-10 11:08:29 -05:00
Tim Pope
57968b63c2 Support tab complete of :Git push remote \+branch
Resolves: https://github.com/tpope/vim-fugitive/issues/1916
2022-01-05 11:10:57 -05:00
Tim Pope
88a97127d1 Account for optional escaping in tab complete
Tab complete results are always passed to fnameescape(), which can
result in the output having more backslashes than the input, causing
those results to be filtered out.  Attempt to reconcile this.

References: https://github.com/tpope/vim-fugitive/issues/1916
2022-01-05 11:08:38 -05:00
Tim Pope
b6dbb97759 Extend lazy detection to netrw
The requires dropping support for b:netrw_curdir, which was added in
fecd42864a for the vague reason of
handling "unusually named netrw buffers".  I'll figure out what to do
about those alleged buffers when one of them surfaces again.
2022-01-05 11:07:15 -05:00
Tim Pope
b1c3cdffc9 Fix status reload after staging entire section
Resolves: https://github.com/tpope/vim-fugitive/issues/1912
2021-12-29 16:50:00 -05:00
Tim Pope
ee992c808c Narrow application of broken jobwait() workaround
Neovim seemlingly forces a redraw if :sleep is called while defocused,
but only if at least one FocusGained/FocusLost autocommand is defined.
The purpose of this :sleep is to force the exit callback to run when
jobwait() erroneously refuses to do the job.  Our exit callback removes
the job from the dictionary, so we can use the lack of a job key in any
dictionary as a signal that we can skip it.  Hacks on top of hacks.

Resolves: https://github.com/tpope/vim-fugitive/issues/1909
References: https://github.com/tpope/vim-fugitive/issues/1857
2021-12-28 16:03:34 -05:00
Tim Pope
831fdab983 Simplify extraction of directory of buffer name
The behavior of :p is more predictable than I realized when I first
wrote this.
2021-12-28 16:03:34 -05:00
Tim Pope
da30818d17 Resize EDITOR window automatically when necessary
Resolves: https://github.com/tpope/vim-fugitive/issues/1907
2021-12-24 12:53:00 -05:00
Tim Pope
ab57abf1d0 Don't feedkeys() into terminal window
Resolves: https://github.com/tpope/vim-fugitive/issues/1908
2021-12-23 21:47:29 -05:00
Tim Pope
f18571e647 Remove redundant ":p" modification during detection
Every ":p" does I/O to check for a directory, so let's do away with the
belt-and-suspenders usage.
2021-12-23 15:00:14 -05:00
Tim Pope
3fb9beacbc Fix possible infinite loop 2021-12-12 13:28:20 -05:00
Tim Pope
365231384c Don't treat buftype=nofile buffer names as file names
Resolves: https://github.com/tpope/vim-fugitive/issues/1905
2021-12-08 16:17:41 -05:00
Tim Pope
c04e80c6eb Fix accidental :execute 0 2021-12-08 16:13:28 -05:00
Tim Pope
79c2b3f48d Try nested autocmds for ReadCmd/WriteCmd
I'm trying to leverage OptionSet for something.  Let's see if this
causes issues for anybody.
2021-12-07 09:17:47 -05:00
Tim Pope
2064312ad7 Don't reject invalid Git dir when detecting common dir
Consumers of this function should be giving us a valid Git dir, and if
they don't, returning an empty string will only make matters worse.

References: https://github.com/tpope/vim-fugitive/pull/1898
2021-12-01 20:05:47 -05:00
Tim Pope
c666c86882 Fix blame from stage buffer
References: https://github.com/tpope/vim-fugitive/issues/1892
2021-12-01 19:48:43 -05:00
Tim Pope
a099a2631c Disable diff.suppressBlankEmpty for summary window diff
Resolves: https://github.com/tpope/vim-fugitive/issues/1897
2021-12-01 19:27:29 -05:00
Tim Pope
82f2841bdf Fix gf error in commit message outside of repository 2021-11-28 15:36:44 -05:00
Tim Pope
5a24c25275 fugitive.vim 3.6
* Fix support for older Vim 7 patch levels.
* Support copies on :Gclog --follow.
2021-11-25 14:53:57 -05:00
Tim Pope
e82332ee9e Try to avoid trailing newline blame issues
Resolves: https://github.com/tpope/vim-fugitive/issues/1892
2021-11-22 13:24:21 -05:00
Tim Pope
64bc1a3431 Remove dead code
The use of remove() here wouldn't actually work as it expects an index,
not a value.
2021-11-19 17:42:33 -05:00
Tim Pope
4a8db6b856 Support copies with :Gclog --follow
Resolves: https://github.com/tpope/vim-fugitive/issues/1891
2021-11-19 17:19:30 -05:00
Tim Pope
3d5d23fe80 Remove q map stubs
Resolves: https://github.com/tpope/vim-fugitive/issues/1890
2021-11-19 17:16:36 -05:00
Tim Pope
2dfaf17f9e Use dummy events to prevent "No matching autocommands" message
This list of events was hand-curated to eliminate events already defined
elsewhere in the autoload file.

Resolves: https://github.com/tpope/vim-fugitive/issues/1887
2021-11-16 16:09:59 -05:00
Tim Pope
69ae31d402 Fix command execution on Vim 7
This worked on my test environment of 7.4.888, but did not work on
7.4.000.

References: https://github.com/tpope/vim-fugitive/issues/1889
2021-11-16 13:44:55 -05:00
Tim Pope
f9c0b8eafe Fix readfile() usage
Resolves: https://github.com/tpope/vim-fugitive/issues/1886
2021-11-15 20:54:19 -05:00
Tim Pope
e47121f8fd Fix typo 2021-11-15 00:31:32 -05:00
Tim Pope
cd67d087df fugitive.vim 3.5
* Lazy initialization.
* Make status buffer diff retrieval asynchronous.
* Support jump to diff from :Git log --name-status.
* Use smudge filters when viewing blobs.
* Provide User FugitiveEditor event.
* Provide FugitiveRemote() API function.
2021-11-15 00:17:52 -05:00
Tim Pope
b736e457b3 Provide FugitiveRemote() 2021-11-13 16:25:36 -05:00
Tim Pope
2e4ee0b5d6 Don't scroll :Git! window for paginated commands
References: https://github.com/tpope/vim-fugitive/issues/1832
2021-11-11 00:44:14 -05:00
Tim Pope
a6b823b8d0 Fix race condition on nvim 0.4
I could have sworn this wasn't necessary on 0.4, which is why I added
the extra clause, but I can consistently reproduce E716 now.

Resolves: https://github.com/tpope/vim-fugitive/issues/1881
2021-11-02 14:07:58 -04:00
Tim Pope
174fd6a39b Revert "Use :redrawstatus rather than &ro = &ro"
Turns out :redrawstatus is a lot more aggressive and can prevent seeing
Fugitive output.

This reverts commit 6ad15506cc.

References: https://github.com/tpope/vim-fugitive/issues/1180
2021-10-27 03:17:44 -04:00
Tim Pope
6ad15506cc Use :redrawstatus rather than &ro = &ro
References: https://github.com/tpope/vim-fugitive/issues/1180
2021-10-26 09:22:33 -04:00
Tim Pope
30933405bb Support blame maps without filetype plugin on
References: https://github.com/tpope/vim-fugitive/issues/1745
2021-10-19 11:44:22 -04:00
Tim Pope
4d29c1d6a0 Provide for retrieving parsed remote URL
The plan is to expose this as FugitiveRemote(), but let's give it some
bake time before making it official.
2021-10-17 20:25:23 -04:00
Tim Pope
93f41ace7d Move to beginning of line in "(" map
Resolves: https://github.com/tpope/vim-fugitive/issues/1867
2021-10-17 11:22:10 -04:00
Tim Pope
d5a6419fcf Guard against parallel status reload
Resolves: https://github.com/tpope/vim-fugitive/issues/1863
2021-10-17 11:22:10 -04:00
Tim Pope
88c7f867cf Further decouple #BufReadStatus() from v:cmdbang 2021-10-16 12:58:13 -04:00
Tim Pope
0615cd2baf Ignore v:cmdbang when not in autocommand 2021-10-16 10:57:04 -04:00
Tim Pope
ca61174e9d Remove leading slash when parsing scpremote:/~user 2021-10-16 10:43:42 -04:00
Tim Pope
a4c6fb74ee Help file formatting fix 2021-10-16 10:43:42 -04:00
Tim Pope
2e66b3ad05 Don't show diff on root commits
The diff on a root commit is often large and seldom helpful, so let's
get rid of it.  This will also be one less thing to worry about when
changing to a fugitive file type.
2021-10-12 12:34:43 -04:00
Tim Pope
e38d029500 Adjust encapsulation of escaped completion handling
Most calls to s:FilterEscape() pass the original escaped argument, so
we should fix the callers that don't.
2021-10-11 00:38:57 -04:00
Tim Pope
69f5fcbd45 Allow escaped characters in tab complete
Resolves: https://github.com/tpope/vim-fugitive/issues/1859
2021-10-10 13:24:20 -04:00
Tim Pope
b540332a3e Improve parallelism of status buffer with earlier diff
This is a trivial gain, but also trivial to implement.
2021-10-08 19:05:18 -04:00
Tim Pope
ae93dbea2e Ensure jobstart on_exit runs when waiting
Resolves: https://github.com/tpope/vim-fugitive/issues/1857
2021-10-08 19:05:18 -04:00
Tim Pope
bcf7478e6b Make status buffer diff retrieval asynchronous
Resolves: https://github.com/tpope/vim-fugitive/issues/1856
2021-10-06 14:45:36 -04:00
Tim Pope
a67854368e Collapse all status buffer diffs on :edit!
References: https://github.com/tpope/vim-fugitive/issues/1563
2021-10-01 14:28:13 -04:00
Tim Pope
e2883a5426 Support reload on custom chmod and unlink events
These were recently added to eunuch.vim, but other plugins may use them
as well.
2021-09-30 12:43:23 -04:00
Tim Pope
194d63da4f Restore laziness of status reload after write
This got lost in a refactor.
2021-09-30 12:43:23 -04:00
Tim Pope
dd39902e3d Minor performance improvement to global map definition 2021-09-30 12:43:23 -04:00
Tim Pope
7e483dc60d Show overflow sections as 255+ not 256
Resolves: https://github.com/tpope/vim-fugitive/issues/1853
2021-09-29 16:59:38 -04:00
Steven Humphrey
1213953abf Fix default remote in fugitive#RemoteUrl
A previous refactor resulted in fugitive#RemoteUrl() with no arguments
returning the string 'origin' instead of git@github.com....
2021-09-28 10:49:14 -04:00
Tim Pope
7b05afd548 Add experimental behavior for X on commit line
Resolves: https://github.com/tpope/vim-fugitive/issues/1847
2021-09-25 10:21:58 -04:00
Tim Pope
915c050724 Fix :GBrowse - destination 2021-09-25 10:20:09 -04:00
Tim Pope
142a0dc0c4 Fix wrong variable name in fugitive#RemoteUrl()
Resolves: https://github.com/tpope/vim-fugitive/pull/1843
2021-09-23 04:39:47 -04:00
Tim Pope
1352646890 Extract helper to parse fugitive#RemoteUrl() arguments 2021-09-19 14:44:42 -04:00
Tim Pope
e1d382b3e7 Fix resolution of scp style URLs 2021-09-19 14:44:42 -04:00
Tim Pope
3d67d23f47 Normalize path when parsing remote URL
Change an empty path to "/" as is the standard interpretation.  And for
git:// and ssh:// URLs, change a leading "/~" to "~", like Git itself
does.
2021-09-19 12:26:14 -04:00
Tim Pope
f02217b776 Avoid repeat config retrieval in :GBrowse 2021-09-19 12:26:12 -04:00
Tim Pope
12c40427a0 Separate remote resolution from URL reassembly 2021-09-19 08:29:40 -04:00
Tim Pope
bb89a7a497 Invert flag for lazy initialization
I think this second argument might become an optional buffer number at
some point, so change the special value for lazy to an invalid buffer
number.
2021-09-19 07:54:03 -04:00
Tim Pope
a67e1f8189 Try to avoid interference by $GIT_DIR and $GIT_WORK_TREE
Resolves: https://github.com/tpope/vim-fugitive/issues/1841
2021-09-17 06:16:58 -04:00
Tim Pope
27abc3f1bd Respect 'splitright' instead of 'splitbelow' for :vertical
Resolves: https://github.com/tpope/vim-fugitive/issues/1839
2021-09-16 08:13:00 -04:00
Tim Pope
67c4c031fa Support jump to diff from :Git log --name-status
Resolves: https://github.com/tpope/vim-fugitive/issues/1838
2021-09-14 18:19:16 -04:00
Tim Pope
79a6a1941d Fix typo 2021-09-14 14:04:42 -04:00
Tim Pope
ba52c2b446 Make RemoteUrl() option parsing a bit less convoluted 2021-09-14 03:38:26 -04:00
Tim Pope
529311cec7 Fix check for wrong executable 2021-09-14 02:12:50 -04:00
Tim Pope
5f387d4783 Fix FugitiveRemoteUrl('origin', FugitiveConfig()) 2021-09-14 00:06:58 -04:00
Tim Pope
5be8263f16 Override GPG_TTY to prevent terminal garbling
Resolves: https://github.com/tpope/vim-fugitive/issues/1836
2021-09-13 21:05:03 -04:00
Tim Pope
1651cd7f20 Extract helper to determine PTY availability
I constantly have to ask about this to troubleshoot bug reports, so make
it easier to determine.

Also rename g:fugitive_pty to make it clearer that it's not a preference
but a debugging tool.
2021-09-13 16:58:42 -04:00
Yuriy Taraday
630ecc8c3a Use --filters in cat-file whenever possible
Starting with Git 2.11 cat-file provides --filters option that can be
specified instead of "blob" type. This option tells Git to use all
filters specified in .gitattributes.

This enables diffs for files with filters, for example, git-crypt.

Closes #1509
2021-09-13 16:16:32 -04:00
Tim Pope
e2927fb467 Force current buffer number for FugitiveStatusline()
This is normally the default, but might be different during an event
like FugitiveChanged.
2021-09-10 16:13:51 -04:00
Tim Pope
1a652c0cdf Tab complete :Git ++options and --options
Resolves: https://github.com/tpope/vim-fugitive/issues/1833
2021-09-10 16:11:39 -04:00
Tim Pope
6b1d90251e Support lazy initialization in statusline indicator
Resolves: https://github.com/tpope/vim-fugitive/issues/1834
2021-09-10 15:51:47 -04:00
Tim Pope
bb4d1dd9a8 Eliminate internal use of FugitiveCommonDir()
Lead by example.
2021-09-10 15:51:41 -04:00
Tim Pope
b6545ad389 Fix inconsistency when scrolling :Git! preview window
Scrolling with win_execute() works fine while the command is running,
but once the job has finished, it fails to update the viewport until the
window is focused.  I don't get it.  It's not like the window knows a
job is running.  The only obvious trigger I could find is that
'nobuflisted' is set once once the job completes, but even disabling
that behavior fails to rectify the problem.  Screw it, manual focus
bouncing for everyone.

References: https://github.com/tpope/vim-fugitive/issues/1832
2021-09-10 02:47:21 -04:00
Tim Pope
be0abe0b21 Standardize <mods> handling for quickfix commands
Use <mods> for :copen rather than :cfirst, as that seems to be the more
useful of the two.

When I call :vertical copen, I get a window that is initially 10
columns wide, but which resizes to 20 columns upon blurring and
refocusing. Not sure what's up with that, but 10 columns is comically
narrow, so let's go ahead and open at 20 columns to begin with.

Resolves: https://github.com/tpope/vim-fugitive/issues/1831
2021-09-08 16:04:35 -04:00
Tim Pope
02eb2e871c Fix typo in error message 2021-09-07 14:16:27 -04:00
Tim Pope
404c3c24e1 Use new tab for --patch maps
References: https://github.com/tpope/vim-fugitive/discussions/1830
2021-09-07 13:59:52 -04:00
Tim Pope
ed6b45a81a Drop unused args parameter from :Gcommand implementations
We stopped using this in 6356bbc4a7.
2021-09-07 13:56:14 -04:00
Tim Pope
6f07d7e6cd Make initialization lazy 2021-09-06 19:03:55 -04:00
Tim Pope
8c243a7f0d Provide User FugitiveEditor event
I'm not sure if this should trigger every time the buffer is loaded, or
only on the initial split.  Arbitrarily pick the latter for now.

References: https://github.com/tpope/vim-fugitive/issues/1828
2021-09-06 15:54:37 -04:00
Tim Pope
0840f001fe Avoid error when mapcheck() and <unique> semantics differ
References: https://github.com/tpope/vim-fugitive/issues/1826
2021-09-05 10:00:39 -04:00
Tim Pope
8d25dd777c Fix pedit map in :Git -p grep
Resolves: https://github.com/tpope/vim-fugitive/issues/1825
2021-09-04 00:13:35 -04:00
Tim Pope
d488a7090f Add >/ and >:/ as work-tree version expansions
Not sure I want to waste the easy to type ">" on the work tree version,
so adding some alternatives.
2021-09-04 00:13:00 -04:00
Tim Pope
2a53d79248 fugitive.vim 3.4
* Use jobs for all Git execution.  Faster and less prone to user error.
* Stream :Git! to the preview window.
* Make :Git grep behave like other :Git commands, not :Ggrep.
* Silence output and open quickfix list on :Ggrep -q.
* Support :Ggrep outside repository with --no-index.
* Expand ##, $ENVVAR, and ~/path in arguments to :Git.
* Expand "%" and other special sequences during tab completion.
* Improve tab completion for :Git push.
* Disable -- More -- prompt on :Git push, fetch, and --no-pager.
* Provide FugitiveObject/FugitiveStageBlob/FugitivePager events.
* Simplify :Gdiffsplit "smart" split direction.
* Support jump to commit in :Git log --graph.
* Use local not upstream branch name for :GBrowse default.
* Better support for ssh config in :GBrowse.
* Replace older deprecation warnings with error messages.
* Assorted public API enhancements.
* Require Git 1.8.5 or newer.
* Require Vim 7.3 or newer.  Full functionality requires Vim 8.1.
* Directly echo :Git output for trivial commands like "add" on Vim 7.
* Fix E1208 when loading plugin on Vim 8.2.3141.
2021-09-02 13:03:27 -04:00
Tim Pope
2e395fa450 Provide FugitiveDidChange() 2021-09-01 19:20:46 -04:00
Tim Pope
46404ad937 Enforce 'autowrite' in all subcommands 2021-09-01 19:20:46 -04:00
Tim Pope
2f3cd4715d Remove :Gcgrep
This was a hedge in case I decided to go all in with symmetry with
:Gclog.  I have decided to to.
2021-09-01 19:20:46 -04:00
Tim Pope
90ef74fddd Fix :Git difftool on Vim 7 2021-09-01 18:40:29 -04:00
Tim Pope
ebc7ddac6d Fix :Ggrep on Vim 7 2021-09-01 18:36:52 -04:00
Tim Pope
8bdbbf88a4 Change :Gstatus to error stub 2021-09-01 17:39:28 -04:00
Tim Pope
ef8e771b25 Document ++curwin 2021-09-01 09:57:26 -04:00
Tim Pope
a7d224bfd1 Support :Git ++curwin blame % 2021-09-01 09:57:26 -04:00
Tim Pope
46a4387054 Change :0,1Git blame to split by default
The 0,0 solution had issues so let's go ahead and rip the band-aid off
now.  The repeated get(a:options, 'curwin') && a:line2 < 0 ternary is
really gross but I estimate it to be the lowest impact change that moves
us in the right direction.
2021-09-01 09:42:30 -04:00
Tim Pope
3d30a2a6d3 Expand ~~ as cwd
This is a hedge to allow a way to force a cwd path even if the
handling of "./" ever changes.
2021-09-01 08:48:41 -04:00
Tim Pope
254cc8e81d Tab complete !bufnr 2021-09-01 07:54:47 -04:00
Tim Pope
5b0a4af8fc Improve fallback go-to-file in temp buffers 2021-08-31 23:19:31 -04:00
Tim Pope
b96e1a3967 Update :Gpush FAQ entry to mention :Git! 2021-08-31 17:51:46 -04:00
Tim Pope
a5d997fe8b Pre-expand argument when completing Git objects 2021-08-31 17:51:46 -04:00
Tim Pope
8920453f5d Return full ref name on FugitiveHead(-1) 2021-08-31 17:51:46 -04:00
Tim Pope
2016ce1db4 Fix check for maps disabled by dictionary
Resolves: https://github.com/tpope/vim-fugitive/issues/1822
2021-08-31 16:33:21 -04:00
Tim Pope
2b37219021 Fix check for -addr=other on nvim
I arrived at 0.4.0 by blaming the documentation, but apparently the
feature didn't land until later.
2021-08-31 16:33:21 -04:00
Tim Pope
9ace6c6aca Expand :GMove and :GRename arguments 2021-08-31 14:59:50 -04:00
Tim Pope
4efb697fce Document :Ggrep -q 2021-08-31 14:59:50 -04:00
Tim Pope
97505a4c37 Expand :(literal)./ arguments to use cwd 2021-08-31 14:59:50 -04:00
Tim Pope
3e032f295f Clean up job dictionary entry after nvim job completes 2021-08-31 14:59:50 -04:00
Tim Pope
0d8dc0f31c Add stdin support to FugitiveExecute() 2021-08-31 13:49:39 -04:00
Tim Pope
cabcbc263a Further tweak to direct :Git blame count handling
I want to reclaim :0,1Git blame for :split, since we can use that even
with -addr=other, so go ahead and add 0,6 as our backwards compatible
way to force :edit.
2021-08-31 12:27:29 -04:00
Tim Pope
404f8a2d34 Replace #ReloadStatus() with #DidChange() 2021-08-31 12:02:17 -04:00
Tim Pope
30bf224453 Fix direct blame maps in short files
Patch 8.1.560 is the gift that keeps on giving.  Let's work around this
for now by bolting on a new behavior to the previously unused :0,0Git
blame.  Long term, we probably want to come up with a different
interface.
2021-08-31 12:01:21 -04:00
Tim Pope
328501d4f0 Make "q" error maps consistent 2021-08-31 12:01:21 -04:00
Tim Pope
b64c426fd2 Try :Git for default dispatch in status buffer
The downside of this approach is it has a different interaction model
than the quickfix list.  The upside is that it's more or less what I
actually want.  To those finding this wondering why it's now
synchronous, you can make it asynchronous by pressing CTRL-D.
2021-08-31 06:59:37 -04:00
Tim Pope
d6e1a57b58 Accept a dictionary in fugitive#RemoteHttpHeaders() 2021-08-31 06:59:37 -04:00
Tim Pope
6b546f37d0 Better HTTP redirect detection
These HTTP headers may have other :GBrowse applications, so if we're
parsing them, we may as well hang onto them.
2021-08-30 09:25:52 -04:00
Tim Pope
dfd7be2294 Fix error on :GBrowse remote/branch@remote 2021-08-29 16:32:22 -04:00
Tim Pope
10b44345b0 Extend :Gdiffsplit zero argument positioning to ">" arguments
And change the jump to file map to use it, eliminating the behavior
change there (at least for now).

Resolves: https://github.com/tpope/vim-fugitive/issues/1821
2021-08-29 12:15:51 -04:00
Tim Pope
acfcb068ed Don't append another filename when expanding ">commit:file"
This opens up the possibility of using ">" to navigate to a renamed
version of a file, for example.
2021-08-29 12:14:55 -04:00
Tim Pope
6f0ff0ed00 Favor ssh:// URL over scp style when possible
This is much easier to deal with on other end, so if a :GBrowse provider
doesn't care about relative scp paths, allow them to ditch the scp
parsing entirely.
2021-08-29 12:13:14 -04:00
Tim Pope
a6be4a301c Limit size based :Gdiffsplit orientation to no argument variant
I don't think anybody liked this except for me.  This brings :Gdiffsplit
one step closer to :diffsplit.  The no argument version will probably be
removed eventually as well, but let's take it one step at a time.
2021-08-29 03:53:21 -04:00
Tim Pope
c9aaf78541 Force :leftabove for :Gdiffsplit! with argument
After receiving feedback, I have decided that the forced direction is
what most people expect, so let's limit our :diffsplit matching to the
non-bang variant, for now at least.
2021-08-29 03:53:21 -04:00
Tim Pope
d523feebe9 Respect 'splitbelow' on :Gdiffsplit with argument
When calling :Gdiffsplit with no argument, we always end up with the
work tree version as half of the diff, and it is helpful to position
that consistently.  I generalized this to a consistent older versus
newer ordering when given an argument, but I don't think that has proven
very useful in practice.

This also introduces a minor behavior change where calling the bang
variant in the initial commit now loads an empty version of the buffer,
rather than falling back to the work tree.
2021-08-28 11:47:13 -04:00
Tim Pope
4603d77424 Provide :Gdiffsplit ++novertical
Maybe one day we can kill :Ghdiffsplit.
2021-08-28 11:47:13 -04:00
Tim Pope
6b7892dc7b Fix edge case in s:Map() short circuiting
When called with multiple modes, don't bail after the first disabled
mode.

This also restructures in a way to allow for transition to :exe s:Map(),
which will provide the correct line number on :verbose map <whatever>.
2021-08-28 11:47:13 -04:00
Tim Pope
cdf60a312c Provide User FugitivePager autocommand event 2021-08-28 08:14:50 -04:00
Tim Pope
385c0fb4ee Use <cfile> not <cword> for temp file "." map
Also, skip over that "+" that marks work-tree branches in :Git branch
output.
2021-08-28 08:14:50 -04:00
Tim Pope
4f747add5e Support jump to commit in :Git log --graph 2021-08-27 11:28:45 -04:00
Tim Pope
18fd27e2cc Provide slightly less bad "." map in temp buffers
Doing this right isn't on the horizon, so hack up something that's
better than nothing.
2021-08-27 11:28:45 -04:00
Tim Pope
fa5892dcac Map "(" and ")" in blame buffers
For symmetry with the other buffers.  A nice enhancement would be to
jump between distinct commits but this is good enough for now.
2021-08-27 11:28:45 -04:00
Tim Pope
46a2f58e1d Provide utility function to expire cached config
This is primarily for troubleshooting, but might also be handy for
users of includeIf.
2021-08-27 11:28:45 -04:00
Tim Pope
126363be5a Tweak Vim 7 more prompt behavior 2021-08-26 13:35:55 -04:00
Tim Pope
4ff2c8ce30 Disable -- More -- prompt on push/fetch
These commands have slow, potentially verbose output, especially in the
case where pushing triggers a real time deploy.
2021-08-26 10:11:25 -04:00
Tim Pope
5aa8a3489e Directly echo :Git output for a few trivial commands on Vim 7
If this works out, we can change the status buffer to directly call
:Git rather than routing through FugitiveExecute().
2021-08-26 10:11:25 -04:00
Tim Pope
ad8c1c80cc Work around hostile ftplugin/man.vim
References: https://github.com/neovim/neovim/issues/15487
2021-08-26 09:12:20 -04:00
Tim Pope
7e21d414a8 Trigger FugitiveChanged after writing stage buffer
I deliberately omitted this event when adding FugitiveChanged, because I
figured it made sense for consumers to instead tap into BufWritePost to
see which file changed exactly.  This would enable, say, vim-gitgutter,
to only refresh signs for the file that actually changed, rather
than for every file in the repository.  In practice, however,
vim-gitgutter doesn't even bother with "in the repository", let alone
the exact file, opting instead to refresh every loaded buffer.  I give
up.

Resolves: https://github.com/tpope/vim-fugitive/issues/1819
2021-08-25 22:56:12 -04:00
Tim Pope
09d3551627 Don't show "Bare" status for worktrees attached to bare repos
I tried to make this foolproof and once again someone has invented a
bigger fool.
2021-08-25 07:38:41 -04:00
Tim Pope
74b0960f5b Add deprecation warning to FugitivePrepare()
I am eager to reclaim this verb, so let's deprecate sooner rather than
later.
2021-08-25 05:00:04 -04:00
Tim Pope
de02a4ba84 Change deprecated Git wrappers to error stubs 2021-08-25 05:00:04 -04:00
Tim Pope
93174147cd Provide FugitiveGitVersion()
I should have made fugitive#GitVersion() official a long time ago.
Better late than never.
2021-08-25 05:00:04 -04:00
Tim Pope
b06ad2a839 Provide FugitiveExecute() 2021-08-25 05:00:04 -04:00
Tim Pope
61e1e94785 Make FugitiveConfig(callback) asynchronous 2021-08-25 05:00:04 -04:00
Tim Pope
b07632a616 Fix :Git merge
Resolves: https://github.com/tpope/vim-fugitive/issues/1817
2021-08-25 05:00:01 -04:00
Tim Pope
e91d17ddc2 Adjust User events for fugitive:// buffers 2021-08-24 19:16:04 -04:00
Tim Pope
6dd18b5c98 Support :Git ++curwin
The special case on :0Git is so weird that I am starting to think about
an exit strategy.
2021-08-24 19:16:04 -04:00
Tim Pope
7c1f2ed185 Move config --list parsing into Execute callback
This is 80% of the way to an asynchronous config retrieval.  Do we
really want to make a 10 millisecond Git call asynchronous?  Hard to
say.
2021-08-24 14:43:10 -04:00
Tim Pope
8cdb51622f Focus quickfix list after :Ggrep! -q
This just feels right.  If we're not jumping to a file, we probably want
to scroll the list.
2021-08-23 03:00:44 -04:00
Tim Pope
5c39cde202 Don't match git grep "BUG:" lines as filename
Found this playing around with git grep --no-index /absolute/path.
2021-08-23 03:00:44 -04:00
Tim Pope
f7de229fe7 Default :Git grep to pager, not quickfix
And bring back the column default when we do use the quickfix, why not?
2021-08-23 01:51:50 -04:00
Tim Pope
1a4552da8d Support :Ggrep --no-index/--no-cached 2021-08-23 01:51:50 -04:00
Tim Pope
22fff8213e Better :Ggrep quickfix patterns 2021-08-23 01:49:55 -04:00
Tim Pope
0bd41bd387 Expand ~ and $VAR in :Git arguments 2021-08-23 01:26:52 -04:00
Tim Pope
490e03c3ad Fix line number inclusion in :Ggrep 2021-08-22 23:34:10 -04:00
Tim Pope
06b0bf147f Handle jump to file in :Git -p grep without line number 2021-08-22 23:16:42 -04:00
Tim Pope
bbfbfaa0a2 Fix command preparation bug 2021-08-22 23:16:42 -04:00
Tim Pope
a41810fa86 Better support for --no-literal-pathspecs
When given an argument list including --no-literal-pathspecs and a
buffer number, convert the buffer number to an argument by prepending
":(top,literal)" to the filename rather than "./".  This allows
operating on file names that include special characters like "*" and
"?".
2021-08-22 22:40:36 -04:00
Tim Pope
89ab2d95cd Drop Vim requirement to 7.3
The code base still supports 7.3 (7.2.061 to be precise) so no harm in
dropping this for one final release.
2021-08-22 22:09:48 -04:00
Tim Pope
557ef84c6d Improve public API argument order flexibility 2021-08-22 22:09:48 -04:00
Tim Pope
e7d2e87690 Do what I mean for :Git -c alias.foo=blame foo 2021-08-22 02:48:58 -04:00
Tim Pope
5d1a276b45 Distinguish between uses of Git dir
We use the Git dir for a few purposes:

* Direct filesystem access.
* Passing to Git as --git-dir=.
* Embedding in fugitive:// URLs.
* Referring to the repository without otherwise using it.

As a start to teasing these apart, introduce s:GitDir() to handle the
first 2 cases, s:DirUrlPrefix() for the 3rd case, and keep using s:Dir()
as a generic reference.
2021-08-22 02:48:49 -04:00
Tim Pope
7c0a7727c1 Allow FugitiveRemoteUrl(name, ':noresolve') 2021-08-22 02:47:00 -04:00
Tim Pope
baffbd6291 Fix config functions with config dictionary as first argument 2021-08-22 02:44:38 -04:00
Tim Pope
e7be4e4af9 Fix false positive "unknown Git error" 2021-08-22 00:21:33 -04:00
Tim Pope
c7a93960c7 Fix FugitiveRemoteUrl() 2021-08-22 00:21:33 -04:00
Tim Pope
b5a3775b64 Remove unused keys from :GBrowse options
I was hoping to one day introduce a new, backwards incompatible API
here, but adoption has gotten widespread enough that I think we're stuck
with it.  So let's go ahead and clean up some cruft that I've verified
is not in use in any known plugin.  A couple of plugins do use
repo.rev_parse(), but only inside conditionals should never be
triggered.
2021-08-21 21:26:45 -04:00
Tim Pope
1bd77bec75 Include remote_name in :GBrowse options
Uses for this are limited, but it does allow for retrieving the raw URL
before resolution, or for getting other properties from the remote's Git
config.

Also, allow FugitiveRemoteUrl(browse_opts) to directly retrieve the URL.
2021-08-21 21:26:45 -04:00
Tim Pope
39ff394b4e Rearrange fugitive#ResolveRemote()
This came out of a refactor to return the various URL components
separately.  I'm not ready to merge that, but this change feels like
enough of an improvement to merge for its own sake.
2021-08-21 21:26:45 -04:00
Tim Pope
57eeed2545 Add alternatives to :GBrowse ++remote=
In the same way Vim requires custom commands to start with an uppercase
letter, I'm starting to think we should self-impose the same constraint
on custom ++options.  Also, let's throw "Git" in there, just to allow
this to be truly unique if necessary.

This also allows a special remote argument of ".git" to refer to the
local repository.  A possible use of this would be a local gitweb
handler.
2021-08-21 21:26:45 -04:00
Tim Pope
4e6b7b6ce9 Don't accept 0 to refer to alternate buffer
This allows a sensible interpretation when using 0 as a stand-in for
"false".  You can use bufnr('#') if you need the old behavior.
2021-08-21 19:55:43 -04:00
Tim Pope
199dbb1164 Fix duplicate help tag
Pretty sure basically nobody used the old usage so this is fine.
2021-08-20 19:43:52 -04:00
Tim Pope
46358f87e7 Fix U in status window
Must have fat fingered this at the last second.  I mean, I forgot the
<C-U>, but I most definitely did not forget the colon.
2021-08-20 18:50:11 -04:00
Tim Pope
7e53b2aef9 Update documentation for :Git 2021-08-20 17:23:28 -04:00
Tim Pope
66a070ab14 Use :Git --no-pager in Vim 7 to directly echo output
At long last we will have a way to directly invoke :Git from inside
various status maps without subjecting Vim 7 users to a press enter
prompt.
2021-08-20 17:23:28 -04:00
Tim Pope
98039f3349 Move FugitivePath() away from documented functions
This function has weird semantics and does not rise to the level of its
peers.
2021-08-20 13:09:20 -04:00
Tim Pope
05a443cd6e Add unofficial raw argument list support to fugitive#Execute()
Hedging our bets for the future.
2021-08-20 13:09:20 -04:00
Tim Pope
2c6bd3bd2d Improve tab completion for :Git push
References: https://github.com/tpope/vim-fugitive/issues/1813
2021-08-20 11:50:05 -04:00
Tim Pope
aae36024b8 Introduce FugitiveShellCommand() to replace FugitivePrepare()
We've moved on from the shell as the one true way, so let's demote the
one true preparation function.
2021-08-20 10:24:57 -04:00
Tim Pope
3125b07645 Fix :Ggrep argument parsing off-by-one error 2021-08-20 10:24:57 -04:00
Tim Pope
f674916597 Eliminate speck of repetition around :Git --no-pager
It's not the repetition that bothers me so much as the fact these two
things belong side by side.
2021-08-20 10:24:57 -04:00
Tim Pope
b70c10f2bd Disable 'more' on :Git --no-pager 2021-08-20 08:59:51 -04:00
Tim Pope
9cf20dbff5 Don't set $COLUMNS on legacy :! implementation
It's unnecessary and offensive to the eye.
2021-08-20 08:59:51 -04:00
Tim Pope
2f51a93e89 Fix pseudo-job execution on Vim 7
Closes https://github.com/tpope/vim-fugitive/issues/1815
2021-08-20 08:59:51 -04:00
Tim Pope
fd24cb2acd Add -z to :Ggrep quickfix opening flags
I mean, it's not like we can do anything else with it.
2021-08-20 00:47:49 -04:00
Tim Pope
86a45846fc Use :Ggrep -q to eschew output in favor of quickfix window
The q works on 2 levels!
2021-08-20 00:31:41 -04:00
Tim Pope
e716ebdda9 Avoid more possibilities for :Ggrep more prompt
I think this could only happen with a screen one line high, but let's
avoid tempting fate
2021-08-19 22:25:07 -04:00
Tim Pope
771d1e3711 Avoid line echo during jump to file in :Git -p grep 2021-08-19 19:36:22 -04:00
Tim Pope
01e843c21d Avoid :Ggrep interrupt leaving behind result without file 2021-08-19 19:35:33 -04:00
Tim Pope
0cbc28ba33 Avoid -- More -- prompt during :Ggrep
Resolves: https://github.com/tpope/vim-fugitive/issues/1814
2021-08-19 16:36:44 -04:00
Tim Pope
81f293852e Stream to preview window on :Git! command 2021-08-19 13:51:20 -04:00
Tim Pope
e93d45e4ce Fix constructing Git shell commands 2021-08-19 13:50:42 -04:00
Tim Pope
eafb44a720 Use jobs for :Git --paginate 2021-08-19 13:31:37 -04:00
Tim Pope
952a49f688 Tweak check for Git in PATH
First attempt was overthinking it.
2021-08-19 13:23:20 -04:00
Tim Pope
9ba2680ad5 Add special case error for failure to find Git in PATH 2021-08-19 12:13:03 -04:00
Tim Pope
98bd8428b5 Add optional callback to FugitiveConfig()
Obvious next step is to make this asynchronous, but let's settle for
getting the API in place for now.
2021-08-19 11:09:47 -04:00
Tim Pope
9ab7ac303a Accept Git dir as first argument to FugitiveRemoteUrl() 2021-08-18 13:11:57 -04:00
Tim Pope
286bf9096d Use jobs for :Ggrep 2021-08-17 22:49:39 -04:00
Tim Pope
6c18adaf98 Use jobs for quickfix commands 2021-08-17 21:47:24 -04:00
Tim Pope
9a2299038b Standardize on 'git_dir' as dictionary key
We've been moving this way for a while, but progress is slow, so let's
help it along a bit.
2021-08-17 21:47:24 -04:00
Tim Pope
809efd3f62 Fix :Gedit .git with nonstandard .git dir 2021-08-17 20:43:53 -04:00
Tim Pope
9216210b86 Pass --git-dir= alongside -C for nontrivial cases
References: https://github.com/tpope/vim-fugitive/issues/1796
2021-08-17 20:29:09 -04:00
Tim Pope
64133cae30 Avoid unnecessary -C when querying Git config
Let's keep this low level operation away from any wonkiness caused by a
missing or bad core.worktree.
2021-08-17 20:29:09 -04:00
Tim Pope
9b31f4bee5 Include cwd in fugitive#Execute() result
I guess we should allow for the future possibility the working directory
can be specified.
2021-08-17 19:59:04 -04:00
Tim Pope
40542f1dd1 Include --no-literal-pathspecs in FugitiveResult().flags
This allows for passing the result to helpers like
fugitive#ShellCommand() without its own path munging behaviors kicking
in.
2021-08-17 19:11:30 -04:00
Tim Pope
2039676d97 Respect environment variable overrides when opening terminal 2021-08-17 17:19:46 -04:00
Tim Pope
f047d8250d Improve check for job environment variable support
The patch specified was incorrect for Vim, and this api_info() malarkey
appears to be the only way to check for Neovim 0.5.0 proper.
2021-08-17 17:19:46 -04:00
Tim Pope
2fc1a0017c Accept buffer numbers and dictionaries in FugitiveDetect()
This makes it easier to use FugitiveDetect() to initialize a temp file
that sits outside of the repository.
2021-08-17 17:19:46 -04:00
Tim Pope
80e7c63fb1 Support jump to file under cursor in :Git -p grep
This also adds support for :Git -p status, since we basically already
have an implementation for it.
2021-08-17 17:18:20 -04:00
Tim Pope
2d3e83abe3 Improve git grep argument handling
Add a parsing special case for --count, and improve the handling of
--open-files-in-pager.
2021-08-17 13:07:41 -04:00
Tim Pope
b5e7e1ba24 Don't match :0: as line number in :Ggrep
This is explicitly to help with false positives in surrounding context
while grepping this very file, as :0: is used in numerous places to
reference blobs in the index.  We also use :1: and company in a few
places, but a robust fix is much harder.
2021-08-16 18:28:27 -04:00
Tim Pope
f3e92c7721 Deprecate CTRL-N and CTRL-P 2021-08-14 10:23:57 -04:00
Tim Pope
bec8e7b7c7 Don't override user maps with removal notices
Resolves: https://github.com/tpope/vim-fugitive/issues/1811
2021-08-14 10:23:28 -04:00
Tim Pope
6c53da0783 Use jobs for all Git execution helpers 2021-08-12 07:24:41 -04:00
Tim Pope
b709d9f782 Avoid shell with nvim terminal 2021-08-11 17:21:38 -04:00
Tim Pope
0b53a4daff Override GIT_INDEX_FILE when belonging to wrong repository
GIT_INDEX_FILE is typically set to index.lock when Vim is invoked by
`git commit`.  This effectively breaks Fugitive if you try to use it in
a different repository while inside that Vim session.  To remedy this,
we can instead point GIT_INDEX_FILE at the index file for the relevant
repository.

This also retools command preparation to allow for general purpose
environment variable overrides.
2021-08-11 17:02:26 -04:00
Tim Pope
7a34996886 Use jobs for FileReadCmd 2021-08-11 12:55:18 -04:00
Tim Pope
239089f6e7 Silently ignore trees in s:BlobTemp() 2021-08-11 12:49:37 -04:00
Tim Pope
f11b80022f Use jobs for calls to git update-index
This is our only use of Git that requires writing to stdin, so
shoehorning that behavior onto s:StdoutToFile() frees us from worrying
about that when designing a more general purpose API.
2021-08-11 10:59:54 -04:00
Tim Pope
56561e47a6 Use jobs to capture stdout to file 2021-08-11 04:46:07 -04:00
Tim Pope
8e4a677c7f Fix command preparation when no arguments, only flags 2021-08-10 03:10:03 -04:00
Tim Pope
35872c5dca Make prepare functions idempotent
This is limited to the single argument case so as not to interfere with
using an old command result to seed the Git dir for a new command.
2021-08-10 02:35:52 -04:00
Tim Pope
5853cb0fc3 Tweak documentation for FugitiveResult() 2021-08-10 02:35:52 -04:00
Tim Pope
b20e4145c7 Convert exec path to Vim path before accessing via filesystem 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
371a5062d3 Separate out flags when parsing Git arguments
This will enable us to construct an execution result dictionary similar
to FugitiveResult().
2021-08-10 00:25:49 -04:00
Tim Pope
4adf054a3f Fix fugitive#writefile() when staging new file 2021-08-08 22:45:10 -04:00
Tim Pope
19e7604839 Use Git paths when passing temp files to hash-object 2021-08-08 22:36:30 -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
55382eb722 Fix usage of index() 2021-08-07 16:19:02 -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
8def00c247 Homogenize calls to private exec helpers
Replace calls of the form f(dir, arg1, arg2) with f([dir, arg1, arg2]).
2021-08-07 15:51:07 -04:00
Tim Pope
8082606fd0 Fix direct usage of fnameescape()
I plan to lower the minimum Vim version back to 7.0 before shipping 3.4,
which means we can't assume the presence of fnameescape().
2021-08-07 15:51:07 -04:00
Tim Pope
2dc08dfe35 Rename and relocate s:TempCmd() 2021-08-06 22:00:55 -04:00
Tim Pope
a25d4d6961 Fix read command output into buffer with guioptions=! 2021-08-06 21:35:43 -04:00
Tim Pope
2d0f51679c Accept git_dir dict key in FugitivePrepare() 2021-08-06 21:35:43 -04:00
Tim Pope
99e65ce049 Fix error message generation in s:ReplaceCmd() 2021-08-06 21:35:43 -04:00
Tim Pope
ebc828ef7c Minimize use of combined stdout and stderr
Combined stdout and stderr is what system() gives us, so the plugin was
built around it.  But getting the same from jobs is annoying, so let's
eliminate all unnecessary uses of it.
2021-08-06 17:57:57 -04:00
Tim Pope
dc579a0dfb Don't trust git --version with nonzero exit status
This prevents parsing `zsh:1: command not found: git` as version "1:".

References: https://github.com/tpope/vim-fugitive/issues/1801
2021-08-06 17:28:33 -04:00
Tim Pope
e9f913ff8a Fix error message for system() failure with argument list 2021-08-05 17:29:02 -04:00
Tim Pope
3a5d8c8770 Tighten check for PowerShell to match Vim's behavior
Vim only checks for the lowercase "powershell", so we should do the
same.
2021-08-05 17:27:41 -04:00
Tim Pope
1da2c02421 Add Vim version constraint to new PowerShell support
Closes https://github.com/tpope/vim-fugitive/issues/1807
2021-08-05 16:29:40 -04:00
Tim Pope
7a087725ee Encourage FugitiveFind() over FugitiveGitDir() 2021-08-03 11:45:25 -04:00
Tim Pope
24fd3d9599 Eliminate use of ":write !"
This is a prerequisite of eliminating the use of the shell in favor of
direct execution via jobs.
2021-08-03 11:45:25 -04:00
Tim Pope
058ffa406d Fix determining Git version with custom Git command
Resolves: https://github.com/tpope/vim-fugitive/issues/1801
2021-07-29 08:25:05 -04:00
Tim Pope
11aee0ba82 Fix incorrect readfile() arguments 2021-07-28 15:53:56 -04:00
Tim Pope
c417518819 Use absolute path to /usr/bin/env
Based on the prevalence of /usr/bin/env shebangs, I trust it is safe to
hard code this.  Or at least, it's safer than trusting the user not to
create a script called env.
2021-07-27 15:35:35 -04:00
Tim Pope
93f25f6883 Fix omitted Git dir argument
This shouldn't matter in this context since it's designed only to
provoke an error message, but fix it anyways so it stops setting off
mental alarm bells.
2021-07-27 15:35:35 -04:00
Tim Pope
a41329ab7c Get remote URL with config rather than shelling out 2021-07-27 15:35:35 -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
6bacc1039c Decouple s:SystemError() from Git
Treat lists not as Git arguments but a generic argument list, to enable
avoiding the shell once this becomes job backed.
2021-07-26 12:04:52 -04:00
Tim Pope
d6edaf7a4d Document autocommands 2021-07-26 07:09:30 -04:00
Tim Pope
af5ba43aa3 Reference plugin file as canonical API documentation 2021-07-26 07:09:30 -04:00
Tim Pope
8b0a40dfa2 Remove "soft" qualifier from deprecated commands 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
Mike Williams
75b2a9a8da Improve PowerShell support with recent Vim
References: https://github.com/tpope/vim-fugitive/pull/1783
2021-07-24 07:28:07 -04:00
Dmytro Meleshko
a7c54990f0 Don't execute autocmds during :GBrowse with range 2021-07-21 18:23:26 -04:00
Tim Pope
de6495ae84 Better support for ssh config
* Respect User and Port in addition to Hostname.
* Support globs and negations in addition to literal host matching.
* Parse global config file in addition to user config file.
* Handle Include declarations.

References: https://github.com/tpope/vim-rhubarb/issues/65
2021-07-17 18:52:27 -04:00
Tim Pope
58516a13c6 Support expanding ## as argument list
Closes https://github.com/tpope/vim-fugitive/issues/1792
2021-07-16 18:38:00 -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
b5316d0e96 Avoid stepping on status window in :Gclog/:Gllog
Closes https://github.com/tpope/vim-fugitive/issues/1790
2021-07-12 15:49:14 -04:00
Tim Pope
e9f93be356 Generalize :GBrowse - to all temp buffers 2021-07-12 15:49:14 -04:00
Tim Pope
fd5b553029 Tighten loose regexp 2021-07-12 15:49:14 -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
7412370dc8 Don't assume unrecognized status headers are refs
Every time I experiment with adding a new header this burns me.
2021-07-10 17:56:29 -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
f920245d6b Avoid spurious window resizing in :Gdiffsplit
Closes https://github.com/tpope/vim-fugitive/issues/1787
2021-07-09 12:52:20 -04:00
Elias Norrby
5551853f34 Fix ternary expression in s:NullError
Only the leading part was removed in ae6f84a.

Fixes #1785
2021-07-08 08:59:46 -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
d11c90ad66 Save filenames from rename rather than splitting on " -> " 2021-07-04 10:36:49 -04:00
Tim Pope
ca03f1d069 Fix write in index with guioptions=! 2021-07-04 10:36:49 -04:00
Tim Pope
ae6f84adf3 Handle empty items when null splitting
This correctly handles the case of multiple consecutive nulls (which I
don't think Git every produces in practice) and also the case of a bogus
newline at the end (which seems to happen with PowerShell).

References https://github.com/tpope/vim-fugitive/pull/1783
2021-07-04 10:36:49 -04:00
Tim Pope
8e0a8abf08 Don't capture trailing count as part of section header
We don't need this, and it gets in the way.
2021-07-03 06:00:36 -04:00
Tim Pope
ca0ff578ad Move config getter implementation into autoload file 2021-07-03 06:00:36 -04:00
Tim Pope
24d1c60364 Unify location of blame maps 2021-06-25 17:14:37 -04:00
Tim Pope
79e2bd381a Fix pager usage for :Git reflog
Resolves: https://github.com/tpope/vim-fugitive/issues/1772
2021-06-19 19:39:21 -04:00
Tim Pope
857c107e5a Fix typo 2021-06-19 12:40:17 -04:00
Tim Pope
be9ff95f27 Avoid guioptions=! issues in :Git --paginate
Resolves: https://github.com/tpope/vim-fugitive/issues/1767
2021-06-11 17:41:37 -04:00
Tim Pope
c26b4b018a Fix shell escaping edge case on win32
This is a proactive fix; no erroneous behavior has been observed.
2021-06-11 17:41:37 -04:00
Tim Pope
41960996e0 Eliminate unnecessary redraw to clear up :Gdiffsplit sync issue
Resolves: https://github.com/tpope/vim-fugitive/issues/1750
2021-06-06 15:38:10 -04:00
Tim Pope
8886d97070 Fix missing bang on function declaration
This causes a error during reloading on older versions of Vim.
2021-06-06 15:38:10 -04:00
Tim Pope
f7f1413ed9 Disable PTY when using win32 Git in WSL
References: https://github.com/tpope/vim-fugitive/issues/1751
2021-06-02 23:00:19 -04:00
Tim Pope
10ed70a9c2 Don't call exists() on invalid function name
References: https://github.com/tpope/vim-fugitive/issues/1751
2021-05-31 19:37:14 -04:00
Tim Pope
9eec18e76b Guard against unloaded plugin in runtime files
This can happen if g:loaded_fugitive is set to disable the plugin, or in
a botched install.
2021-05-31 11:54:04 -04:00
Tim Pope
9871822dd5 Avoid possible hang on failure to start job
References: https://github.com/tpope/vim-fugitive/issues/1751
2021-05-28 17:20:01 -04:00
Tim Pope
6ae064c5aa Tighten match for commit under cursor in temp buffers
Closes https://github.com/tpope/vim-fugitive/issues/1756
2021-05-27 10:37:24 -04:00
Tim Pope
798f65a180 Fix variable reference in s:Remote() 2021-05-27 10:37:24 -04:00
Tim Pope
da8d532b1a Support default value as third FugitiveConfigGet() argument 2021-05-26 09:23:34 -04:00
Tim Pope
bee78a418f Unify use of FugitiveConfig helpers 2021-05-26 09:15:25 -04:00
Tim Pope
28afd12151 Handle quoted strings in g:fugitive_git_executable
Taking the option that was historically a shell command and treating it
as a space-delimited argument list means that there's no longer any way
to include a space in an argument.  Let's rectify that by reusing a
simplified version of the argument parser in s:SplitExpandChain(), which
handles both single and double quoted strings in a way similar to how
shells do it.

Of course, the ideal solution is to just use a list of strings to begin
with.  Support for that is added here as well.

References: https://github.com/tpope/vim-fugitive/issues/1751

# This is the commit message #2:

squash! Accept argument list for g:fugitive_git_executable
2021-05-26 08:53:51 -04:00
Tim Pope
dd01e40106 Use local not upstream branch name for :GBrowse default
When I first wrote this code, I believed push.default=upstream to be the
One True Way, and I used the upstream as the default branch when one
wasn't passed into :GBrowse.  Since then, my preferred workflow has
shifted to push.default=current, with my upstream pointed at the
repository's integration branch (typically master), which means :GBrowse
effectively ignores our current branch, which is less than helpful.

This change eliminates :GBrowse's use of the upstream tracking branch
except in 2 scenarios:

* When push.default=upstream
* When the current branch has never been pushed (since using the current
  branch would result in a 404).
2021-05-26 08:53:51 -04:00
Tim Pope
47a07a0a32 Standardize method for disabling foldmethod=marker
The foldmarker option does appear to be buffer local (despite being
documented as window local), so it should be safe to use this
everywhere.
2021-05-26 08:53:51 -04:00
Tim Pope
7a75c18554 Fix :Git mergetool line offset
This was broken in 895e56daca by
misreading a version constraint.

Resolves: https://github.com/tpope/vim-fugitive/issues/1755
2021-05-26 08:53:51 -04:00
Maksim Odnoletkov
c926aadfaf Fix deprecation error in :GBlame 2021-05-18 14:40:47 -04:00
Tim Pope
0868c30cc0 Tighten up diff highlighting
Closes https://github.com/tpope/vim-fugitive/issues/1747
2021-05-12 13:50:44 -04:00
Tim Pope
32b0d62663 Hunt other tabs for window on :tab Git
I'm not 100% sure if this is the correct (as in least surprising)
behavior, but it seems like as good of place as any to start.

Closes https://github.com/tpope/vim-fugitive/issues/1740
2021-05-02 06:52:14 -04:00
Faisal Shah
8f4a23e663 Fix capitalization 2021-04-23 16:22:00 -04:00
Tim Pope
f7a6097caa Change deprecated q and D maps to errors 2021-04-22 18:20:15 -04:00
Tim Pope
b227b887bb Replace HEAD with @
The @ shortcut for HEAD was introduced in 1.8.5, which we now require.
2021-04-16 15:19:39 -04:00
Tim Pope
895e56daca Require Git 1.8.5 or newer
The removed checks for 1.9 were rounded up 1.8.5 requirements.  This
version has everything we need.
2021-04-16 15:19:39 -04:00
Tim Pope
55e9f2f47e Fix README formatting 2021-04-16 15:19:39 -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
Rajit Banerjee
f037ce631a Add note about :Gvdiffsplit 2021-04-16 09:27:16 -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
4139dc521c Support :Gwrite +aftercommand
Closes https://github.com/tpope/vim-fugitive/pull/562
2021-04-15 10:15:29 -04:00
Tim Pope
f72ad60097 Only do "guessed" :Gwrite behaviors with no argument
These seem pretty silly these days and should probably be removed, but
let's start by reducing their scope.
2021-04-15 10:15:29 -04:00
Tim Pope
8686eb17e0 Fix :Git difftool work-tree paths
I don't think the change that this reverts was necessarily wrong,
but this isn't the best time in the release cycle to play whack-a-mole
with unintended consequences.

Closes https://github.com/tpope/vim-fugitive/issues/1732
2021-04-15 09:05:31 -04:00
Tim Pope
1d00a7392b Fix :GBrowse :/ in bare repositories 2021-04-13 13:01:07 -04:00
Tim Pope
054fca2269 Return empty string on FugitiveFind() with no Git dir
Previously, we would return a path from the current working directory in
this case, which was a good fallback for :Gedit but unhelpful for
general programmatic usage.
2021-04-13 08:08:59 -04:00
Tim Pope
7866e83cc2 Fix :Gedit / 2021-04-13 08:07:40 -04:00
Tim Pope
503c22f1f5 Fix status in bare repository 2021-04-13 08:03:28 -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
94bc89da0f Don't use pty on win32unix
This appears to work fine in some setups, but has the same problems
as regular win32 in others.  Most notably, for it to work properly with
the Vim included with Git for Windows, the experimental pseudo console
support must not be enabled.  Lacking a method to distinguish between
the two cases, I see no better option than disabling it on all win32unix
installations.

Closes https://github.com/tpope/vim-fugitive/issues/1726
2021-04-10 21:35:49 -04:00
Tim Pope
222c9ccbc6 Don't trigger BufWrite during :Git blame
Closes https://github.com/tpope/vim-fugitive/issues/1724
2021-04-08 21:26:55 -04:00
Tim Pope
8ede0aaf57 Provide :GBrowse behavior in blame buffers
If a line number is given, browse to the commit on that line.
Otherwise, browse to the file, same as if called from the original
buffer.

It would probably make more sense to open the corresponding blame page
on providers that support it, but that will have to wait on an API
change.

References https://github.com/tpope/vim-fugitive/issues/1214
2021-04-07 01:04:36 -04:00
Tim Pope
3a319cd5b8 Don't rely on current buffer's Git dir for :GBrowse
This makes :GBrowse fugitive://... work when the buffer name is from a
different repository.  It doesn't solve the harder problems of making it
work with a regular filename, or making it not bail early when the
current buffer doesn't belong to a repository at all.
2021-04-07 01:04:36 -04:00
Tim Pope
cd8bd39567 Support all <cword> style expansions
The previous implementation for <cfile> didn't handle <cfile>:h
correctly.  May as well support the rest of the gang while fixing this.
Note that unlike for % and #, these can return a commit in addition to a
file name.  Use a ":." expansion, as in "<cfile>:.", to get the
corresponding work tree file.
2021-04-07 01:04:36 -04:00
Tim Pope
d4d2b9c6b2 Ignore :GBrowse line numbers for non-blob objects
Pave the way to use these for other purposes.
2021-04-06 23:41:18 -04:00
Tim Pope
485251ec73 Provide "." and "<C-R><C-G>" in blame buffers 2021-04-06 23:41:18 -04:00
Tim Pope
50b57ba400 Fix double "fugitive:" in error message 2021-04-06 23:41:18 -04:00
Tim Pope
b4255d6679 Add notices to deprecated lowercase commands 2021-04-06 20:43:26 -04:00
Tim Pope
87b169728c Add aliases for blame "-" map
This is one of the more common conflicts people have with their own
maps, so make it available on "s" and "u".  This roughly lines up with
the status buffer maps, which I think is as good of decision as any,
lacking a better mnemonic.
2021-04-06 20:43:26 -04:00
Tim Pope
f29c9e5079 Support :GBrowse {url} outside of Git repository 2021-04-04 18:26:17 -04:00
Tim Pope
81074db0ee Pass <mods> along to URL opener
I don't know if there is a use for this, but it seems like the right
thing to do.
2021-04-03 23:35:42 -04:00
Tim Pope
2ef9d9a748 Use :echo not :echomsg for displaying :GBrowse URL
Logging the URL permanently to :messages was a mistake.
2021-04-03 23:35:42 -04:00
Tim Pope
ce58344c9e Jump to correct Unpushed/Unpulled section on reload 2021-04-03 20:44:31 -04:00
Tim Pope
e474785adb Handle non-config dictionary passed to FugitiveConfig() 2021-04-03 20:44:31 -04:00
Tim Pope
d3341147ef URL escape :command special characters
Handle the case where the :Browse or :OpenBrowser command we delegate to
is defined with -bar.
2021-04-03 20:44:31 -04:00
Tim Pope
1a765a46c1 Add git_dir key to :GBrowse API
This enables passing the whole options dictionary to helpers like
FugitiveWorkTree().
2021-04-03 20:44:31 -04:00
Tim Pope
5a54ea4333 Handle race condition closing job stdin
This race condition is there for any key press, but it's greatly
exaggerated by Vim's default one second timeout on Escape.  This delay
also disqualifies Escape as the official interface to this feature, but
leave it as a DWIM alternative to CTRL-D for now.

Closes https://github.com/tpope/vim-fugitive/issues/1722
2021-04-01 20:50:34 -04:00
Tim Pope
1d91517cdb Don't discard deleted submodules
There isn't a good command to use for the undo.

References https://github.com/tpope/vim-fugitive/issues/1705
2021-04-01 20:50:34 -04:00
Tim Pope
c028ea5a44 Add foldtext for hunk headers 2021-04-01 08:57:58 -04:00
Tim Pope
88f50bba60 Press escape to background :Git to preview window
This can one day hopefully be generalized to handle --paginate, but for
now, leave it as undocumented experiment.
2021-03-31 16:06:40 -04:00
Tim Pope
9bd7c26466 Expand <cfile>
This doesn't play well with :Git as it can result in a fugitive:// URL,
but it does make :Gedit <cfile> and :GBrowse <cfile> do what I mean.
2021-03-31 16:05:14 -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
a1cb01da5b Provide :Gedit - to open previous :Git output
Also, provide :GBrowse - to open the first URL contained in that output.
2021-03-29 21:20:28 -04:00
Tim Pope
6b39f6c641 Restore X on submodules
References https://github.com/tpope/vim-fugitive/issues/1705
2021-03-29 20:32:11 -04:00
Tim Pope
09cbabe793 Don't trigger FugitiveChanged until :Git finishes output
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".
2021-03-29 19:33:01 -04:00
Tim Pope
258dd16938 Fix undesired line wrap in :Git output
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.
2021-03-28 14:42:46 -04:00
Tim Pope
112310c026 Move edit sentinel removal out of resume handler
Enable using this function in cases other than pausing for edit.
2021-03-28 14:42:46 -04:00
Tim Pope
f4acdcc5b4 Eliminate blank line after resuming from GIT_EDITOR
Also add has_key(a:tmp, 'echo') checks to allow for future async
workflows.
2021-03-27 23:08:13 -04:00
Tim Pope
f7321f6d5b Allow close callback to run before leaving job wait loop
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.
2021-03-27 23:08:13 -04:00
Tim Pope
00cb68e627 Echo from wait loop, not job callback
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
2021-03-27 15:38:29 -04:00
Tim Pope
af1a46edb7 Don't record last job until after completion
This prevents orphaning a :Git commit when calling a second :Git command
while editing the commit message, and is more predictable all around.
2021-03-27 15:38:29 -04:00
Tim Pope
eaee845aba Unify remote resolution
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.
2021-03-26 12:26:27 -04:00
Tim Pope
6860c592ad Capture cwd of :Git command 2021-03-26 12:26:27 -04:00
Tim Pope
a12e88bcc2 Add error message when editing after Vim exit
I don't think it's possible to see this, but we can use this error
delivery system for other purposes.
2021-03-26 12:26:21 -04:00
Tim Pope
0713b84f97 Don't wait silently on :wall with 'confirm' 2021-03-26 12:26:21 -04:00
Tim Pope
93b434949b Don't try to send :Git process CTRL-C when stdin is closed
Curiously, this appears to work anyways in Neovim, but not Vim.
2021-03-25 19:32:50 -04:00
Tim Pope
7de9b5a04b Retool :Git blame colored commits
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.
2021-03-25 11:34:29 -04:00
Tim Pope
b2195e7690 Extract fugitiveblame ftplugin
References https://github.com/tpope/vim-fugitive/issues/1425
2021-03-24 21:17:37 -04:00
Tim Pope
5e5ce843ea Automatically mkdir when editing .git/info/exclude 2021-03-24 19:56:08 -04:00
Tim Pope
a03444404a Capture exit status of :Git 2021-03-24 17:42:16 -04:00
Tim Pope
64a3f99d03 Pass private job state to s:RunWait() 2021-03-24 17:42:16 -04:00
Tim Pope
9103a738c7 Fix :GBrowse with no argument 2021-03-24 17:42:16 -04:00
Tim Pope
156dbcd738 Don't set foldmethod=syntax in historical buffers
This was originally implemented in part to address the marker fold
method triggering on diffs, so try to still solve that.
2021-03-24 14:21:32 -04:00
Tim Pope
133bf406c7 Accept alternate syntax for :GBrowse remote
The @ syntax is kind of weird as you can't use fnameescape() to get
around it.  Add an alternative syntax for programmatic usage.
2021-03-24 14:21:32 -04:00
Tim Pope
d5d436bfa3 Tweak default list of paginated commands
The only functional change here should be the exclusion of the diff-*
plumbing commands.
2021-03-24 14:21:17 -04:00
Tim Pope
53df837ac6 Don't complete directories as subcommands 2021-03-24 14:20:45 -04:00
Tim Pope
0205ae8d45 Handle tabs in commit subject
References https://github.com/tpope/vim-fugitive/pull/1713
2021-03-24 14:20:45 -04:00
Tim Pope
11b824a0ee Forcefully disable colors on paginated :Git output
References https://github.com/tpope/vim-fugitive/discussions/1711
2021-03-24 14:20:45 -04:00
Tim Pope
857496c32f Unify temp state and job state 2021-03-23 13:39:45 -04:00
Tim Pope
9715dbe19e Replace broken check for nvim 0.5.0
Apparently has('nvim-0.5.0') actually means "any nightly release after
0.4.4".  I guess we'll have to settle for 0.5.1?

Closes https://github.com/tpope/vim-fugitive/issues/1709
2021-03-23 13:39:45 -04:00
Tim Pope
58d2b25836 Use git --list-cmds= to complete subcommands
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
2021-03-21 10:13:42 -04:00
Tim Pope
1999aef8cd Retool completion of subcommands
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
2021-03-21 10:13:42 -04:00
Tim Pope
a55d6f39c8 Paginate :Git whatchanged 2021-03-21 10:13:42 -04:00
Tim Pope
4e285c8137 Clean up argument splitting utility functions 2021-03-21 07:08:16 -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
10ed587f65 Capture :Git job output to temp file
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.
2021-03-19 23:39:42 -04:00
Tim Pope
04b0b26f84 Fix diff in status buffer
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
2021-03-19 23:37:15 -04:00
Tim Pope
4ea84b29eb Default coo to identifier under cursor in temp buffers
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
2021-03-19 20:29:16 -04:00
Tim Pope
7bee1113e3 Don't automatically enable syntax folding in status buffer
Closes https://github.com/tpope/vim-fugitive/issues/1565

References https://github.com/tpope/vim-fugitive/issues/1317
2021-03-19 20:29:16 -04:00
Tim Pope
4e85dd3424 Revert "Support X for submodules"
I should have looked closer because because I didn't realize "Support X
for submodules" meant "make it do something completely unrelated".

This reverts commit a21ca7e86e.

References https://github.com/tpope/vim-fugitive/issues/1705
2021-03-19 03:13:52 -04:00
Tim Pope
0508885550 Don't clobber alt buffer with :Gread
Why does :read do this???
2021-03-19 02:49:08 -04:00
Tim Pope
99fccd08e2 Make :Gdiffsplit! from common ancestor stage open ours and theirs
References https://github.com/tpope/vim-fugitive/issues/1706
2021-03-19 02:48:56 -04:00
Tim Pope
0858688120 Don't expand # in :GBrowse http://example.com/#anchor 2021-03-19 02:48:56 -04:00
Tim Pope
91089715f4 Update env workarounds for nvim
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.
2021-03-19 02:48:56 -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
563faf95b8 Remove broken deprecated :Git merge calling mergetool
Closes https://github.com/tpope/vim-fugitive/issues/1704
2021-03-18 16:48:10 -04:00
Tim Pope
d7c2e50816 Partition public and private job state 2021-03-18 01:49:08 -04:00
Tim Pope
39d904051d Avoid :normal during status reload
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.
2021-03-18 01:48:46 -04:00
Tim Pope
e89d22e5da Use unambiguous option keys for subcommand delegation 2021-03-18 01:44:28 -04:00
Tim Pope
d73fe3c192 Fix inline diff expansion when foldmethod is not syntax
Also rearrange, so any other errors here don't break the basics.
2021-03-16 20:11:32 -04:00
Tim Pope
caf2907fd8 Retool discard operation during conflict
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
2021-03-16 16:27:38 -04:00
Tim Pope
cc525c99df Fix remaining :Gremove and :Gmove references 2021-03-16 16:27:38 -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
3eb6f316c0 Act globally when invoking inline diff maps on Head: line
Closes https://github.com/tpope/vim-fugitive/issues/1563
2021-03-15 23:40:48 -04:00
Tim Pope
776ce315c4 Ensure open folds after expanding inline diff 2021-03-15 23:40:48 -04:00
Tim Pope
e3b7cce2e6 Feed custom file under cursor into netrw's gx
References https://github.com/tpope/vim-fugitive/issues/1550
2021-03-15 23:38:09 -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
f2956a923d Set b:git_dir early in BufReadCmd
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.
2021-03-13 23:34:13 -05:00
Tim Pope
36f9211da2 End the guioptions+=! reign of terror
Changing :! was bad enough, but I cannot possibly fathom why
this affects system() too. Didn't we learn our lesson about options
affecting VimL execution from 'ignorecase'?

Closes https://github.com/tpope/vim-fugitive/issues/1416

Closes https://github.com/tpope/vim-fugitive/issues/1437

Closes https://github.com/tpope/vim-fugitive/issues/1533

References https://github.com/tpope/vim-fugitive/issues/1042
2021-03-13 18:01:06 -05:00
Tim Pope
977e3c805d Fix staging partial hunk near EOF lacking newline
This is a blind, untested fix.

Closes https://github.com/tpope/vim-fugitive/issues/1609
2021-03-13 17:53:59 -05:00
Tim Pope
a4a9acf44e Add initial :echo before job
This fixes output for `:echo 123|Git status`.
2021-03-13 17:53:59 -05:00
Tim Pope
b962714fcd Replace blame shell fiddling with s:TempCmd()
References https://github.com/tpope/vim-fugitive/issues/1644
2021-03-12 23:42:11 -05:00
Tim Pope
e704d15787 Fix tab complete of tree objects
Closes https://github.com/tpope/vim-fugitive/issues/1529
2021-03-12 23:38:11 -05:00
Tim Pope
6356bbc4a7 Fix argument parsing of :Gedit fugitive:\\...
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
2021-03-12 22:07:19 -05:00
Tim Pope
423aed15fc Delete backing temp file upon wiping buffer
We should probably default buftype to wipe so that these don't stack up
indefinitely by default, but one step at a time.
2021-03-12 18:21:21 -05:00
Tim Pope
1ccb082753 Rename temp state bufnr field to origin_bufnr
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.
2021-03-12 17:25:52 -05:00
Tim Pope
d0e277c7be Don't try to reuse terminal buffers for status window edits
Closes https://github.com/tpope/vim-fugitive/issues/1652
2021-03-11 01:40:44 -05:00
Tim Pope
4fa53ad329 Add a FAQ about symlinks 2021-03-11 01:40:44 -05:00
Tim Pope
753318ef83 Smarter diff jumping in :Git log
Closes https://github.com/tpope/vim-fugitive/issues/1689
2021-03-09 21:06:52 -05:00
William Durand
9cba97f4db Add sourcehut plugin for :GBrowse to README 2021-03-01 01:13:34 -05:00
Tim Pope
601bf2e225 Provide some <mods> handling on quickfix commands
Most notably, don't force an early redraw with :silent.

Closes https://github.com/tpope/vim-fugitive/issues/1685
2021-02-27 08:37:41 -05:00
Tim Pope
fad16e502a Better handling of git blame variable width date formats 2021-02-27 08:37:41 -05:00
Ian Homer
6c4c7c9aeb Account for closing windows when reloading status 2021-02-21 22:51:23 -05:00
Tim Pope
9e378fd9aa Resolve temp name used in :Git
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.
2021-02-21 14:56:41 -05:00
Tim Pope
783ec701fe Work around 'suffixes' in :Git completion
Closes https://github.com/tpope/vim-fugitive/issues/1682
2021-02-21 14:54:43 -05:00
Tim Pope
d1e74ac267 Move :Git --paginate helper function into :Git section 2021-02-20 21:59:03 -05:00
Tim Pope
eb4d75efb6 Fix :Gedit worktree-file
Closes https://github.com/tpope/vim-fugitive/issues/1679

References https://github.com/tpope/vim-fugitive/issues/1667
2021-02-19 18:47:13 -05:00
Tim Pope
0a35937003 Provide error message when Netrw can't be loaded 2021-02-16 21:04:13 -05:00
Tim Pope
c63bc47c44 Remove obsolete push/fetch docs 2021-02-15 20:11:56 -05:00
Tim Pope
d6809e9ee4 Use stderr for in-band job communication
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.
2021-02-15 20:11:56 -05:00
Tim Pope
15f32b0008 Guard against diff.noprefix in commit buffers 2021-02-15 20:11:56 -05:00
Sam Cedarbaum
22384947a0 Add Azure DevOps :GBrowse extension to README 2021-02-15 14:31:45 -05:00
Tim Pope
d4bcc75ef6 Remove dispatch.vim backed fetch and push 2021-02-12 18:35:28 -05:00
Tim Pope
0cc2190889 Add deprecation notices to git subcommand wrappers 2021-02-12 18:35:28 -05:00
Tim Pope
4c5f6fcaf5 Retire old :Gsplit! family of temp buffer commands 2021-02-12 13:49:07 -05:00
Tim Pope
5c821eb78d Don't default to work tree on :Gedit invalidref:file
Closes https://github.com/tpope/vim-fugitive/issues/1667
2021-02-11 17:05:05 -05:00
Tim Pope
8cf0cf5bfb Emphasize poor quickfix performance in docs
References https://github.com/tpope/vim-fugitive/issues/1662
2021-01-25 22:44:03 -05:00
Andreas Hunkeler
bebe504e38 Fix typo in helpfile 2020-12-17 04:13:22 -05:00
Tim Pope
7afa1cfaa6 Avoid presenting verbose command output as error
References https://github.com/tpope/vim-fugitive/issues/1643
2020-12-07 18:59:28 -05:00
Tim Pope
7bcfe539be Avoid window shenanigans if :diffoff restores options
Closes https://github.com/tpope/vim-fugitive/issues/1634
2020-11-27 09:40:22 -05:00
Tim Pope
866ecfff4e Enable Help: header
This change was inadvertantly omitted from
d2abfca08f.

References https://github.com/tpope/vim-fugitive/issues/1513
2020-11-24 02:01:39 -05:00
Pavol Juhas
e90478511d Restore correct cursor position in commit buffer
Use `lockmarks` in fugitive#BufReadCmd to avoid offsetting marks.
2020-11-24 02:00:14 -05:00
Maksim Odnoletkov
660d2ba2b6 Fix jumps from blame commits with ignore marks
c212d854d5 added initial support for
marks added by blame.markIgnoredLines and blame.markUnblamableLines.

One more change is needed to parse the blame line properly to enable
jumps.
2020-11-20 21:01:21 -05:00
Tim Pope
1a77f1c00e Recover from deleted temp script
Closes https://github.com/tpope/vim-fugitive/issues/1616
2020-10-26 20:31:54 -04:00
Tim Pope
89e6b5e4e1 Disable 'swapfile' early
This should eliminate the need to disable 'swapfile' in
fugitive#BufReadCmd(), but I'm inclined not to fix what isn't broken.

Closes https://github.com/tpope/vim-fugitive/issues/1598
2020-10-11 20:42:35 -04: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
e12236b60a Fix reference to renamed function
Closes https://github.com/tpope/vim-fugitive/issues/1606
2020-09-27 06:05:05 -04:00
Ryosuke Ito
12011a475d Disable spell checking while blaming 2020-09-26 14:40:36 -04:00
Tim Pope
8080407ae9 Provide public diff closing function
Closes https://github.com/tpope/vim-fugitive/pull/1587
2020-09-26 12:21:52 -04:00
Tim Pope
49315d0c74 Fix :Gwrite DWIM in commit messages
Closes https://github.com/tpope/vim-fugitive/issues/1599
2020-09-24 07:32:12 -04:00
Tim Pope
4824b5b3fe Avoid empty string keys to prevent Vim 7 error
Closes https://github.com/tpope/vim-fugitive/issues/1113
2020-09-24 03:49:23 -04:00
Wu Yongwei
511d3035d4 Fix: digits in a user name was highlighted as time 2020-08-26 17:39:35 -04:00
Tim Pope
260182c65c Support partial staging after git add -N
Closes https://github.com/tpope/vim-fugitive/issues/1567
2020-07-30 21:36:29 -04:00
Tim Pope
9b6a24b131 Fix tab complete for :Git push --option
Closes https://github.com/tpope/vim-fugitive/issues/1570
2020-07-27 19:57:50 -04:00
Tim Pope
1da7c133b1 Recommend :Git log over :Gclog
Closes https://github.com/tpope/vim-fugitive/issues/1556
2020-06-27 16:39:43 -04:00
Tim Pope
27a5c3abd2 Trigger OptionSet on automatic :diffoff
Closes https://github.com/tpope/vim-fugitive/issues/1545
2020-05-31 00:50:49 -04:00
Tim Pope
03fa78141e Improve weird :Ggrep --column quickfix title 2020-05-31 00:50:49 -04:00
Tim Pope
f1a75478cb Tighten syntax highlighting for SHA 2020-05-31 00:50:49 -04:00
Tim Pope
0646a53c6b Add Help: header
Closes https://github.com/tpope/vim-fugitive/issues/1513
2020-05-31 00:50:49 -04:00
Tim Pope
d2abfca08f Refactor run loop 2020-05-31 00:50:49 -04:00
Tim Pope
e87fe092a2 Extract s:RunEdit() 2020-05-31 00:50:49 -04:00
Maksim Odnoletkov
5d32f75289 Fix stash map
`czz` used to act without confirmation before. But
6b40e51008 changed it to require `<CR>`.
Given that `czw` keeps working without confirmation and that there
is a separate `cz<Space>` map - seems like the change was not intended?
2020-05-28 17:05:45 -04:00
Tim Pope
caf3b1d569 Don't default :Git grep to --column
If you want this, you can pass --column yourself, or set the grep.column
config option.  This is probably going to change for :Ggrep, too.
2020-04-24 23:05:39 -04:00
Tim Pope
f17a91d010 Provide completion relative to working directory 2020-04-24 23:01:38 -04:00
Tim Pope
5dfe8581ca Extract :Ggrep/:Glgrep wrapper function 2020-04-24 23:01:38 -04:00
Tim Pope
92ad06f70d Use parameterized Git dir when completing heads 2020-04-24 23:01:37 -04:00
Tim Pope
05bbfcd0dc Remove commit entry from :{range}Glog 2020-04-21 13:44:34 -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
f5391f0bfc Fix race condition resuming job after editor invocation
Closes https://github.com/tpope/vim-fugitive/issues/1489
2020-04-12 11:47:38 -04:00
Tim Pope
53dd9b3957 Encapsulate update-index --index-info 2020-04-08 04:06:24 -04:00
Tim Pope
792f51a58b Leverage Git config retrieval helpers 2020-04-08 02:51:55 -04:00
Tim Pope
a9bf9de61d Move Quickfix section under Git section 2020-04-08 02:51:55 -04:00
James Wright
0e35c9bbc7 Fix typos in README
Fixes #1493
2020-03-21 21:36:07 -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
Patrice Peterson
ccf582838b Fix some inconsistencies in help mappings
Some didn't use `<silent>` or `<C-U>`.
2020-03-12 09:30:14 -04:00
Patrice Peterson
d3cdb3208d Have remaining mappings use S:Map()
There were a few mappings left that weren't customizable with
g:[onx]remap. This makes them configurable.
2020-03-12 09:30:14 -04:00
Tim Pope
4a24804adc Rewrite feature summary in README 2020-03-10 12:46:26 -04:00
Tim Pope
5ad42e307f Factor in 8.2.0239 when checking for job env support 2020-03-10 12:46:26 -04:00
Tim Pope
68f570ec38 Enable closing stdin by pressing CTRL-D
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.
2020-03-10 12:46:26 -04:00
Tim Pope
12e43b62cc Don't use "Head:" header for commit under cursor
This is the first line of the file so it's an annoyingly aggressive
default.
2020-03-10 12:46:26 -04:00
Tim Pope
ffd7042c15 Fix echoed line during :Gread 2020-03-10 12:46:26 -04:00
Tim Pope
dbc8d9a32c Fix list indexing bug 2020-03-05 13:21:50 -05:00
Tim Pope
e06005a742 Fix staging hunk that comes after binary file
Closes https://github.com/tpope/vim-fugitive/issues/1462
2020-03-05 08:43:03 -05:00
Tim Pope
8388b6d0fb Use status headers for commit maps
Closes https://github.com/tpope/vim-fugitive/issues/1485
2020-03-04 10:30:20 -05:00
Tim Pope
7ae214e445 Fix erroneous temp buffer on non-listing :Git branch 2020-03-03 09:36:04 -05:00
Tim Pope
3c3e6ea67b Support most top level Git options 2020-03-02 04:24:26 -05: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
8aaf744f2a Don't rely on rebase --autosquash shorthand
I'm starting to think this is more confusing than helpful.
2020-03-02 04:24:26 -05:00
Tim Pope
d102dd92fd Fix :GRename ../
Closes https://github.com/tpope/vim-fugitive/issues/1481
2020-03-02 02:40:09 -05:00
0xACE
9acced1409 Fix typo 2020-03-01 19:32:25 -05:00
Tim Pope
3bd69748c3 Remove remaining :Gsubcmd calls from implementation 2020-02-29 22:37:57 -05:00
Tim Pope
abb4a26c1e Fix internal documentation command references 2020-02-29 22:37:57 -05:00
Tim Pope
3e59a79e48 Move :Ggrep docs near other :Gcommands 2020-02-29 22:37:57 -05:00
Tim Pope
e84f023edf Remove redundant exists(':Gblame') check
This command used to be restricted to file and blob buffers, but now
it's global, not to mention deprecated, and the check serves no purpose.
2020-02-29 22:37:57 -05:00
Tim Pope
d0dceb9feb Change subtopic help tag style from :Git- to :Git_
This is less Git-like, but a bit more Vim-like, and doesn't force us
into the awkward :Git---paginate.
2020-02-29 22:37:57 -05:00
Tim Pope
025151bc78 Fix deletion of trailing fold upon loading blob
Closes https://github.com/tpope/vim-fugitive/issues/1479
2020-02-29 22:37:45 -05:00
Tim Pope
aada6479cf Use :Gsubcmd completion for :Git subcmd 2020-02-29 07:38:35 -05:00
Tim Pope
6b40e51008 Remove most uses of s:EchoExec()
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.
2020-02-29 07:38:35 -05:00
Tim Pope
c452181975 Remove old :Git! temp buffer behavior
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.
2020-02-23 18:10:47 -05:00
Tim Pope
430253c302 Drop support for non-PTY :!
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.
2020-02-23 18:10:47 -05:00
Tim Pope
a5c921190a Override existing config values on :Git -c config.option= 2020-02-23 15:41:10 -05:00
Tim Pope
31629d8bd1 Use :read for :{range}Git! --paginate 2020-02-23 00:26:37 -05:00
Tim Pope
5a5a95b90a Tease apart bang and non-bang variants of :Gread 2020-02-23 00:26:36 -05:00
Tim Pope
87f998e15f Remove erroneous :Gedit! deprecation
The ! to :Gedit has always been passed to :edit and not used for Git
execution like the others.
2020-02-22 20:56:27 -05:00
Tim Pope
2acea41bef Handle custom Git executable for :Git --paginate 2020-02-22 20:14:33 -05:00
Tim Pope
c0aad3ac78 Update internal uses of :Git! to :Git --paginate 2020-02-22 20:14:33 -05:00
Tim Pope
8b83d6ec6c Use :pedit for :Git! --paginate 2020-02-22 20:14:33 -05:00
Tim Pope
efb1c8a29d Add - map for Push header 2020-02-22 20:14:33 -05:00
Rob Pilling
9e4a5239ee Respect 'wildignorecase' when completing :Gedit 2020-02-20 16:07:24 -05:00
Rob Pilling
349b18d373 Pull out s:fileignorecase() 2020-02-20 16:07:24 -05:00
Tim Pope
2e67f82b79 Refine handling of pagination via temp buffer
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
2020-02-18 21:00:01 -05:00
Tim Pope
a81ba999e8 Correctly treat config keys without values as true 2020-02-18 20:59:50 -05:00
Tim Pope
cb1300d751 Deprecate :Gsplit! family in documentation 2020-02-18 20:59:49 -05:00
Tim Pope
d10dc9ea93 Quarantine deprecated commands in documentation 2020-02-18 14:09:24 -05:00
Tim Pope
2401f1a7da Work around minibufexpl/autochdir induced error
Closes https://github.com/tpope/vim-fugitive/issues/1456
2020-02-18 12:33:58 -05:00
Appu Joseph
81ca98d7e8 Fix Trailing Characters, Invalid range error for :<count>Gstatus
Correct the position of newly added keepalt option from
'botright <count>keepalt split' to 'botright keepalt <count>split'
2020-02-18 10:15:07 -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
9f69019424 Partially support :Git difftool on old Git 2020-02-15 20:18:15 -05:00
Tim Pope
98f67310aa Parameterize subcommand Git executable 2020-02-15 20:18:09 -05:00
hitsuji no shippo
460664018a Fix typo --include-index to --keep-index in help 2020-02-05 20:25:34 -05:00
Tim Pope
0e6f72b005 Allow custom subcommands outside of Git repository 2020-02-05 14:40:22 -05:00
Tim Pope
e144a9f559 Extract helper for setting job environment 2020-02-05 14:40:22 -05:00
Tim Pope
df3ac9d278 Enable opening arbitrary URLs with :Gbrowse
This is still doing a lot of unnecessary processing looking for a
remote, but it doesn't seem to hurt anything.
2020-02-05 14:40:22 -05:00
Tim Pope
3c45ed0d13 Fix false positive on deprecated :.Glog usage 2020-02-05 14:27:27 -05:00
Tim Pope
a95972cefc Don't clobber alternate buffer on :Gstatus 2020-02-05 12:48:47 -05:00
Tim Pope
18582f4986 Remove deprecated C map to fix broken warning
https://github.com/tpope/vim-fugitive/issues/1458
2020-02-05 12:48:47 -05:00
Tim Pope
083f3c23cc Preserve existing 'scrollbind' arrangement with :Gblame
Closes https://github.com/tpope/vim-fugitive/issues/1449

Closes https://github.com/tpope/vim-fugitive/issues/1327
2020-02-03 11:25:49 -05:00
Tim Pope
9ecd6ebf92 Eliminate last temporary :cd
The new git_chomp and git_chomp_in_tree aren't 100% backwards
compatible, but these functions are deprecated anyways.  Use
system(FugitivePrepare(...)) instead.
2020-02-03 10:17:37 -05:00
Tim Pope
3221cdfbde Support :Git -c config.name=value 2020-02-02 15:31:02 -05:00
Tim Pope
8e90d82eb4 Use --no-optional-locks for :Gstatus
This clears up some intermittent errors during :Git rebase, although I
must admit I don't really understand why, as the status reload shouldn't
be happening at the same time :Git is running.
2020-02-01 10:49:35 -05:00
Tim Pope
1c1014a046 Continue running commands on Vim exit
Closes https://github.com/tpope/vim-fugitive/issues/1447
2020-01-30 13:01:17 -05:00
Tim Pope
268a9c1b8f Don't make assumptions about current line number when displaying commit 2020-01-26 17:39:32 -05:00
Tim Pope
fc0199555e Extend nvim carriage return workaround to ptys
References https://github.com/tpope/vim-fugitive/issues/1445
2020-01-26 15:37:02 -05:00
Tim Pope
d926e3beb4 Try to wipe out temp buffer from :read
Also try to preserve marks.
2020-01-26 10:57:19 -05:00
Tim Pope
40872a9555 Don't use job pty unless Vim supports it
Closes https://github.com/tpope/vim-fugitive/issues/1444
2020-01-26 08:01:34 -05:00
Tim Pope
279d56eb47 Show unpulled before unpushed
This is what Magit does and I *think* it makes sense because you have to
pull before you can push.
2020-01-26 07:24:02 -05:00
Tim Pope
54b308eedb Revert work in progress changes
This partially reverts commit cd7db1d57c.
2020-01-26 07:24:02 -05:00
Tim Pope
655f7c92f3 Show unpushed and unpulled sections for both upstream and push
References https://github.com/tpope/vim-fugitive/issues/1436

References https://github.com/tpope/vim-fugitive/issues/1172
2020-01-25 20:34:28 -05:00
Tim Pope
477f26cf50 Include refs/heads in constructed push commands
Also swap out :Gpush for :Git push while we are at it.
2020-01-25 20:20:02 -05:00
Tim Pope
76ffaf4e7d Recognize pull.rebase=preserve in :Gstatus 2020-01-25 18:31:03 -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
cd7db1d57c Replace old public detection API with hint errors 2020-01-24 17:15:25 -05:00
Tim Pope
036fe0f084 Job environment variables are broken on Neovim
Closes https://github.com/tpope/vim-fugitive/issues/1443
2020-01-24 05:46:41 -05:00
Tim Pope
22255613f7 Replace :Gcommit/:Grevert with standard job runner 2020-01-23 05:52:27 -05:00
Tim Pope
c989c1f59e Replace :Grebase/:Gmerge/:Gpull with standard job runner 2020-01-23 05:52:27 -05:00
Tim Pope
6b18f7b758 Remove :Gwrite in :Git diff 2020-01-23 05:52:27 -05:00
Tim Pope
8d6f9734c1 Use jobs for :Git 2020-01-23 05:52:27 -05:00
Tim Pope
4301c57f24 Extract helper script creator function 2020-01-23 05:52:27 -05:00
Tim Pope
7f22cc6167 Revert "Specify shell command, not wrapper, in b:dispatch"
This reverts commit 5bcb42164e.
2020-01-23 03:49:14 -05:00
Tim Pope
9d62c67737 Remove legacy autocommands 2020-01-22 09:44:07 -05:00
Tim Pope
71038e83f1 Try to use relative path for :Ggrep
References https://github.com/tpope/vim-fugitive/issues/1439
2020-01-21 15:29:29 -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
Tim Pope
29153d5ba1 Provide git config --get-all wrapper 2020-01-20 15:42:54 -05:00
Tim Pope
8d4b85ed09 Replace --format with --pretty=format for older Git 2020-01-20 15:42:54 -05:00
Tim Pope
708595d996 Fix comment typo 2020-01-20 15:42:45 -05:00
Chris DeLuca
dc6719e7b0 Fix :Gdiffsplit! help typo 2020-01-20 10:27:14 -05:00
Tim Pope
c48db08e4e Use appropriate slashes for :Dispatch working directory 2020-01-20 10:27:00 -05:00
Tim Pope
2ebdeef9e0 Change :Git --paginate from :terminal to temp buffer
The --paginate option to Git forces it to use $PAGER rather than its own
configuration, so it makes perfect sense for Fugitive to take on the
role of the pager.

This also removes the same behavior for --no-pager, allowing the command
to run with :! instead.  I really don't like sudden backwards
incompatible changes like this, but the old behavior was based on a bad
understanding of how these options work, and I'd rather rip the band-aid
off sooner rather than later.
2020-01-20 09:03:49 -05:00
Tim Pope
bc0b78ee84 Remove dead code 2020-01-20 08:42:02 -05:00
Tim Pope
5bcb42164e Specify shell command, not wrapper, in b:dispatch
This frees us up to change :Gfetch not to use :Make.
2020-01-20 07:28:55 -05:00
Tim Pope
1a6934fc7e Fix FugitiveParse() return value documentation 2020-01-20 07:03:48 -05:00
Tim Pope
397fb99921 Provide FugitiveBlob style autocommands
This is the real replacement for fugitive#buffer().type(), as the only
real world use of that seemed to be in BufReadPost autocommands.
2020-01-20 05:52:22 -05:00
Tim Pope
5b1213d0db Fix :Gmerge 2020-01-20 05:52:22 -05:00
Tim Pope
ae52b5a96a Better PowerShell support 2020-01-18 01:30:43 -08:00
Tim Pope
9f032ed040 Prevent alternate buffer change loading Fugitive buffer 2020-01-18 00:51:38 -05:00
Tim Pope
d428032600 Fix netrw gx in Fugitive buffers AGAIN 2020-01-18 00:45:17 -05:00
Tim Pope
c83355d5c5 Accomodate loading Fugitive buffers in popup window
Closes https://github.com/tpope/vim-fugitive/issues/1418
2020-01-15 01:26:31 -05:00
Tim Pope
4732bb964a Generalize :Git environment variable overrides 2020-01-14 22:56:11 -05:00
Tim Pope
3e32a55619 Avoid false positives on rebase todo handler 2020-01-14 22:56:11 -05:00
Tim Pope
a65db6fcf8 Move :Gmerge warning to top level function
The old location isn't long for this world.
2020-01-14 22:56:11 -05:00
Tim Pope
305337a9c1 Begin phasing out :Git --paginate special case
This was a mistake.  I took --paginate to be the opposite of --no-pager,
but it forces $PAGER over $GIT_PAGER and pager configuration.  This
defeats the purpose of using it as way to trick :Git into running a
regular command with :terminal.

References https://github.com/tpope/vim-fugitive/issues/1415
2020-01-14 20:43:21 -05:00
Tim Pope
6a638f2392 Match "* Unmerged path" in mergetool
This happens in leiu of a diff when one of the commits adds (or
presumably removes) the file rather than changing it.
2020-01-12 18:53:21 -05:00
Tim Pope
6bc345f6f1 Map cmt to :Git mergetool
References https://github.com/tpope/vim-fugitive/issues/1329
2020-01-10 20:29:58 -05:00
Tim Pope
def982ac4d Softly deprecate :Gmerge for quickfix conflicts 2020-01-10 20:29:15 -05:00
Tim Pope
5fe99dc5df Provide interface for subcommands to set execution options 2020-01-10 19:54:06 -05:00
Tim Pope
394c925381 Fix netrw gx in Fugitive buffers 2020-01-09 21:34:35 -05:00
Tim Pope
4074727343 Really fix packed ref handling in :Gbrowse
References https://github.com/tpope/vim-fugitive/issues/1428
2020-01-06 16:00:21 -05:00
Tim Pope
cfa7bdc82a Handle packed refs in :Gbrowse
Closes https://github.com/tpope/vim-fugitive/issues/1428
2020-01-06 13:33:49 -05:00
Tim Pope
ddd64fc4c5 Provide :Git difftool and :Git mergetool
Closes https://github.com/tpope/vim-fugitive/issues/132
2020-01-05 21:41:18 -05:00
Tim Pope
2bcf755c6e Run QuickFix autocommands on :Gclog 2020-01-05 16:36:11 -05:00
Tim Pope
295f41bbf4 Save diff context in :Gclog 2020-01-05 16:17:58 -05:00
Tim Pope
9ec6b55d03 Improve display of :Gclog --summary 2020-01-05 01:50:24 -05:00
Tim Pope
3604fab3b7 Fix whitespace in README 2020-01-05 01:50:24 -05:00
Tim Pope
6d011f1ea5 Improve :Gclog window title 2020-01-05 00:36:36 -05:00
Tim Pope
726fdf1c94 Support ...commit as HEAD...commit 2020-01-03 19:47:08 -05:00
Tim Pope
3bf602b13d Use underlying commit not tag for :Gedit tag:path 2019-12-27 17:19:42 -05:00
Tim Pope
3729c351e1 Fix unknown function error on Vim < 7.2.061 2019-12-27 17:19:42 -05:00
Tim Pope
7848779d3b Don't error if we can't :bwipeout
References https://github.com/tpope/vim-fugitive/issues/1418
2019-12-27 17:19:42 -05:00
Jon Parise
b68b6d4329 Mention vim-phabricator for Phabricator browsing 2019-12-11 17:49:38 -05:00
Tim Pope
6d4564a05e Fix timer invocation
References https://github.com/tpope/vim-fugitive/issues/1329
2019-12-07 10:14:14 -05:00
Tim Pope
5d37b17e34 Match Git semantics for GIT_CEILING_DIRECTORIES symlink resolution
Also support a generic g:ceiling_directories that can be shared with
other plugins that do this sort of detection.

References https://github.com/tpope/vim-fugitive/issues/1412
2019-12-06 18:03:32 -05:00
Tim Pope
b48a572475 Use timers to avoid Vim patch 8.1.1756
Closes https://github.com/tpope/vim-fugitive/issues/1329
2019-12-06 14:39:27 -05:00
Tim Pope
e1ab8fff09 Handle both amended and new commits during rebase
References https://github.com/tpope/vim-fugitive/issues/1329
2019-12-06 14:39:27 -05:00
Tim Pope
d3a2bdbe2c Don't abort rebase after committing on last step
References https://github.com/tpope/vim-fugitive/issues/1329
2019-12-06 14:12:35 -05:00
Tim Pope
42c6fd1440 Don't override explicit empty string for core.askPass
References https://github.com/tpope/vim-fugitive/issues/1410
2019-12-06 12:56:59 -05:00
Tim Pope
671a85daba Fix erroneous ? escaping in * pattern 2019-11-30 17:19:52 -05:00
Tim Pope
6d9dd103c0 Fix false positive matching filename in blame 2019-11-30 17:15:44 -05:00
Tim Pope
3b1da8b217 Remove debugging function 2019-11-27 16:34:28 -05:00
Tim Pope
67efbf66e0 Don't fall back to pwd for Git dir of blank filename
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
2019-11-27 15:27:52 -05:00
Tim Pope
eed46c1f24 Perform automatic :diffoff on :Gdiffsplit /external/file buffers
Closes https://github.com/tpope/vim-fugitive/issues/1402
2019-11-21 22:08:37 -05:00
Tim Pope
dc5320630d Provide explanatory error on :Gdiff ~
References https://github.com/tpope/vim-fugitive/issues/1402
2019-11-19 17:48:43 -05:00
Tim Pope
13fdeb5fa7 Don't show bogus unstaged changes in bare repository
References https://github.com/tpope/vim-fugitive/pull/1262
2019-11-17 22:19:33 -05:00
Omar Sandoval
3936a74584 Reset scrollbind/cursorbind after reblaming
The following sequence of commands leaves the buffer with scrollbind and
cursorbind set:

  :Gblame
  Reblame with one of -, ~, or P
  Quit with gq

What's happening here is:

1. In BlameSubcommand, we set scrollbind and cursorbind on the buffer.
   We also set w:fugitive_leave on the blame buffer to reset scrollbind
   and cursorbind when the blame buffer is closed.
2. In BlameJump, we execute Gedit, which changes the window to a new
   buffer. Then, we delete the blame buffer, at which point we try to
   reset scrollbind and cursorbind. However, the original buffer isn't
   on a window anymore, so this doesn't do anything.
3. In BlameQuit, we go back to the original buffer. Note this snippet
   from `:help local-options`: "if this buffer has been edited in this
   window, the [option] values from back then are used". When the
   original buffer was last used, scrollbind and cursorbind were still
   set. Therefore, the buffer ends up with scrollbind and cursorbind
   set after leaving Gblame.

The fix is to delete the blame buffer _before_ changing to the new
buffer in BlameJump. This ensures that we restore the options while the
original buffer is still around (which is how BlameQuit does it, too).
2019-11-17 21:08:23 -05:00
Tim Pope
a2d76c4583 Fix completion of stash@\{<Tab>
References https://github.com/tpope/vim-fugitive/issues/1396
2019-11-16 19:48:31 -05:00
Farid
fd029d83bf Add built-in package management installation way 2019-11-16 19:48:19 -05:00
Tim Pope
0004f585fd Don't use arrow notation for unstaged modifications
Closes https://github.com/tpope/vim-fugitive/issues/1392
2019-11-15 20:31:29 -05:00
Tim Pope
b24f98fbb1 Cache fugitive#Head() to minimize statusline IO
Closes https://github.com/tpope/vim-fugitive/issues/1384
2019-11-15 20:05:18 -05:00
Tim Pope
8c84ea6fdb Replace --no-patch with -s for Git < 1.8.4
Closes https://github.com/tpope/vim-fugitive/issues/1398
2019-11-12 21:31:36 -05:00
Tim Pope
1e57d678ba Add PayPal donation link 2019-11-08 17:41:09 -05:00
Tim Pope
f6acae50ea Improve robustness of status --porcelain=v1 parsing
References https://github.com/tpope/vim-fugitive/issues/1388
2019-10-27 18:53:19 -04:00
Tim Pope
0356edf6b8 Optimize away log calls in :Gstatus if no upstream changes 2019-10-26 09:05:49 -04:00
Tim Pope
e8c5b604db Improve robustness of status --porcelain=v2 parsing
Closes https://github.com/tpope/vim-fugitive/issues/1388
2019-10-26 08:49:23 -04:00
Tim Pope
b09c5d2523 Resolve symlinks in configured work tree
Closes https://github.com/tpope/vim-fugitive/issues/1382
2019-10-22 05:13:42 -04:00
Tim Pope
395d947644 Force --no-edit on squash maps
References https://github.com/tpope/vim-fugitive/pull/1378
2019-10-20 15:37:41 -04:00
Ben
0a77016ef5 Disable signcolumn during Gblame (#1379) 2019-10-17 18:14:07 -04:00
Tim Pope
06e34204af Fix error message on blank buffer with no Git dir 2019-10-11 17:21:16 -04:00
Tim Pope
427ac52d7d fugitive.vim 3.1
* 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.
2019-10-10 19:47:39 -04:00
Tim Pope
8c29bf1bb9 Tab complete > arguments 2019-10-10 19:45:25 -04:00
Tim Pope
ea818f1fab Include PowerShell in check for win32 shell
Closes https://github.com/tpope/vim-fugitive/issues/435
2019-10-09 11:33:53 -04:00
Marco Hinz
698065596c Fix incorrect script id (part 2)
This is a follow-up to 28abadc.

Without the \zs, everything up to the regexp for the script ID would be
used.

Now, s:function() is the same as the one used in scriptease.
2019-10-07 13:23:06 -04:00
Tim Pope
28abadcb84 Fix incorrect script id from nested function call
Closes https://github.com/tpope/vim-fugitive/pull/1370
2019-10-07 12:08:12 -04:00
Maksim Odnoletkov
a3ba0ca67f Fix status diffs broken by missing sub attribute
Fixes https://github.com/tpope/vim-fugitive/issues/1367
2019-10-05 21:25:32 -04:00
Maksim Odnoletkov
973d814e26 Rudimentary support for diff maps for submodules in status 2019-10-04 14:47:09 -04:00
Maksim Odnoletkov
a21ca7e86e Support X for submodules
Staged/[MD]:
Unstage and checkout superproject recorded version

Staged/A:
Noop. 'git rm -f' would be appropriate but it is destructive for
non-staged changes and hard to undo

Unstaged/A:
Noop. Hard to reproduce in practice, 'git status' doesn't handle it well
and hard to undo

Unstaged/[MD]:
Checkout superproject recorded version

Unstaged/[m?]:
Noop. Discarding submodules content changes is too complicated.
Workaround is to <CR> to submodule and discard from it's :Gstatus.
2019-10-04 14:47:09 -04:00
Maksim Odnoletkov
f779b90fbd Add --porcelain=v2 status parser
New submodule modifiers:

- 'M' if submodule commit is changed, otherwise
- '?' if there is modified or untracked content

Keep using v1 parser for git versions older than 2.11. This will display
'M' for any submodule changes.

Test with https://github.com/odnoletkov/git-status-test-suite

Fixes https://github.com/tpope/vim-fugitive/issues/1204
2019-10-04 14:47:09 -04:00
Maksim Odnoletkov
80aa8a9aea Fix reverse blame jump for the boundary edge case
When the line is reverse-blamed to an *immediate* child of the current
commit it is shown as `^commit` in the reverse blame output. In this
case we still need to open the child of this commit since it will be a
commit removing the line.

Closes https://github.com/tpope/vim-fugitive/issues/1359
2019-10-02 18:11:02 -04:00
Tim Pope
c9cf1b3cb2 Make remaining buffer commands global 2019-10-02 14:40:38 -04:00
Tim Pope
cfdfc1ba14 Clearer error message on attempt to delete directory
Recursive deletion is too dangerous to provide without a confirmation
prompt.

Closes https://github.com/tpope/vim-fugitive/issues/1364
2019-10-02 14:01:22 -04:00
Tim Pope
5eeb7625df Expand status file lookup into nested structure
References https://github.com/tpope/vim-fugitive/pull/1337
2019-10-01 16:19:36 -04:00
Tim Pope
4f0905e963 Preserve line number on :Gedit with no or > argument
Closes https://github.com/tpope/vim-fugitive/pull/1326
2019-10-01 15:43:12 -04:00
Tim Pope
f72ca2e6c1 Improve ++opt +cmd handling for :Gedit/:Gread 2019-09-30 20:43:16 -04:00
Tim Pope
621ffb087a Fix :'<,'>Gclog on some Vim versions
This was an attempt to get out in front of issues like
https://github.com/tpope/vim-scriptease/issues/43, but looks like it has
problems of its own.

Closes https://github.com/tpope/vim-fugitive/issues/1358
2019-09-30 19:07:04 -04:00
Tim Pope
24b463b5b3 Support REVERT_HEAD and CHERRY_PICK_HEAD 2019-09-30 17:53:11 -04:00
Tim Pope
eedfd2a570 Don't show tags warning when editing commit message 2019-09-28 11:14:30 -04:00
Tim Pope
ab26e9fdb3 Trigger User FugitiveChanged on events that change repository
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
2019-09-27 09:30:40 -04:00
Tim Pope
fee14c149c Don't reload status on non-Fugitive ShellCmdPost 2019-09-27 09:30:40 -04:00
Tim Pope
540d8024c2 Force status reload on commands likely to change it 2019-09-27 09:30:40 -04:00
Andrey Starodubtsev
9c91766118 Vim's redraw can change v:shell_error
If any other plugins besides `vim-fugitive` are present in user's
instance of Vim, they can call external programs to show some
properties. Redraw will force them to call this programs again and value
of last shell error can be changed.
2019-09-27 09:20:41 -04:00
Tim Pope
6eb5d8e4b2 Fix buffer local commands
Closes https://github.com/tpope/vim-fugitive/issues/1353
2019-09-26 16:20:19 -04:00
Jakub Kadlcik
0cf70ab9fc List pagure plugin 2019-09-26 14:05:58 -04:00
Tim Pope
80ef19665a Fix typo 2019-09-26 10:48:07 -04:00
Tim Pope
18893e8ca7 Use more conventional quickfix event type for :Ggrep
References https://github.com/tpope/vim-scriptease/pull/45
2019-09-26 10:46:53 -04:00
Tim Pope
1b292303c2 Encapsulate doautocmd <nomodeline> 2019-09-26 10:46:53 -04:00
Tim Pope
c1244ea7d0 Default to left, not right split for empty :Gdiffsplit filename
This only happens in weird circumstances such as when you call
:Gdiffsplit in a commit object.
2019-09-26 10:46:53 -04:00
Maksim Odnoletkov
eec184e8b0 Fix blame help maps 2019-09-26 03:56:51 -04:00
Tim Pope
417b3bb818 Fix off by 2 error staging multiple files 2019-09-22 21:30:05 -04:00
Tim Pope
edd054f76f Fix visual mode exclusion for staging on section header 2019-09-22 21:29:40 -04:00
Tim Pope
37088aaf65 Fix X on removed file
References https://github.com/tpope/vim-fugitive/issues/1343
2019-09-22 21:27:41 -04:00
Tim Pope
1d8c0a38b2 Show first parent diff for merge commits
Closes https://github.com/tpope/vim-fugitive/issues/1121
2019-09-18 21:54:22 -04:00
Tim Pope
f5a94cbc81 Reload status after Vim :terminal command
Closes https://github.com/tpope/vim-fugitive/issues/1323
2019-09-16 17:25:47 -04:00
Tim Pope
dc413818a6 Fire ShellCmdPost after :Gpush
References https://github.com/vim-airline/vim-airline/issues/1970
2019-09-16 16:32:23 -04:00
Maksim Odnoletkov
2cf584f97d Remove redundant jump when opening :Gstatus
Fixes https://github.com/tpope/vim-fugitive/issues/1333
2019-09-16 16:13:56 -04:00
Maksim Odnoletkov
26f6037de6 Reveal folds when using jump maps in commits 2019-09-11 18:13:16 -04:00
Tim Pope
35f1095f9b Expose completion helpers for subcommands 2019-09-09 19:10:24 -04:00
Tim Pope
f5fc469c0c Ignore blank buffers in fugitive#Statusline() 2019-09-06 17:16:19 -04:00
Tim Pope
cb66611f03 Remove blank buffer FAQ entry 2019-09-05 17:26:58 -04:00
Tim Pope
49287b6e87 Remove redundant autocommands 2019-09-05 16:42:39 -04:00
Tim Pope
ec918b9a79 Support blank buffers
Closes https://github.com/tpope/vim-fugitive/issues/1000
2019-09-05 15:46:27 -04:00
Tim Pope
ff0eeac045 Document disabling global maps
References https://github.com/tpope/vim-fugitive/issues/1331
2019-09-05 15:36:56 -04:00
Tim Pope
eb04d8bcc0 Standardize on "maps", not "mappings" 2019-09-05 15:35:42 -04:00
Teo Ljungberg
2d0df5842a Fix :Glog
`"<mods>"` was forgotten to be passed in during the refactoring in:
68da9a2
2019-09-04 15:54:36 -05:00
Tim Pope
1937bc3cd9 Experimental support for blank buffers 2019-09-04 15:22:28 -04:00
Tim Pope
d2837b103c Add sponsor button 2019-09-04 15:22:28 -04:00
Tim Pope
10c54dfc93 Set b:git_dir for :terminal buffers 2019-09-04 15:22:28 -04:00
Tim Pope
40bc5aff18 Make universal maps global 2019-09-04 15:11:59 -04:00
Tim Pope
68da9a2be3 Make :Glog and :Ggrep global 2019-09-04 15:11:59 -04:00
Tim Pope
804957a3e6 Make :Gbrowse global 2019-09-04 15:11:59 -04:00
Tim Pope
cf88ce96c9 Make :Gmove and :Gremove global 2019-09-04 15:11:59 -04:00
Tim Pope
2464b0c29a Make :Gcd global 2019-09-04 15:11:59 -04:00
Tim Pope
77a732c97c Explicitly document :Git subcommands 2019-09-04 15:11:59 -04:00
Tim Pope
64d106dfdd Remove fugitive- prefix from command help topics 2019-09-04 13:17:20 -04:00
Tim Pope
c9d4ea7900 Always use Git style path for <C-R><C-G> 2019-09-04 13:17:20 -04:00
Tim Pope
99ad1a89fa Relocate 'path' adjustment
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.
2019-09-04 13:17:20 -04:00
Tim Pope
2eb6aac0c4 Adjust warning wording 2019-09-04 13:17:20 -04:00
Tim Pope
c80ffaf073 Don't override user :Gr 2019-09-04 13:17:20 -04:00
Tim Pope
63a05a6935 Remove 'tags' support 2019-09-03 21:40:39 -04:00
Tim Pope
522d3d3c1e Make edit commands global 2019-09-03 20:21:47 -04:00
Tim Pope
b8c33aa0a1 Enable edit commands to work without git dir 2019-09-03 20:20:37 -04:00
Tim Pope
39f9e2d722 Move IO functions with rest of API 2019-09-03 20:20:37 -04:00
Tim Pope
a45e2c6d57 Provide :Gr as alias for :Gread 2019-09-02 19:58:13 -04:00
Tim Pope
5042fd965d Tweak :Gedit > semantics
Treat ~ and ^ suffixes as relative to current commit, not HEAD, and use
a bare > to get to the work tree version.
2019-09-02 19:58:13 -04:00
Tim Pope
251eda7eb6 Reduce fugitive#buffer() to stub object 2019-09-01 21:48:16 -04:00
Tim Pope
c212d854d5 Accommodate git-blame revision ignoring features
Closes https://github.com/tpope/vim-fugitive/issues/1316
2019-09-01 12:56:58 -05:00
Tim Pope
082a9b99e7 Remove double word in docs 2019-09-01 12:56:58 -05:00
Tim Pope
c13e0e1afd Don't browse to blob for empty buffer 2019-08-31 22:34:34 -04:00
Tim Pope
b97a9abe29 Provide global :Git and :G 2019-08-22 19:46:20 -05:00
Tim Pope
410e17129d Use :Git not :G for visible maps
Let's treat :Git as canonical and :G as the shorthand.
2019-08-22 19:45:20 -05:00
Tim Pope
3a01f4b819 Remove toggling behavior of :Gblame
References https://github.com/tpope/vim-fugitive/issues/1316
2019-08-22 19:15:43 -05:00
Tim Pope
f04a2275db Remove feedkeys() contortions in :Gdiffsplit
Closes https://github.com/tpope/vim-fugitive/issues/1313
2019-08-21 15:14:39 -05:00
Tim Pope
b714adbc51 Fix q deprecation message 2019-08-21 09:12:17 -05:00
Tim Pope
9abe962c9d fugitive.vim 3.0
* 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.
2019-08-20 10:06:56 -04:00
Tim Pope
b6bbb17e3f Expose IO functions as object
This is a new interface to a slightly older API for performing standard
VimL IO functions against URLs (or any other URLs, the interface is
generic).  Example wrapper function:

       function! IO(fn, ...) abort
         let file = a:fn ==# 'writefile' ? a:2 : a:1
         let obj = get(g:, 'io_' . matchstr(file, '^\a\a\+'), {})
         return call(get(obj, a:fn, a:fn), a:000)
       endfunction
       echo IO('filereadable', @%)
2019-08-20 08:51:52 -04:00
Tim Pope
9dcf1d7d81 Document important API functions 2019-08-20 08:51:52 -04:00
Tim Pope
a510b3aadf Deprecate :Gstatus q 2019-08-20 08:51:52 -04:00
Tim Pope
c63fd1b71b Support a...b as notation for merge base
Closes https://github.com/tpope/vim-fugitive/pull/913
2019-08-19 11:25:39 -04:00
Tim Pope
e768806266 Remove obsolete Git object examples 2019-08-19 11:22:52 -04:00
Tim Pope
f29298880f Provide FugitiveGitPath() 2019-08-19 09:04:32 -04:00
Tim Pope
2b6199594a Use FugitiveVimPath() to normalize directories during detection 2019-08-19 09:04:32 -04:00
Tim Pope
fd7b5d8a1e Rename s:PlatformSlash() to FugitiveVimPath() 2019-08-19 08:41:15 -04:00
Tim Pope
e759a85486 Provide separate highlight groups for file sections
References https://github.com/tpope/vim-fugitive/issues/1159
2019-08-19 08:05:22 -04:00
Tim Pope
85ffe4754e Remove dead code 2019-08-19 06:42:44 -04:00
Tim Pope
c242cb6369 Provide maps to find similar diff lines 2019-08-18 10:53:21 -04:00
Tim Pope
ff058bf5b7 Fix diff after :Gwrite
This works around a bug in Vim that was fixed in patch 8.0.0421.

Closes https://github.com/tpope/vim-fugitive/issues/1102

References https://github.com/tpope/vim-fugitive/pull/859
2019-08-18 10:53:20 -04:00
Tim Pope
ed6f4256fc Change work tree buffer on :Gwrite exactly once 2019-08-18 09:11:10 -04:00
Tim Pope
1c22b69652 Remove dp map in blobs
The built-in is actually useful so don't shadow it.
2019-08-18 09:11:10 -04:00
Tim Pope
52f71a3154 Follow renames on :0Gclog
Closes https://github.com/tpope/vim-fugitive/issues/563
2019-08-18 07:18:17 -04:00
Tim Pope
fdbcad0624 Allow expanding merge conflict in :Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1242
2019-08-18 04:58:59 -04:00
Tim Pope
bbd9afe790 Provide map to close diff buffers 2019-08-18 04:58:59 -04:00
Tim Pope
f2ca0e43a1 Give s:MapEx() more intention revealing name 2019-08-18 04:58:59 -04:00
Tim Pope
25581bf775 Support discarding multiple changes in visual mode
Closes https://github.com/tpope/vim-fugitive/issues/944
2019-08-18 01:51:38 -04:00
Tim Pope
e69a3ea21a Add nested to reload status autocommands
References https://github.com/tpope/vim-fugitive/pull/889
2019-08-17 08:43:21 -04:00
Tim Pope
442d56e23c Fix :Glog 2019-08-16 13:48:46 -04:00
Daniel Hahler
cb613ca05d Fix :Gdiffsplit with diffopt+=vertical
Only remove "vertical" from `&diffopt` after calling
`s:diff_modifier()`.

Regressed in c972b2a.
References https://github.com/tpope/vim-fugitive/pull/805#issuecomment-522057790.
2019-08-16 13:40:53 -04:00
Tim Pope
d6f7eaf16c Compensate for 'noequalalways' in merge diff
Closes https://github.com/tpope/vim-fugitive/issues/674
2019-08-16 07:08:05 -04:00
Tim Pope
b6dbe402e8 Fix :Glog with diff.noprefix set
Closes https://github.com/tpope/vim-fugitive/issues/606
2019-08-16 07:08:05 -04:00
Tim Pope
86c276d629 Fix version check for doautocmd <nomodeline> 2019-08-16 07:08:05 -04:00
Felix Archambault
22e9b26075 doc: prefer https url 2019-08-15 22:59:49 -04:00
Tim Pope
2518ef9a02 Map double click to jump to file
References https://github.com/tpope/vim-fugitive/pull/620
2019-08-15 22:58:37 -04:00
Tim Pope
bb82255490 Add :help reference to README 2019-08-15 22:46:36 -04:00
Tim Pope
a8163625f8 Vim automatically sets cursorbind for diff buffers
References https://github.com/tpope/vim-fugitive/pull/937
2019-08-15 22:39:04 -04:00
Tim Pope
7079d0c7e2 Convert all FugitivePrepare() int arguments to buffer names 2019-08-15 22:01:27 -04:00
Tim Pope
4f51d99f44 Encapsulate shell escaping user arguments 2019-08-15 22:01:27 -04:00
Tim Pope
c972b2a065 Fix :Ghdiffsplit with diffopt=vertical
Closes https://github.com/tpope/vim-fugitive/issues/990
2019-08-15 19:40:46 -04:00
Tim Pope
cf9ef7377f Don't process modelines after :Gwrite
Closes https://github.com/tpope/vim-fugitive/issues/956
2019-08-15 17:53:27 -04:00
Tim Pope
45ca1eab83 Use platform slashes for :Gcd
The only current difference is backslashes on Windows, which aren't
required, but this may evolve into larger changes in the future.
2019-08-15 17:53:27 -04:00
Tim Pope
a80b965d0d Remove legacy support for /relative/path 2019-08-15 17:53:27 -04:00
Tim Pope
03361373b1 Fix :Gstatus U map 2019-08-15 17:53:13 -04:00
Tim Pope
6a04e875f8 Provide diff maps in blobs 2019-08-15 11:49:54 -04:00
Tim Pope
557cc74141 Fix syntax error
Closes https://github.com/tpope/vim-fugitive/issues/1310
2019-08-15 11:49:54 -04:00
Tim Pope
b887de5ce2 Don't reuse blame buffers for Gstatus edits 2019-08-15 03:47:13 -04:00
Tim Pope
6cc52a1aab Fix extra bang in diff maps 2019-08-15 03:47:13 -04:00
Tim Pope
faa895239b Clean up gitdir file parsing 2019-08-15 03:34:00 -04:00
Tim Pope
6eb885c017 Always diff against parents in :Gdiffsplit! 2019-08-14 11:06:42 -04:00
Tim Pope
308e4bf241 Fix temp file gq shadowing blame gq 2019-08-14 09:38:39 -04:00
Tim Pope
7d484eaf52 Use s:Map() for nearly all maps 2019-08-14 09:38:39 -04:00
Tim Pope
34bfcd471b Fix error generating command for :'<,'>Gblame
Closes https://github.com/tpope/vim-fugitive/issues/1308
2019-08-14 09:38:39 -04:00
Tim Pope
1d2821f91e Clarify :Gstatus p behavior
I've seen a lot of confusion in the wild around this, and the old
behavior is immortalized in the Vimcasts.  Lets make this an error while
we regroup.
2019-08-14 01:44:13 -04:00
Tim Pope
53e5e61afa Emphasize :Glog behavior change
Let's go ahead and embrace :Gclog as a warning free version of the
command.
2019-08-14 01:44:13 -04:00
Tim Pope
1359d620eb Force <nowait> for all generated maps 2019-08-13 23:32:50 -04:00
Tim Pope
5defa72b81 Provide count on blob blame maps for --reverse 2019-08-13 21:31:01 -04:00
Tim Pope
c21736dde7 Jump to file not diff for boundary commit in :Gblame 2019-08-13 21:31:01 -04:00
Tim Pope
11691b38bb Allow :Gblame ^boundary to use scrollbind 2019-08-13 21:31:01 -04:00
Tim Pope
69bf0e3469 Accept commit.. :Gblame argument as commit not filename 2019-08-13 20:58:10 -04:00
Tim Pope
e7c2563288 Remove bang variant of :Git from README
This happens for the important commands automatically, and the new
override syntax is -P/--no-pager.
2019-08-13 19:44:17 -04:00
Tim Pope
c0ce201c3b Remove :Git --paginate from docs
I thought the --paginate option was basically the opposite of
--no-pager, but it actually forces the entire command to run through a
pager, breaking a lot of interactive commands.  Let's de-emphasize it as
a solution.
2019-08-13 19:44:17 -04:00
Tim Pope
49b777ae44 Use rev-list in lieu of log with raw format 2019-08-13 17:24:17 -04:00
Tim Pope
f33a53bceb Remove debug 2019-08-13 17:20:56 -04:00
Tim Pope
16bfd4fa92 Fix offset jumping to patch on :Gblame --reverse 2019-08-13 17:20:03 -04:00
Tim Pope
8038ee60a9 Fix -1 effectively canceling --reverse
Is there a way to apply a limit at the print level rather than the query
level?
2019-08-13 17:12:28 -04:00
Tim Pope
08a9a45dbc Support :rightbelow Gblame and other <mods>
Closes https://github.com/tpope/vim-fugitive/issues/976
2019-08-13 16:27:28 -04:00
Tim Pope
0a7ffc5d67 Use descendant when jumping to patch for :Gblame --reverse
References https://github.com/tpope/vim-fugitive/issues/1305
2019-08-13 16:27:28 -04:00
Tim Pope
0392f64a93 Make :Gblame a proper subcommand 2019-08-13 15:28:01 -04:00
Tim Pope
d1033e756e Cleaner error on -z command failure 2019-08-13 15:28:01 -04:00
Tim Pope
79b1f16a7a Delegate :Git grep to :Ggrep 2019-08-12 00:12:18 -04:00
Tim Pope
03710a877a Use same window for commit message on :0Gcommit 2019-08-12 00:12:18 -04:00
Tim Pope
b4d40abb10 Use lower case for subcommand declarations 2019-08-11 22:36:29 -04:00
Tim Pope
3ca888470b Expand diffs on :Gcommit --patch 2019-08-11 22:36:29 -04:00
Tim Pope
4460aeffdd Use temp buffer with man filetype for :Git help 2019-08-11 18:40:25 -04:00
Tim Pope
078210c718 Use temp buffer for :Git show and :Git stash show 2019-08-11 18:40:24 -04:00
Tim Pope
d417fd3199 Move blame buffer settings to FileType event
The goal here is to extract just the settings that would work outside of
a vertical split with 'scrollbind' in effect, so we can one day add a
second mode.
2019-08-11 17:33:45 -04:00
Tim Pope
4daa0c558c Support nearly all git-blame flags 2019-08-11 01:17:22 -04:00
Tim Pope
7686b7dc5c Support blame.blankBoundary with Ignore highlight 2019-08-11 01:03:09 -04:00
Tim Pope
68f0cb87a9 Don't require <mods> for vertical/tab blame culprit maps 2019-08-11 01:03:09 -04:00
Tim Pope
9ca6e0c633 Remove q from :Gblame documentation 2019-08-10 22:24:35 -04:00
Tim Pope
97e993611e Highlight blame --score-debug and blame -c 2019-08-10 22:24:35 -04:00
Tim Pope
54f155218a Remove duplicate b:fugitive_status initialization 2019-08-10 22:24:35 -04:00
Tim Pope
c7e3df5283 Provide some commit --reset-author maps
Supporting flags with additional maps is a pretty limited solution, as
there's no way to combine them (that is, we'd need to map both cRva and
cvRa to get both verbose and reset-author, and that's as silly as it is
hard to type in under a second).  I think some kind of getchar()
dispatcher is going to be the long term solution.
2019-08-10 22:24:35 -04:00
Tim Pope
bc3d36e559 Remove 'guioptions' workaround 2019-08-09 00:51:59 -04:00
Tim Pope
8227503714 Open :Gstatus for :Gcommit -i and :Gcommit -p 2019-08-09 00:33:28 -04:00
Tim Pope
f0acf3e883 Show dirty submodules in Unstaged section
Closes https://github.com/tpope/vim-fugitive/issues/1204
2019-08-09 00:33:28 -04:00
Tim Pope
a09e49d2bb Support :Gblame --reverse
Closes https://github.com/tpope/vim-fugitive/issues/1305
2019-08-08 21:02:40 -04:00
Tim Pope
cce9ca0933 Move select temp file configuration to BufReadPre
This allows the natural machinery to kick in rather than invoking
FugitiveDetect() and fugitive#MapJumps() explicitly.
2019-08-08 21:02:40 -04:00
Tim Pope
0a536ed5af Don't unnecessarily change ":verbose set scrollbind?" 2019-08-08 20:24:40 -04:00
Tim Pope
9420d05ddd Eliminate b:fugitive_blamed_bufnr 2019-08-08 20:24:40 -04:00
Tim Pope
6db7120c9a Don't double set temp options on blame buffer 2019-08-08 20:24:40 -04:00
Tim Pope
4a42d4e21c Encapsulate retrieval of blamed bufnr 2019-08-08 20:24:40 -04:00
Tim Pope
206b54a147 Retool :Gblame close map 2019-08-08 20:24:40 -04:00
Tim Pope
1260de3b7d Fix :Gread blobhash
References https://github.com/tpope/vim-fugitive/issues/836
2019-08-08 18:15:39 -04:00
Tim Pope
9d36dc2d74 Check for built-ins with .exe extension on Windows 2019-08-08 01:44:44 -04:00
Tim Pope
0db4ceb980 Restore press enter prompt in :Ggrep in GUI 2019-08-07 19:31:35 -04:00
Tim Pope
95c1f1525d Fix accidental utility invocation on :Git complete 2019-08-07 18:12:07 -04:00
Tim Pope
cfca94c723 Expand simple aliases in :Git
This lets you alias ca = `git commit -a` and have `:Git ca` call
`:Gcommit -a`.
2019-08-07 17:31:14 -04:00
Tim Pope
edae34e02f Fix count with jump to commit section 2019-08-07 00:52:38 -04:00
Tim Pope
d7172882b7 Add default core.askPass to :Gpull 2019-08-06 20:01:18 -04:00
Tim Pope
511e32114b Swap gu and gU 2019-08-06 19:39:26 -04:00
Tim Pope
0cc3beeae9 Tweak commit for u rebase map 2019-08-06 14:32:39 -04:00
Tim Pope
0484c03c6b Allow :Grevert --abort/continue/quit 2019-08-06 14:10:45 -04:00
Tim Pope
9d77fd566c Add Git dir presence guard to all commands
This isn't necessary for the current implementation, but could enable
making the commands (or at least the underlying commands) global.
2019-08-06 14:10:45 -04:00
Tim Pope
35d7590354 Provide s/u mappings on commits
I need to figure out the big picture push story before I can document
the push maps.
2019-08-06 14:10:38 -04:00
Tim Pope
c4d4986f1e Delegate :G command to :Gcommand for 8 commands 2019-08-04 00:05:18 -04:00
Tim Pope
fb9acc6831 Add a FAQ entry about remote passwords 2019-08-03 21:38:28 -04:00
Tim Pope
81eec879a4 Update :Gstatus description in README 2019-08-03 21:38:28 -04:00
Tim Pope
14effe7bfb Mention :Gpull and related commands in README 2019-08-03 21:38:28 -04:00
Tim Pope
15fe543508 :Glog isn't that exciting 2019-08-03 21:38:28 -04:00
Tim Pope
bd70719f54 Provide :Grevert and :Gmerge mappings 2019-08-03 21:38:28 -04:00
Tim Pope
0f08b0cbbb Provide separate file/hunk jump maps 2019-08-03 16:27:44 -04:00
Tim Pope
35cf80dd3b Fix :Gbrowse with range and blame.coloring enabled 2019-08-03 16:27:03 -04:00
Tim Pope
dffa56c4ea Retool section jump maps 2019-08-03 00:52:08 -04:00
Tim Pope
9ac6a258d6 Fall back to "commit" line for file hunk jump maps
This enables jumping from commit to commit in :Git log.
2019-08-02 23:41:57 -04:00
Tim Pope
e5a6a8c525 Support jump maps in visual mode 2019-08-02 20:21:23 -04:00
Tim Pope
875a58c2e1 Document :Git --paginate
Was planning on keeping this unofficial, but I think we need to provide
an alternative to loading :Git log in a temp file.
2019-08-02 20:21:23 -04:00
Tim Pope
3f417d7ad1 Enable fixup/squash maps in :Git log 2019-08-02 20:21:23 -04:00
Tim Pope
2b757e87d5 Disable modelines in temp files 2019-08-02 20:21:23 -04:00
Vais Salikhov
5af58f9da1 Fix a typo in the docs 2019-08-02 15:25:40 -04:00
Tim Pope
4c0dbb66eb Always use temp file for :Git diff and :Git log
You can use :Git -p log to get a terminal instead.
2019-08-02 13:31:55 -04:00
Tim Pope
9118ed27c3 Add -addr= declarations 2019-08-02 13:26:18 -04:00
Tim Pope
291cf5d1bc :0Ggrep calls :Glgrep 2019-08-02 13:17:08 -04:00
Tim Pope
928e1e71e7 Document :Git --no-pager 2019-08-02 02:00:16 -04:00
Tim Pope
b9c47cec52 Add command dispatcher
This will enable cleaning up some of the repetition in argument and
exception handling
2019-08-02 01:45:33 -04:00
Tim Pope
21991bcbaf Eliminate redundant :G and :Git implementations 2019-08-02 01:09:20 -04:00
Tim Pope
665cec73d9 Provide :Grevert 2019-08-01 23:22:10 -04:00
Tim Pope
d54e98bedb Remove overlooked 40 character limits 2019-08-01 23:22:10 -04:00
Tim Pope
0ab2d9709c Preserve cursor position after staging last untracked file 2019-08-01 19:27:41 -04:00
Tim Pope
7df9f07e1f Compensate for blame.coloring
Closes https://github.com/tpope/vim-fugitive/issues/1301
2019-08-01 12:46:45 -04:00
Tim Pope
fb3c603ce6 Always use temp file for :Git --no-pager 2019-08-01 12:46:09 -04:00
Tim Pope
44ade58ed5 Always use :terminal for :Git --paginate
References https://github.com/tpope/vim-fugitive/issues/1294
2019-07-30 13:05:16 -04:00
Tim Pope
881d72f1af Preserve index on cza and czp 2019-07-29 17:16:58 -04:00
Tim Pope
f3dde245b3 Map I to :Git add --intent-to-add 2019-07-29 17:16:58 -04:00
Tim Pope
a3ab24f681 Fire synthetic QuickFix events on :Ggrep
References https://github.com/tpope/vim-fugitive/issues/1297
2019-07-29 13:23:59 -04:00
Tim Pope
bd89fd440b Fix error message for rev-parse 2019-07-29 00:48:57 -04:00
Tim Pope
3c4ad5ff72 Avoid unnecessary diffing in :Gstatus 2019-07-28 21:50:49 -04:00
Tim Pope
fff24e29e6 Add czA and czP aliases for cza and czp
One set of these will get --index.  I'll decide which later.
2019-07-28 21:50:49 -04:00
Tim Pope
0810dcc805 Fix typo 2019-07-28 20:42:37 -04:00
Tim Pope
3b0f68180f Compensate for bad 'shellredir' 2019-07-28 19:21:01 -04:00
Tim Pope
49f3f92fd5 Guard against inadvertent :| invocation
I haven't been able to consistently reproduce it, but sometimes vim
takes :edit +CmdA\|CmdB to mean :CmdA followed by :| and not :CmdA
followed by :CmdB.
2019-07-28 19:16:28 -04:00
Tim Pope
645406f592 Use :Gdiffsplit! for diff maps
This opens a 3 way diff for merges and also focuses the more useful
window.
2019-07-28 01:20:38 -04:00
Tim Pope
7bfce97480 Provide misc :Git mappings 2019-07-28 01:12:33 -04:00
Tim Pope
3e9ef9349d Remove error guards for old object syntax 2019-07-28 01:10:37 -04:00
Tim Pope
881ad1ed0b Guard against missing output on :Gcommit success 2019-07-26 21:56:39 -04:00
Tim Pope
ebc3f35575 Require bang to :Gwrite from index
Closes https://github.com/tpope/vim-fugitive/issues/1057
2019-07-26 11:32:24 -04:00
Tim Pope
79566b5ddd Don't override alt buffer on :Gwrite from index 2019-07-26 11:32:24 -04:00
Tim Pope
d90e912e46 Provide ignoring maps
Closes https://github.com/tpope/vim-fugitive/issues/235
2019-07-24 21:27:16 -04:00
Tim Pope
2bfb6e9889 Reverse inline diff mappings
References https://github.com/tpope/vim-fugitive/issues/1199
2019-07-24 21:27:16 -04:00
Tim Pope
b92de0138d Provide rudimentary stash mappings 2019-07-23 20:44:25 -04:00
Tim Pope
d95cc5f8c2 Remove :Gedit HEAD and :Gedit refs/... special cases 2019-07-23 20:44:25 -04:00
Tim Pope
55cb58cd5f Add :Git add --intent-to-add to :Gstatus P 2019-07-23 20:44:24 -04:00
Tim Pope
ce283cbdbf Remove i special behavior on section heading 2019-07-23 20:10:48 -04:00
Tim Pope
994d1b518f Remove --intend-to-add from :Gstatus i
You can't actually apply a hunk to a file added with --intend-to-add, so
this did not pair well with the hunk expansion behavior.
2019-07-23 19:37:06 -04:00
Tim Pope
d88a0f8465 Fix :Gstatus X in visual patch selection 2019-07-23 19:24:07 -04:00
Tim Pope
54bc4ab9dd Improve error handling on :Gstatus X 2019-07-23 18:29:13 -04:00
Tim Pope
15df3f8959 Do what the user means for LANG= in g:fugitive_git_executable 2019-07-23 15:13:28 -04:00
Tim Pope
1fe6202848 Fix :Gbrowse assuming range 2019-07-22 15:20:21 -04:00
Tim Pope
a152894a55 Don't rely on exception message for :Gbrowse - error 2019-07-22 14:34:46 -04:00
Tim Pope
8a693fb7bc Restore :Gdiffsplit :n 2019-07-22 14:34:45 -04:00
Tim Pope
80996c2e2c Map c? and r? to show commit and rebase help 2019-07-21 15:27:21 -04:00
Tim Pope
238a5d8aaf Map U as :Git reset -q 2019-07-21 15:27:20 -04:00
Tim Pope
76bd7d6cb4 Map gr to jump to rebasing section 2019-07-21 15:26:58 -04:00
Tim Pope
ac97fa3781 Use terminal for :Git fetch/pull/push
I consider :Gfetch, etc, the proper interface, but allow this as a
backdoor.

References https://github.com/tpope/vim-fugitive/issues/1292
2019-07-21 15:26:47 -04:00
Tim Pope
6e2310a154 :Gstatus called from status window forces reload 2019-07-20 23:36:42 -04:00
Tim Pope
387cb5c2a0 Clean up error reporting on :Gwrite in diff 2019-07-20 23:36:42 -04:00
Tim Pope
8d584c199a Fix escaping for :Ggrep '#' 2019-07-20 23:36:42 -04:00
Tim Pope
adba9c6345 Provide core.askPass default
Closes https://github.com/tpope/vim-fugitive/issues/722
2019-07-18 16:23:01 -04:00
Tim Pope
d68efa32e8 Document parentheses movement maps 2019-07-18 14:18:09 -04:00
Tim Pope
b0de6c2811 Fix :0Glog another/path 2019-07-18 14:18:09 -04:00
Tim Pope
e25a214f78 Add an error about LANG= in g:fugitive_git_executable 2019-07-18 11:12:03 -04:00
Tim Pope
ea26a94bde Consistently position cursor on :Gstatus 2019-07-18 11:12:03 -04:00
Tim Pope
3d305c75a0 Don't print current line on :G|chainedcommand 2019-07-18 11:12:03 -04:00
Tim Pope
68b999bfd0 Remove <C-W>C map
It's not worth claiming a whole map just to save one key press.
2019-07-18 11:12:03 -04:00
ganziqim
58b2b85c9e Only check bdelete mapping in normal mode 2019-07-18 09:44:14 -04:00
Tim Pope
07661dc102 Provide additional commit maps 2019-07-16 16:36:58 -04:00
Tim Pope
2992275d8e Don't load first quickfix result into status buffer 2019-07-16 16:36:58 -04:00
Tim Pope
d8acfc35c7 Clarify in error message that :Gbrowse handlers are user installed 2019-07-16 16:36:58 -04:00
Tim Pope
0ee0498b88 Filter out warning on :Gedit master@{2.years.ago} 2019-07-16 16:00:09 -04:00
Tim Pope
469a73f3d9 Speed up :Ggrep 2019-07-15 22:41:51 -04:00
Tim Pope
a1b78969f5 Decouple :Glog from :grep
One step closer to asynchronous job support.
2019-07-15 22:41:51 -04:00
Tim Pope
158ffdbb14 Extract function to create titled quickfix list 2019-07-15 22:41:51 -04:00
Tim Pope
f83072703b Remove debugging variable 2019-07-15 22:41:35 -04:00
Tim Pope
4c650c699d Don't require shell quoting for colons
References https://github.com/tpope/vim-fugitive/issues/1289
2019-07-15 15:35:02 -04:00
Tim Pope
dafb994c92 Remove unused function 2019-07-14 14:29:26 -04:00
Tim Pope
8c80cb63e2 Fix E211 handling in :Gmerge/:Grebase 2019-07-14 14:29:26 -04:00
Tim Pope
dbdc947533 Fix <CR> as :Gblame map 2019-07-14 14:29:26 -04:00
Tim Pope
4da9fb8f43 Guard against empty filename checking for conflicts
Closes https://github.com/tpope/vim-fugitive/issues/1287
2019-07-13 07:50:11 -04:00
Tim Pope
0c259e3016 Tighten up autowrite handling 2019-07-13 07:50:11 -04:00
Tim Pope
d0049b4417 Support double quotes for all subcommand wrappers 2019-07-12 09:20:13 -04:00
Tim Pope
e169595314 Fix finishing :Gcommit on :wqa
This was added to compensate for the implicit autowrite we lost when
switching from :! to system(), but it seems calling in the
VimLeavePre/BufLeave event prevents the commit from happening on exit.
I don't fully understand it but it's easy to prevent.

Closes https://github.com/tpope/vim-fugitive/issues/1285
2019-07-12 09:20:13 -04:00
Tim Pope
a1a40c360d Provide :Gclog and :Gcgrep aliases
The distant future might hold a :Glog command that isn't bound by the
limitations of the quickfix list, so introduce an alias for the quickfix
variant to retire to.

:Gcgrep is a weird name since it directly maps to :grep, but provide it
anyways for symmetry.
2019-07-11 17:34:25 -04:00
Tim Pope
e250f9730e Fix :Gblame on win32
Closes https://github.com/tpope/vim-fugitive/issues/1284
2019-07-11 17:34:25 -04:00
Tim Pope
c33d7fcb9f Show stderr on :Gcommit
References https://github.com/tpope/vim-fugitive/pull/1115
2019-07-11 12:32:35 -04:00
Tim Pope
d176cca5ae Don't include trailing newline in fugitive#GitVersion() 2019-07-11 12:32:35 -04:00
Tim Pope
aa68223376 More helpful error on Git without -C
Closes https://github.com/tpope/vim-fugitive/issues/1283
2019-07-11 07:56:28 -04:00
Tim Pope
bdf5a221fb Use standard argument handling for :Gfetch/:Gpush 2019-07-10 14:51:56 -04:00
Tim Pope
fd48cde3b7 Fix escaping when :Grebase calls :Gcommit 2019-07-10 14:51:56 -04:00
Tim Pope
0a758c22b3 Retool :Ggrep 2019-07-10 08:22:49 -04:00
Tim Pope
bb05732d7f Begin phasing out <line2> 2019-07-10 08:22:49 -04:00
Tim Pope
de3f6d977c Fix commands on Vim without <mods>
Closes https://github.com/tpope/vim-fugitive/issues/1282
2019-07-09 19:26:44 -04:00
Tim Pope
5f9602e12f Also support :G command commit:./path 2019-07-09 13:30:07 -04:00
Tim Pope
9afa926a23 Fix subcommand completion to match :Git completion 2019-07-09 13:30:07 -04:00
Tim Pope
23138572f4 Fix :[range]Glog
Closes https://github.com/tpope/vim-fugitive/issues/1280
2019-07-09 13:30:07 -04:00
Tim Pope
ad2e408e15 Treat :G ... ./path as relative to working directory
References https://github.com/tpope/vim-fugitive/issues/504
2019-07-09 12:26:57 -04:00
Tim Pope
f38c59af7c Better error handling for obsolete argument syntax 2019-07-09 12:03:22 -04:00
Tim Pope
6b1e749849 Eliminate :cd in :Gread! and :Gblame 2019-07-09 12:03:22 -04:00
Tim Pope
2ddf4e97ef Work around broken nvim reltime()
Closes https://github.com/tpope/vim-fugitive/issues/1277
2019-07-09 12:03:22 -04:00
Tim Pope
fb66f9a86d Set loclist not qflist title for :Gllog 2019-07-09 12:02:53 -04:00
Tim Pope
9556e59765 Fix :Glog on Vim without quickfix "module" support
Closes https://github.com/tpope/vim-fugitive/issues/1279
2019-07-09 12:02:53 -04:00
Tim Pope
b48f93b550 Use proper argument parsing for :Glog 2019-07-09 06:45:58 -04:00
Tim Pope
0a4eee76e9 Don't hide :Glog errors 2019-07-09 06:45:58 -04:00
Tim Pope
1fb7fa0078 Use correct quickfix commands for :Gllog 2019-07-09 06:45:58 -04:00
Tim Pope
5c3d30223b Further tighten :Glog format 2019-07-09 06:45:58 -04:00
Tim Pope
d22a14192f Don't map file/hunk jumps in blobs 2019-07-09 06:45:58 -04:00
Tim Pope
f71a38db7d Fix argument handling for :Gmerge
This shouldn't matter in practice since :Gmerge doesn't accept path
arguments, but may as well do the right thing.
2019-07-09 06:45:58 -04:00
Tim Pope
cecfc06be3 Tweak s:Dir() usage 2019-07-09 06:45:58 -04:00
Tim Pope
102b3a50e2 Support next/previous file/hunk in commits
One of these aliases is going to end up being for files only but I'll
decide which later.
2019-07-08 15:40:47 -04:00
Tim Pope
ebd7c9ddd3 Add next/previous section maps 2019-07-08 15:39:51 -04:00
Tim Pope
45fd3f4cb8 Change interface for jumping directly to blame commit 2019-07-08 15:39:51 -04:00
Tim Pope
eaa0764940 Fix false positve matching :Glog abbreviated SHA 2019-07-08 15:39:51 -04:00
Tim Pope
85a135a9b0 Complete options for subcommand wrappers
Closes https://github.com/tpope/vim-fugitive/issues/1265
2019-07-08 10:04:58 -04:00
Tim Pope
cd78a08543 Retool diffing
Support mods, rename to match the built-in :diffsplit, and (perhaps
controversially) move three-way diffing to the bang variant, so that the
default behavior always focuses the other window.

Closes https://github.com/tpope/vim-fugitive/pull/715
2019-07-08 10:04:58 -04:00
Tim Pope
e49b9a9303 Pass bang to :Gblame to get horizontal split
Closes https://github.com/tpope/vim-fugitive/issues/1183
2019-07-08 09:41:08 -04:00
Tim Pope
362ce47ed1 Force hyphen in :Gblame -opts
I want to change the interface to allow passing an optional filename.
2019-07-08 09:41:08 -04:00
Tim Pope
668a615559 DWIM for :(top)/absolute/path 2019-07-08 09:41:08 -04:00
Tim Pope
6b02026cf9 Fix :Gblame <CR> with existing q map 2019-07-08 09:41:08 -04:00
Tim Pope
bfe74225fa Use :terminal for :Git add --patch and similar commands 2019-07-08 03:54:06 -04:00
Tim Pope
2cde9172a9 Add section jump maps
References https://github.com/tpope/vim-fugitive/issues/1252
2019-07-08 03:50:49 -04:00
Tim Pope
e0d4a281a8 Remove transitional g| mapping 2019-07-07 16:38:45 -04:00
Tim Pope
985861c083 Unify :G and :Git
The principle difference between these two is that :G uses -bar while
:Git fakes it.  Faking it enables double quotes, but I don't really
trust it.
2019-07-07 14:27:37 -04:00
Tim Pope
d0212919f3 Only map q if no conflict 2019-07-07 14:27:37 -04:00
Tim Pope
7e91b47021 Move blame syntax to separate file 2019-07-07 14:03:38 -04:00
Tim Pope
2b5fdf146a Allow disabling dynamic blame colors
Closes https://github.com/tpope/vim-fugitive/pull/986
2019-07-07 13:38:35 -04:00
Tim Pope
abefcb6ebd Add --option completion to :Git
References https://github.com/tpope/vim-fugitive/issues/1265
2019-07-07 13:16:08 -04:00
Tim Pope
2c13dfff03 Fix completion on :vert Git <Tab> 2019-07-07 13:16:08 -04:00
Tim Pope
2e0570046b Remove reload map
May as well free this up now because we're running short on maps.
2019-07-07 13:16:08 -04:00
Tim Pope
73b7e5e23f Use proper argument parsing for :Gcommit 2019-07-07 06:39:29 -04:00
Tim Pope
e7f272a36c Change :Git! to split by default 2019-07-07 01:41:55 -04:00
Tim Pope
20bdfee4b7 Extract :Gsplit! implementation 2019-07-06 13:48:23 -04:00
Tim Pope
a50e072587 Fix handling of bar in argument parsing 2019-07-06 13:48:23 -04:00
Tim Pope
2fdba349f5 Make completion more robust 2019-07-06 13:20:15 -04:00
Tim Pope
aa41caf6c7 Lay groundwork for running commands without Git dir 2019-07-06 13:20:15 -04:00
Tim Pope
00bced7c53 Drop support for :Gblame -fn
The double dash options create false positives so this feature no longer
works correctly.
2019-07-06 13:20:15 -04:00
Tim Pope
f33ac1b2a7 Use proper argument parsing in :Gmerge/:Grebase 2019-07-06 11:19:18 -04:00
Tim Pope
2503a957ff Better helper function names for expanding split 2019-07-06 10:20:10 -04:00
Tim Pope
e87c612491 Jump to appropriate section for s/u on :Gstatus header 2019-07-06 08:56:39 -04:00
Tim Pope
0816915503 Restore popular fugitive#buffer() methods
I don't want outdated third party plugins to prevent people from
installing the upcoming stable release.
2019-07-06 08:56:39 -04:00
Tim Pope
81e57453ce Compensate for very old Vim without settabvar() 2019-07-06 08:56:39 -04:00
Tim Pope
873ede7aa4 Provide argument list version of s:UserCommand() 2019-07-06 08:56:39 -04:00
Tim Pope
d1671f1fce Fix :Gedit > 2019-07-06 08:56:39 -04:00
Daniel Hahler
48e612601b s:BuildShell: fix E706
This happens with old Vim versions (before 7.4.1546):

> Vim(let):E706: Variable type mismatch for: cmd

Ref: https://github.com/vim/vim/commit/f6f32c38b
2019-07-06 07:20:40 -04:00
Tim Pope
fdb57922a4 Update escaping for dynamic :Git invocations 2019-07-06 02:17:38 -04:00
Tim Pope
a025157c5f Don't rely on shell for quoting
Using shell syntax for Fugitive commands has a number of disadvantages:

* Commands behave differently depending on shell and platform.
* Checking for arguments (e.g., did :Ggrep receive --cached?) is
  impossible to do robustly.
* Double quoted strings conflict with -bar command chaining.
* Need to use %:S to for expansions, and backslash escaping even inside
  single quotes.

This is an experiment that instead implements the quoting ourselves.

For backwards compatibility, :Git and :Gcommit support double quoted
strings, but this is deprecated.
2019-07-06 00:55:25 -04:00
Tim Pope
3684c01ef4 Smarter :Gstatus reload 2019-07-05 10:36:06 -04:00
Tim Pope
0f46d5ce32 Don't throw exception on :Gedit :bogus 2019-07-05 10:36:06 -04:00
Tim Pope
ef820b7577 Separate argument massaging from shell quoting 2019-07-05 08:03:53 -04:00
Tim Pope
137433c3c0 Eliminate shell syntax in :Gstatus undo 2019-07-05 05:03:57 -04:00
Tim Pope
ed5ac8dc5d Fix jump to patched line in :Gstatus 2019-07-05 05:03:57 -04:00
Tim Pope
a0e8f59b68 Make :Glog a bit less insufferable
This desperately needs async job support, but until I get around to
implementing that, this will have to do.
2019-07-04 08:49:00 -04:00
Tim Pope
04c68837d3 Fix stacking untracked files 2019-07-04 08:48:54 -04:00
Tim Pope
a9572e9ea6 Fix inline diff expansion 2019-07-04 08:44:42 -04:00
Tim Pope
4466eeb47a Restore "Untracked" section 2019-07-04 07:29:08 -04:00
Tim Pope
c62d23bc18 Change s:StageInfo() to use absolute paths like s:Selection() 2019-07-04 07:29:08 -04:00
Tim Pope
51c54138ba Fix count on :Gstatus maps 2019-07-04 07:14:07 -04:00
Tim Pope
fc6643c318 Remove hard coded length limit of 40 on hashes
SHA-256 is coming eventually, may as well rip these out now.
2019-07-04 02:36:26 -04:00
Tim Pope
302ee3b41c Fix P in :Gstatus 2019-07-03 17:17:45 -04:00
Tim Pope
d238736a30 Remove weird FAQ entry 2019-07-03 06:21:52 -04:00
Tim Pope
cf5b43443f Encapsulate "-z" null splitting 2019-07-02 06:58:50 -04:00
Tim Pope
39087fed59 Encapsulate system() plus v:shell_error 2019-07-02 06:58:50 -04:00
Tim Pope
77d86594cc Encapsulate common v:shell_error usages 2019-07-02 06:58:50 -04:00
Tim Pope
17618402fa Remove :terminal special case for Neovim :Git
Neovim appears to be better about not locking up on terminal input, and
GIT_TERMINAL_PROMPT=0 gives us belt-and-suspenders protection.
2019-07-01 18:37:00 -04:00
Tim Pope
461c1beefa Fix extra space in win32 environment variables
Closes https://github.com/tpope/vim-fugitive/issues/1271
2019-07-01 17:59:25 -04:00
Tim Pope
0d6ffcc3a9 Fix docs for :0 removal 2019-07-01 05:54:55 -04:00
Tim Pope
b343a4bec0 Add error handling to s:TreeChomp() 2019-07-01 05:52:05 -04:00
Tim Pope
14649fb858 Restore autowrite before :Gcommit 2019-07-01 05:52:02 -04:00
Tim Pope
3d252dac21 Avoid use of :! in :Gcommit
References https://github.com/tpope/vim-fugitive/issues/435
2019-07-01 00:02:42 -04:00
Tim Pope
cf9c04af06 Eliminate environment juggling in :Gcommit 2019-07-01 00:02:42 -04:00
Tim Pope
74fc4b5eea Avoid intermediary v:errmsg in exception handling 2019-07-01 00:02:42 -04:00
Tim Pope
384c9e1d8e Support :tcd in initialization 2019-06-30 21:11:31 -04:00
Tim Pope
4a94b374d0 Fix bug revealing next hunk 2019-06-29 20:50:14 -04:00
Tim Pope
7c66d544e5 Only target current file if range is given to :Glog 2019-06-29 19:55:16 -04:00
Tim Pope
c8ac43422e Adjust viewport position *after* reload
References https://github.com/tpope/vim-fugitive/issues/1268
2019-06-29 19:19:09 -04:00
Tim Pope
9c195de61b Fix dd in :Gstatus staged section
References https://github.com/tpope/vim-fugitive/issues/1269
2019-06-28 14:42:01 -04:00
Tim Pope
cb4bb94f7b Fix dd in :Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1269
2019-06-28 14:31:37 -04:00
Tim Pope
198e9c4128 Improve :Gstatus support for renames
Closes https://github.com/tpope/vim-fugitive/issues/1175
2019-06-27 23:49:32 -04:00
Tim Pope
8e024f9bcc Add <mods> helper function 2019-06-27 23:49:32 -04:00
Tim Pope
192538c0a7 Fix :Gstatus overscroll when already at bottom of document 2019-06-27 23:09:34 -04:00
Tim Pope
0f20c35b62 Fix error on :Gedit with no argument 2019-06-25 16:28:36 -04:00
Tim Pope
fc529da8ae Work around autowrite bug when :terminal is open 2019-06-25 14:03:33 -04:00
Tim Pope
a0815c7010 Retire :Gedit -..., :Gedit @{...}, and :Gedit :n
I'm introducing :Gedit >... as a new shorthand because a leading > is
handled by fnameescape(), but it's very ugly, I don't think I want to
make it official.
2019-06-25 04:33:36 -04:00
Tim Pope
aff3359699 Retire :Gedit ^n and :Gedit ~n 2019-06-25 04:06:38 -04:00
Tim Pope
66a927524a Don't map <CR> in editable index buffers 2019-06-25 04:02:02 -04:00
Tim Pope
6d42c7df44 Fix fugitive#isdirectory() with trailing slash 2019-06-08 02:42:32 -04:00
Tim Pope
bf7f05e62b Accept a count to :Git
Now that <mods> support is widely available, I'm considering moving all
:Gsplit! variants onto :Git!, and making :0Git! suppress the split.
2019-06-05 22:43:31 -04:00
Tim Pope
41a734ef49 Fix Fugitive activation when historical version does not exist
I believe I omitted BufNewFile here because it seemed like kind of a
silly event for an unmodifiable, unwritable buffer, but I wasn't taking
into account that event is needed for Fugitive to activate.

Closes https://github.com/tpope/vim-fugitive/issues/1261
2019-06-03 21:06:59 -04:00
Tim Pope
a135d10967 Only activate Projectionist if config file exists
References https://github.com/tpope/vim-projectionist/issues/130
2019-06-03 00:32:19 -04:00
Tim Pope
8bbc4d8816 Eliminate repeated $GIT_DIR check 2019-06-03 00:32:19 -04:00
Tim Pope
078ffa6197 Don't assume b:git_dir is an actual directory
This is a quick first pass.  There may be others hiding.

References https://github.com/tpope/vim-fugitive/issues/776
2019-06-02 18:56:29 -04:00
Teo Ljungberg
79f3be9f17 Abbreviate commit SHA1s for :Grebase -i
Rather than generating the full 40 character SHA1, this commit changes
the rebase todo file to use the abbreviated kind.
2019-06-02 12:59:47 -04:00
Tim Pope
0f9db6af70 Fix garbled screen after :Git! and related commands
Closes https://github.com/tpope/vim-fugitive/issues/1258
2019-05-21 17:00:12 -04:00
Tim Pope
5d99841b22 Fix fugitive#glob('[^x]') 2019-05-04 18:54:16 -04:00
Tim Pope
2bde1d9de6 Don't activate autocmds with tmp filenames
This was done in d4fb2a2f5c to fix
filetype modelines, but it appears to no longer be necessary and is
confusing other plugins.
2019-05-02 23:44:16 -04:00
Tim Pope
b27e71c34b Add <nowait> to gq map 2019-05-02 23:44:16 -04:00
Tim Pope
cfbaa27d11 Fix :Gstatus log with unpushed remote 2019-05-02 23:44:16 -04:00
Teo Ljungberg
16b7a060a3 Pass in matching number of arguments for :Gread
This was changed in 1ac2c70 for the other git commands, leading to the
following error message:

```
E118: Too many arguments for function: s:ReadCommand
```
2019-04-24 13:18:19 -04:00
Tim Pope
1ac2c707e5 Begin moving to standard command implementation interface
This is just the low hanging fruit.  The goal is to make these adhere to
account for all possible future parameters so that these functions can
(maybe) be made public.
2019-04-05 21:47:09 -04:00
Tim Pope
4ec81b5251 New naming scheme for completion functions 2019-04-05 21:47:09 -04:00
Tim Pope
60eac8c974 Call :Gcommit from :Grebase --continue 2019-04-05 21:47:09 -04:00
Jay Sitter
1b3668b89f Allow --abbrev as :Gblame argument (#1243) 2019-04-04 14:28:14 -04:00
Tim Pope
3aaeaca87b Fix restore of sequence editor 2019-04-04 13:59:42 -04:00
Tim Pope
59f104075c Revert "Add documentation for --relative-date in :Gblame"
This option doesn't work very well.

This reverts commit 86d6872ce2.
2019-04-04 13:59:42 -04:00
Jay Sitter
86d6872ce2 Add documentation for --relative-date in :Gblame 2019-04-04 13:48:33 -04:00
Tim Pope
bd0b87d36a Provide gq to close status buffer
References https://github.com/tpope/vim-fugitive/issues/1221
2019-03-01 16:43:42 -05:00
Tim Pope
57b4d848a4 Use :setlocal for all local options 2019-02-28 20:08:59 -05:00
Tim Pope
94723902fb Remove stopgap support for reload after :Dispatch
ShellCmdPost is now supported in dispatch.vim.
2019-02-28 20:08:59 -05:00
Maksim Odnoletkov
ddd0513071 Reblame at HEAD from dirty lines
HEAD blame seems to be much more useful than index blame. You can
continue following evolution of the line with further jumps while before
you got struck on 'not yet committed' line if it was already added to
the index.
2019-02-27 23:59:39 -05:00
Tim Pope
b44b7b8ae7 Encapsulate b:git_dir 2019-02-27 23:42:58 -05:00
Tim Pope
0171b2a5b0 Fix function name mutilated by search and replace 2019-02-27 23:42:58 -05:00
Tim Pope
666c4abc12 Brute force mapping jumps
This is supposed to happen on FileType git, but depending on autocommand
order, exists('b:git_dir') might erroneously fail.
2019-02-27 23:42:58 -05:00
Tim Pope
a69b0b0fd6 Fix unofficial "a" map
Closes https://github.com/tpope/vim-fugitive/issues/1218
2019-02-25 14:18:36 -05:00
Tim Pope
66073d955d Use blamed file when calling :Gbrowse in blame buffer 2019-02-25 14:18:36 -05:00
bennyyip
1a3c04585b Gblame: allow passing --relative-date 2019-02-23 19:38:43 -05:00
Tim Pope
ad32eae7e2 Override color.ui=always
Closes https://github.com/tpope/vim-fugitive/issues/1217
2019-02-23 18:11:31 -05:00
Tim Pope
c5d8b25c5e Don't repeatedly trigger FocusGained on win32
References https://github.com/tpope/vim-fugitive/issues/1209
2019-02-23 15:21:30 -05:00
Tim Pope
f259fd5d6d Provide "i"
This is a weird one, and might get axed.
2019-02-21 13:28:10 -05:00
Tim Pope
755554bb3c Sort untracked files before unstaged files 2019-02-21 13:28:10 -05:00
Tim Pope
28a03d0b00 Provide option for status reloading
Closes https://github.com/tpope/vim-fugitive/issues/1209
2019-02-21 13:28:10 -05:00
Tim Pope
8caa4a0ba3 Try J/K for next/previous
I'm also entertaining using J to toggle the "squash" instruction in an
interactive rebase, so no documentation for these yet.
2019-02-21 12:39:16 -05:00
Tim Pope
01b9a645b6 Provide checkout --ours/--theirs on X
Closes https://github.com/tpope/vim-fugitive/issues/954
2019-02-20 23:49:41 -05:00
Tim Pope
74aefa53ac Support X on newly added file
Closes https://github.com/tpope/vim-fugitive/issues/1212
2019-02-20 23:49:41 -05:00
Tim Pope
654f7f5432 Support "." in visual mode 2019-02-20 23:41:32 -05:00
Tim Pope
26cf153e76 Refactor status spaghetti into dispatch mechanism 2019-02-18 17:26:39 -05:00
Tim Pope
15fb5f68ad Remove duplicate q map 2019-02-18 14:02:33 -05:00
Tim Pope
a489c6e1d3 Fix reveal of hunks on CTRL-N 2019-02-13 21:01:19 -05:00
Tim Pope
02c26619c4 Remove duplicate help tag
These should be unified, but for now, --patch is just stealing the
spotlight from inline diffs, so I won't shed any tears over dropping its
help tag.

Closes https://github.com/tpope/vim-fugitive/issues/1203
2019-02-12 15:58:53 -05:00
Tim Pope
e9705826bd Trailing whitespace 2019-02-12 11:19:18 -05:00
Tim Pope
8c33bdfc26 Update :Gstatus description in README
This still doesn't do it justice, but it's a step in the right
direction.
2019-02-12 11:06:12 -05:00
Tim Pope
b3de2f2284 Handle mysterious tab at the end of a diff filename with spaces
Closes https://github.com/tpope/vim-fugitive/issues/1202
2019-02-12 10:39:24 -05:00
Tim Pope
5c5581386f Redo :Gstatus documentation 2019-02-11 13:22:47 -05:00
Tim Pope
817fc15287 Remove comment 2019-02-11 09:06:14 -05:00
Brennen Bearnes
ce8ddf37fc Fix autocmds & alternate file handling for "index"
This commit tweaks the existing autocommand for files matching
`index{,.lock}` to:

  - Fire BufReadPre and BufReadPost on either side of the read
    operation for files not in a `.git/` and already extant.
  - Fire BufNewFile for new files not in a `.git`.
  - Add `keepalt` to the `read`, thus allowing alternative file
    operations such as Ctrl-^ to work correctly.

Has been tested against:

  - BufReadPost,BufNewFile autocommands
  - A basic test case for alternate files where one is named `index`

Closes https://github.com/tpope/vim-fugitive/issues/834

Closes https://github.com/tpope/vim-fugitive/issues/959
2019-02-11 09:05:36 -05:00
Tim Pope
7cb2ca81e3 Use current window for :0Gsplit
This is to enable :0Gsplit! to replace :Git!, opening that command up
for something more useful.
2019-02-10 18:49:04 -05:00
Tim Pope
0727261b38 Fix current line assumption 2019-02-10 18:49:04 -05:00
Tim Pope
489201879b Eliminate s:StageReloadSeek() 2019-02-10 18:49:04 -05:00
Tim Pope
8899468c09 Handle git --version with (Apple ...) suffix
References https://github.com/tpope/vim-fugitive/issues/1194
2019-02-06 15:54:00 -05:00
Tim Pope
ed07f9a503 Guard against status reloading in wrong buffer
Closes https://github.com/tpope/vim-fugitive/issues/1191
2019-02-03 01:58:29 -05:00
Henrique Malheiro
c98d3cf38f Fix bug in excluding Gstatus window from reuse
When Gstatus is the only window, executing Gdiff results in the Gstatus
being reused for the diff split.

Closes https://github.com/tpope/vim-fugitive/issues/853
2019-02-02 13:02:41 -05:00
David Briscoe
3304c14c63 Move filetype to after maps to allow user maps
The easiest way for users to define their own maps in Gstatus buffers is
using a ftplugin/fugitive.vim file with a `b:fugitive_type != 'index'`
guard. Setting the filetype after defining the maps allows users to
maniuplate "dangerous" maps and otherwise customize mappings.

For example, in ~/.vim/after/ftplugin/fugitive.vim:

    if !exists('g:loaded_fugitive') || b:fugitive_type != 'index'
        finish
    endif

    " Use s to stage *and* unstage changes: shadows -.
    nmap <buffer> <silent> s -
    xmap <buffer> <silent> s -

    " I hit this by accident.
    nunmap <buffer> X
2019-01-31 01:43:18 -05:00
Tim Pope
d27dbc40d4 Respect 'splitbelow' in :Gstatus
References https://github.com/tpope/vim-fugitive/issues/1169
2019-01-27 07:53:13 -05:00
John Drouhard
50cf1b3bd1 Fix s:Cd() usage in the Gblame command
Most usages in commit da3b2f32 (Support tab local working directories)
were updated to use this pattern, but Gblame missed the boat. Without
this, Gblame will change the root git tree but won't change back to the
previous location.
2019-01-27 05:26:00 -05:00
Tim Pope
8b32524219 Don't force foldtext for status buffer
Closes https://github.com/tpope/vim-fugitive/issues/1183
2019-01-26 03:55:33 -05:00
Tim Pope
5a7f5967e7 Don't set readonly globally 2019-01-24 14:11:07 -05:00
Tim Pope
552baf98b3 Support git grep --column
Closes
https://github.com/tpope/vim-fugitive/issues/1168
2019-01-13 15:17:09 -05:00
Tim Pope
58a4a2e102 Provide Git version comparison API 2019-01-13 15:17:09 -05:00
Maksim Odnoletkov
8bf74ceef3 Make all maps reblame at index when on dirty lines
Otherwise parent and grandparent maps lead to invalid URLs
2019-01-11 23:00:29 -05:00
Tim Pope
fe467f78bc Allow ShellCmdPost to fire inside :Make
This was trying to block `au QuickFixCmdPost * copen` as it interfered
with restoring the working directory, but that was mainly a concern for
the other half of the conditional, so restore it to enable the status
buffer to reload.
2019-01-11 14:11:25 -05:00
Tim Pope
07845537d7 Fix :belowright Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1169
2019-01-11 13:58:40 -05:00
Tim Pope
ddc5e1a21a Reload status after :Gpush and :Gfetch
So :make does indeed invoke ShellCmdPost.  I just forgot about the
:noautocmd.

Closes https://github.com/tpope/vim-fugitive/issues/1166
2019-01-09 20:00:35 -05:00
Tim Pope
9211b11cd2 Use native edit commands in :Gstatus
This lets the :topleft modification kick in on older versions of Vim.
2019-01-09 15:00:36 -05:00
Tim Pope
6e74463965 Run :Gstatus edit command at top level
This results in a cleaner error when calling :edit in a modified file.
2019-01-09 14:57:07 -05:00
Tim Pope
b8a6fd204c Always default to horizontal split for :Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1163
2019-01-09 14:03:43 -05:00
Tim Pope
75ca90739b Ignore warnings in git status --porcelain 2019-01-09 14:03:43 -05:00
Tim Pope
5a1c8bbe46 Reload status on all quickfix commands
I thought that I had confirmed :make triggered ShellCmdPost but
apparently not.

Closes https://github.com/tpope/vim-fugitive/issues/1166
2019-01-09 14:03:43 -05:00
Tim Pope
bb46630828 Clarify that removal notices need to be fixed at the source 2019-01-07 11:30:04 -05:00
Tim Pope
c448104332 Fix :Gread deleting too much due to closed folds 2019-01-07 10:23:17 -05:00
Tim Pope
441074f881 Fix unstaging a deleted file
Apparently the -- is mandatory if the file no longer exists.

Closes https://github.com/tpope/vim-fugitive/issues/1161
2019-01-07 10:23:17 -05:00
Tim Pope
68cd7ecf71 Add simple rebase maps
Leaving undocumented until the rebase functionality is more fleshed out.
2019-01-06 01:58:15 -05:00
Tim Pope
fbeb9d6793 Use appropriate message for :Glog --walk-reflogs 2019-01-06 01:58:15 -05:00
Tim Pope
07f4f8d2a9 Don't set global value of 'modifiable' 2019-01-06 01:58:15 -05:00
Tim Pope
29f16cd924 Deprecate :Glog defaulting to current file 2019-01-05 14:08:01 -05:00
Tim Pope
b9ea3efdf8 Fix navigation maps like ~ in commit 2019-01-05 01:57:13 -05:00
Tim Pope
b1a993964b Fix commit maps while accommodating bad modelines
We need modifiable off for the maps to kick in, but we need to turn it
back off before the doautocmd or else it will throw an error if the
modeline modifies the buffer with an option like fileencoding, which you
should never do, stop doing it.
2019-01-05 01:44:04 -05:00
Tim Pope
b88d064ac4 Nobody has a version of Vim older than 7.2 anymore 2019-01-05 01:36:40 -05:00
Tim Pope
201896b9a2 Clarify - map 2019-01-05 01:33:17 -05:00
Tim Pope
acf3cb4400 Reveal full hunk on :Gstatus CTRL-N 2019-01-03 22:47:41 -05:00
Tim Pope
9c74c0d0a7 Restore :checktime for :Gstatus delete
I assumed this was a naive attempt to reload the status buffer, when in
fact it was concerned with reloading the deleted file.
2019-01-03 22:47:41 -05:00
Tim Pope
4df6525284 Fix check for :Gstatus window 2019-01-03 22:47:41 -05:00
Tim Pope
a4de0238bb Try split instead of preview window for :G 2019-01-03 21:08:27 -05:00
Tim Pope
227159e964 Include backslash lines in diff hunks 2019-01-03 21:08:27 -05:00
Tim Pope
9e4fd4b3f6 Run diff for :Gstatus from project root
Closes https://github.com/tpope/vim-fugitive/issues/1155
2019-01-03 21:08:27 -05:00
Tim Pope
8c89c8d1f5 Enable maps in :Git! output buffers 2019-01-03 16:08:01 -05:00
Tim Pope
42408d6a2e Don't break jump list when loading buffer
Closes https://github.com/tpope/vim-fugitive/issues/1124
2019-01-03 16:08:01 -05:00
Tim Pope
3383badda5 Don't stage/unstage from unstage/stage maps
This needs count and visual selection support.
2019-01-03 12:20:54 -05:00
Tim Pope
faeb3a9726 Enable discarding individual hunks 2019-01-03 11:44:19 -05:00
Tim Pope
357fbdbcf9 Enable staging individual hunks 2019-01-03 11:44:19 -05:00
Tim Pope
6cf448324c Fix inline diffs including submodule logs
Closes https://github.com/tpope/vim-fugitive/issues/1151
2019-01-03 11:44:19 -05:00
Andrew Haust
fa6d7886e7 Fix patch mapping in README 2019-01-03 11:02:10 -05:00
Tim Pope
d948ec3376 Support expanding inline diffs in :Gstatus 2019-01-03 00:19:21 -05:00
Tim Pope
51abc6a1bb Fix :Gstatus toggle on Unstaged heading 2019-01-02 16:58:50 -05:00
Tim Pope
d4e06150cb Fix issue loading conflict buffers on :Grebase -i 2019-01-02 16:58:50 -05:00
Tim Pope
61d467b573 Extract function for reloading individual :Gstatus 2019-01-02 16:58:50 -05:00
Tim Pope
054ac50975 Fix reference to rebase buffer when closing tab 2019-01-01 19:28:01 -05:00
Tim Pope
037965583e Don't overlap navigation maps with :Gcommit maps 2019-01-01 19:01:33 -05:00
Tim Pope
4c7998f58c Add :G as alias for :Gstatus 2019-01-01 14:21:16 -05:00
Tim Pope
40e8d0b9f0 Support for :Grebase --interactive 2018-12-31 13:48:38 -05:00
Tim Pope
9aef731593 Add rebase summary to :Gstatus
For lack of better ideas this is heavily inspired by Magit, though I'm
not really convinced it's the best representation.
2018-12-31 12:08:31 -05:00
Tim Pope
bad1331607 Don't jump from :Gstatus another :Gstatus 2018-12-31 12:07:45 -05:00
Tim Pope
ce3d3df508 Fix maps in commit buffers 2018-12-31 01:45:12 -05:00
Tim Pope
cb18a96651 Do what I mean for :Grebase --autosquash 2018-12-31 01:01:07 -05:00
Tim Pope
b8364709e7 Refer :Gstatus p users to P 2018-12-31 01:01:07 -05:00
Tim Pope
b9825af3dc Fix focus bug on reloading multiple :Gstatus buffers 2018-12-31 01:01:07 -05:00
Tim Pope
08179e1860 Declare highlights as defaults 2018-12-30 22:19:33 -05:00
Tim Pope
682b2acdac Remove outdated reference to :Gcommit calling :Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1144
2018-12-29 12:40:06 -05:00
Tim Pope
d41dee9c0b Deprecate fugitive#buffer() 2018-12-28 17:54:57 -05:00
rbong
b66141e252 Open todo file on Grebase --edit-todo 2018-12-28 17:53:01 -05:00
rbong
ae8fed6dd3 Call Gcommit on Grebase --continue
On a rebase instruction that should result in an immediate commit,
the quickfix list will be closed and Gcommit will be called.
2018-12-28 17:53:01 -05:00
Tim Pope
0850600021 Combine unstaged and untracked files into one section
Is this a good idea?  Let's find out!
2018-12-27 18:05:29 -05:00
Tim Pope
86990ef899 Fix - on :Gstatus section headings 2018-12-27 17:34:51 -05:00
Tim Pope
f2b644a60b Set dispatch to :Gfetch in :Gstatus 2018-12-26 16:24:16 -05:00
Tim Pope
a1f9596d2d Add mods support to :Gmerge 2018-12-26 16:24:16 -05:00
Tim Pope
de1f8b5a20 Fix workaround to reload status after :Dispatch 2018-12-26 16:24:16 -05:00
Tim Pope
a32c301f51 Remove :Gcommit claiming :Gstatus window 2018-12-25 19:36:26 -05:00
Tim Pope
261c00986d Change vsplit map from S to gO 2018-12-25 19:35:13 -05:00
Tim Pope
01050c9569 Fix :Gstatus error on branch without pull source 2018-12-25 16:35:00 -05:00
Tim Pope
d3468dd09b Prototype new :Gstatus 2018-12-25 14:11:50 -05:00
Tim Pope
d06080ae35 Reload status after dispatch.vim backed :Gpush 2018-12-24 17:25:32 -05:00
Tim Pope
1044e0f126 Fix config case sensitivity when cached 2018-12-24 17:25:29 -05:00
Tim Pope
d4eba85499 Add maps for :Gcommit --fixup/--squash 2018-12-24 14:42:47 -05:00
Tim Pope
b295f49e93 Change :Gstatus U to g|
I want U for a full `git reset`.  This will probably end up on X, but I
don't want to do a second abrupt transition, so for now, the official
map is the ungainly g|.
2018-12-24 14:42:47 -05:00
Tim Pope
d625c55689 Fix erratic conf file type on :Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1137
2018-12-24 11:36:39 -05:00
Tim Pope
baee3bbfe8 Prevent bad modeline from blocking a :split
Closes https://github.com/tpope/vim-fugitive/issues/1136
2018-12-23 17:15:44 -05:00
Tim Pope
38c6acf27a Disable modelines while loading blob
Modelines will still be evaluated by `doautocmd BufReadPost`.

References https://github.com/tpope/vim-fugitive/issues/1136
2018-12-23 14:31:16 -05:00
Zhao Xiaojie
70170d825c Add Gitee link (#1099) 2018-12-22 15:25:41 -05:00
Tim Pope
0f6038881f Handle case sensitivity in config keys correctly 2018-12-22 14:59:59 -05:00
Tim Pope
4ecd7e8932 Allow reusing dictionary for config queries 2018-12-22 14:59:59 -05:00
Tim Pope
73220820b5 Don't open :Gstatus on empty :Gcommit 2018-12-19 17:25:05 -05:00
Tim Pope
5540d257ef Add s and u aliases for stage/unstage in :Gstatus 2018-12-19 17:25:05 -05:00
Tim Pope
d48fc4a5ec Cache config queries
Does not support includeIf directives or a system config outside of
/etc/gitconfig for cache expiration.
2018-12-19 17:25:05 -05:00
Tim Pope
c98daaacfe Refactor :Gstatus reload cursor positioning 2018-12-18 19:53:24 -05:00
Tim Pope
e8f4f28c93 Replace deprecated repository relative path syntax 2018-12-18 18:44:49 -05:00
Tim Pope
da3b2f3285 Support tab local working directories 2018-12-16 22:28:01 -05:00
Tim Pope
2564c37d0a fugitive.vim 2.5
* Support :source and :write on Fugitive URLs.
* Support :Gedit +cmd ++opt.
* Support :Gedit /absolute/path and ./relative/path.
* Support expansion flags, like :Gedit %:h.
* Support completion of commits for --fixup=/--squash=.
* Support :Gread commit to read commit message.
* Adjust :Gbrowse line range for upstream head.
* Map <CR> in blobs to jump to blamed commit.
* Map p to jump to file in preview window.
* Make :Gmove always relative to repository root.
* Load Projectionist config from .git/info/projections.json.
* Drop instaweb support.
* New public function API.
* Major robustness and error handling improvements.
* Bug fixes.
2018-11-22 09:48:10 -05:00
Tim Pope
c316b924e8 Provide FugitivePrepare() 2018-11-22 09:36:28 -05:00
Tim Pope
7a190ead85 Remove transitional functions 2018-11-19 23:01:28 -05:00
Daniel Hahler
e48cf2dadd Gblame: allow passing --first-parent
Also fixes the filter for `--root` and `--show-name`.
2018-11-18 17:11:26 -05:00
Tim Pope
6d497b0e63 Fix erroneous use of :keeppatterns g/.../s//.../
Closes https://github.com/tpope/vim-fugitive/issues/1008
2018-10-28 19:48:15 -04:00
Tim Pope
dcf32d2b3d Clearer errors 2018-10-27 18:22:15 -04:00
Tim Pope
0fd64f8fbf Remove FugitiveGenerate() in favor of FugitiveFind() 2018-10-21 19:44:20 -04:00
Tim Pope
2845e6dc4f Fail silently retrieving work tree for blank git dir
Closes https://github.com/tpope/vim-fugitive/issues/1113
2018-10-17 23:20:11 -04:00
Tim Pope
7fae98f263 Associate conflicted files with relevant commits 2018-10-12 15:14:49 -04:00
Tim Pope
a9100fafb8 Show 7 not 8 SHA charcters in statusline 2018-09-24 17:04:06 -04:00
Tim Pope
9fec8aadc5 Use merge-base as starting point for ranged :Gbrowse 2018-09-19 17:38:19 -04:00
Tim Pope
66697b99d6 Don't throw error on invalid URL to FugitiveParse() 2018-09-19 17:17:17 -04:00
Tim Pope
fb55319973 Show error getting type for object in BufReadCmd 2018-09-15 16:47:28 -04:00
Justin M. Keyes
02fe20ece4 Use :keeppatterns with :substitute 2018-09-15 12:26:10 -04:00
Rick
6cd8ff77f0 Fix undefined variable 2018-09-13 10:51:08 -04:00
Tim Pope
af76267c6a Fix backport of @ to old Git 2018-09-12 12:32:43 -04:00
Tim Pope
144b73946e Older versions of cat-file do not accept -- 2018-09-12 12:06:19 -04:00
Tim Pope
d4fb2a2f5c Fix modeline support in historical buffers
Closes https://github.com/tpope/vim-fugitive/issues/1092
2018-09-09 09:37:06 -04:00
Tim Pope
4bf30ce907 Dogfood fugitive#Prepare() 2018-09-02 23:26:14 -04:00
Tim Pope
0fe0964385 Enhance fugitive#Prepare() 2018-09-02 23:25:43 -04:00
Tim Pope
8b4a1017b6 Simplify :Gstatus reset logic 2018-08-29 20:35:35 -04:00
Tim Pope
66e0fe5d3e Fix - in :Gstatus on line 1 as Vinegar like navigation 2018-08-29 20:34:42 -04:00
Tim Pope
61b09ca6b7 Fix gf in gitcommit diff
Closes https://github.com/tpope/vim-fugitive/issues/1084
2018-08-29 17:15:28 -04:00
Tim Pope
b3651aa744 Use platform path separator for Projectionist config 2018-08-29 17:15:28 -04:00
Tim Pope
fd83fcaf90 Support expansion flags 2018-08-28 00:35:35 -04:00
Tim Pope
1e3786734b Add potential alternative name for FugitiveRoute() 2018-08-28 00:35:35 -04:00
Tim Pope
4d3835f637 Accept buffer number to FugitiveRoute() 2018-08-28 00:35:35 -04:00
Tim Pope
44e5df8433 Provide API for retrieving working dir relative path 2018-08-27 21:04:41 -04:00
Tim Pope
a202238b5d Support Projectionist config in .git/info/projections.json 2018-08-26 17:42:19 -04:00
Tim Pope
bb2797d313 Special case :0Gread to get around FileReadCmd limitations 2018-08-20 15:00:55 -04:00
Tim Pope
67e9756c35 Support .git/.. to refer to work tree 2018-08-20 15:00:55 -04:00
Tim Pope
ae2005adbb Return '' for FugitiveRoute('') 2018-08-20 15:00:55 -04:00
Tim Pope
ed36717a68 Use 2 argument system() rather than stdin redirect 2018-08-19 23:26:36 -04:00
Tim Pope
b1ab990314 Use -- to disambiguate arguments
This is to enable future replacement of s:Prepare() with
fugitive#Prepare().
2018-08-19 23:24:45 -04:00
Tim Pope
2b5effe2f1 Fix :Gbrowse with cwd other than work tree 2018-08-19 18:27:46 -04:00
Tim Pope
662b501eee Resolve temp files only when using as buffer name
Closes https://github.com/tpope/vim-fugitive/issues/1078
2018-08-19 14:56:34 -04:00
Tim Pope
7bdf33d375 Always convert backslashes on Windows
The old conditional was fine for most things, but this ensures that
backslashes are used even for raw user input.

References https://github.com/tpope/vim-fugitive/issues/1079
2018-08-19 14:56:34 -04:00
Tim Pope
e9dc363745 Fix check for need to convert Windows path slashes
Closes https://github.com/tpope/vim-fugitive/issues/1079
2018-08-19 05:07:33 -04:00
Tim Pope
9979b2ab7c Ignore 'shellslash' when checking for Win32 shell 2018-08-19 00:11:46 -04:00
Tim Pope
8589246545 Tweak check for Win32 shell
References https://github.com/tpope/vim-fugitive/issues/1079
2018-08-18 23:15:05 -04:00
Tim Pope
7b0aa58090 Accept ./ paths as relative to cwd 2018-08-15 19:24:35 -04:00
Tim Pope
45c21fc384 Normalize path specs when generating commands 2018-08-13 00:08:59 -04:00
Tim Pope
8dc13a6a72 Restore backwards compatible behavior of repo.translate() 2018-08-12 23:03:20 -04:00
Tim Pope
0614acc770 Fix issues with commit:./relative completion 2018-08-12 21:37:38 -04:00
Tim Pope
1a7b07cf22 Support commit:./relative style revisions 2018-08-11 19:15:56 -04:00
Tim Pope
4a3c6b4a56 Adjust section headers 2018-08-11 19:15:56 -04:00
Tim Pope
e3c9588e07 Extract function for getting current commit/ref 2018-08-11 19:15:56 -04:00
Tim Pope
40facfde5e Rewrite <C-R><C-G> and y<C-G> 2018-08-11 02:41:33 -04:00
Tim Pope
236bd21b45 Use <nowait> for - maps
Closes https://github.com/tpope/vim-fugitive/issues/1076
2018-08-11 02:41:33 -04:00
Tim Pope
e9ce313912 Support pathspec arguments to :Gcd 2018-08-11 01:26:23 -04:00
Tim Pope
74b10425eb Fix legacy expansion of bare caret/tilde 2018-08-11 01:26:21 -04:00
Tim Pope
1a041936da Provide less awkward signature for s:Prepare() 2018-08-11 00:55:21 -04:00
Tim Pope
a358191cfb Use unambiguous paths for :Gstatus dot map
When the current working directory isn't the work tree, use absolute
paths so that pairing with both :Git and :! works as expected.
2018-08-10 19:22:13 -04:00
Tim Pope
597289e64d Handle :Gmove paths consistently 2018-08-10 19:22:13 -04:00
Tim Pope
7ea21ca9ac Give precedence to absolute paths over pseudo-relative
I was planning on phasing out support for /path to access a file in the
root of the repo slowly, but life gets simpler if we can count on
absolute paths always working as expected.
2018-08-10 16:00:46 -04:00
Tim Pope
2ca0765dc4 Ignore dot files when globbing 2018-08-10 16:00:46 -04:00
Tim Pope
347d309efb Mention :Gcommit %
Closes https://github.com/tpope/vim-fugitive/issues/1029
2018-08-10 16:00:42 -04:00
John Varga
6138aebbbb Fix minor spelling error in help document 2018-08-08 16:26:11 -04:00
Tim Pope
dd262b7e21 Decouple routing from repo object 2018-08-06 16:38:49 -04:00
Tim Pope
f91c34069e Decouple Head() from repo object 2018-08-06 16:38:49 -04:00
Tim Pope
40e2dcba05 Delegate to other real filename implementations 2018-08-06 16:38:49 -04:00
Tim Pope
a3e9518186 Fix file API to distinguish between commits 2018-08-06 16:38:49 -04:00
Tim Pope
8c63314381 Report error checking for merge conflict
References https://github.com/tpope/vim-fugitive/issues/756
2018-08-06 11:13:42 -04:00
Tim Pope
12e0151750 Adjust completion of /absolute/paths
Support for an initial slash to access a work tree file is being phased
out.
2018-08-06 10:55:46 -04:00
Tim Pope
887d86e920 Don't strip trailing slash from URLs 2018-08-06 10:54:09 -04:00
Tim Pope
73ed8e8a71 Fix check for empty remote 2018-08-06 01:45:39 -04:00
Tim Pope
4bf7f2fd69 Support :(top) pseudo-pathspecs 2018-08-04 20:13:47 -04:00
Tim Pope
08d471056e Provide fugitive#Prepare() 2018-08-04 20:13:47 -04:00
Tim Pope
969a3d857f Don't escape "!" when calling :terminal 2018-08-04 20:13:47 -04:00
Tim Pope
06b3da7204 Fix shell expansion in :Git! buffers 2018-08-04 18:54:28 -04:00
Tim Pope
db3b837e6e Rewrite :Glog to use string argument rather than list
This makes shell expansion less weird.
2018-08-03 01:35:44 -04:00
Tim Pope
b780bce39b Expand argument to :Gwrite 2018-08-02 22:50:33 -04:00
Tim Pope
a615172b14 Edit index file when no work tree present
Life gets simpler if this function never fails.
2018-08-02 18:39:02 -04:00
Tim Pope
caee67c748 Fix query operations in bare repositories 2018-08-02 18:39:02 -04:00
Tim Pope
1fea1e5821 Support :Gedit /absolute/path when possible
Usage of /relative/path is deprecated in favor of ./relative/path, but
it's still supported on top of this for now.
2018-08-02 15:32:14 -04:00
Tim Pope
80e410c81a Fix :Gedit default from commit to work tree 2018-08-02 15:16:36 -04:00
Tim Pope
84fcfae7f0 Unify shell expansion 2018-08-01 21:49:49 -04:00
Tim Pope
4d684256ba Update :Gbrowse docs 2018-08-01 17:21:16 -04:00
Tim Pope
0e948d514c Fix write command with Win32 path 2018-08-01 14:14:38 -04:00
Tim Pope
4eee908ad5 Adjust :Gbrowse range for upstream head 2018-08-01 13:54:12 -04:00
Tim Pope
c1d2fc1a19 Remove filename expansion from buffer object
This has long haunted me as a particularly egregious design, as
expansion of "%" is always respective to the current buffer.
2018-07-31 23:57:38 -04:00
Tim Pope
c85980cd93 Rename s:shellslash() to s:Slash() 2018-07-31 16:39:15 -04:00
Tim Pope
81deb6333a Improve worktree support 2018-07-31 16:39:13 -04:00
Tim Pope
85f340590d Fix :Gbrowse in historical buffers 2018-07-31 15:25:14 -04:00
Tim Pope
fc8f9eda9d Rename Fugitive revisions to Fugitive objects
Neither term is great, as they both exclude work tree files in Git
parlance, but "object" is a better umbrella term as "revision" can be
actively misleading in some contexts.
2018-07-31 02:44:44 -04:00
Tim Pope
c82abd0558 Fix function reference 2018-07-31 02:44:42 -04:00
Tim Pope
d859e05f00 Really fix :Gcd
Closes https://github.com/tpope/vim-fugitive/issues/1071
2018-07-31 02:24:31 -04:00
Tim Pope
3feda7f440 Fix :Gcd
Closes https://github.com/tpope/vim-fugitive/issues/1071
2018-07-31 01:00:14 -04:00
Tim Pope
c9c406a118 Fix extra slash generating work tree filenames
Closes https://github.com/tpope/vim-fugitive/issues/1069
2018-07-30 19:40:47 -04:00
Tim Pope
a877908acd Fix check for absolute path in FugitiveGenerate() 2018-07-30 01:36:31 -04:00
Tim Pope
6c89a3675b Support :Gedit +cmd ++opt 2018-07-30 00:47:26 -04:00
Tim Pope
bf796562b6 Add better name for function as alias 2018-07-29 22:41:29 -04:00
Tim Pope
023ab8e4a6 Eliminate s:repo() and s:buffer() 2018-07-29 22:41:29 -04:00
Tim Pope
da95d96ece Replace s:repo().rev_parse() 2018-07-29 22:41:29 -04:00
Tim Pope
8a0a448f56 Show fake trees when editing directory in index 2018-07-29 15:08:31 -04:00
Tim Pope
004da420e5 Match trailing slash in FugitivePath() 2018-07-29 14:30:51 -04:00
Tim Pope
8b4194047c Rearrange 2018-07-29 14:30:48 -04:00
Tim Pope
716edd4bc0 Redo completion 2018-07-29 00:24:28 -04:00
Tim Pope
70c0f132f5 Fix :Gblame 2018-07-29 00:24:28 -04:00
Tim Pope
a8392e0ebb Fix fugitive#Real() with non-Fugitive URL 2018-07-29 00:24:28 -04:00
Tim Pope
64fbfc7a8d Whitespace fix 2018-07-29 00:24:28 -04:00
Tim Pope
f232e4c6a3 Support completion of local commits for --fixup=/--squash= 2018-07-28 22:05:03 -04:00
Tim Pope
db7fd110a8 Move implementation functions below public API 2018-07-28 22:05:03 -04:00
Tim Pope
248764f2c3 Provide FugitiveGitDir() 2018-07-28 22:05:03 -04:00
Tim Pope
f8fb5eafab Eliminate remaining s:repo().dir() and s:repo().tree() calls 2018-07-28 22:05:03 -04:00
Tim Pope
4f82d241cc Fix jump to file 2018-07-28 22:05:03 -04:00
Tim Pope
f761ea700c Rewrite :Gedit and :Gread 2018-07-28 20:33:28 -04:00
Tim Pope
035cdf44e8 Make fugitive#Prepare() private 2018-07-28 20:33:17 -04:00
Tim Pope
deaf4aa139 Pass absolute paths through FugitiveGenerate() unchanged
This is designed to exclude traditional paths, URLs, and also Vim
constructs like zipfile:c:\foo.zip::file.
2018-07-28 20:33:17 -04:00
Tim Pope
da066426fd Use <amatch> in detection autocommands 2018-07-28 19:43:44 -04:00
Tim Pope
4643363b08 Handle FugitiveReal('') correctly 2018-07-28 19:43:44 -04:00
Tim Pope
c5d4ce7479 Fix map to follow the pattern 2018-07-28 17:37:07 -04:00
Ryo Susami
6eadff1107 Correct the directory separator of Path() on Windows (#1067) 2018-07-28 01:50:51 -04:00
Tim Pope
c68fb3c83a Remove redundant maps 2018-07-27 13:42:11 -04:00
Tim Pope
6c09ce3ab4 Prefer :Gedit to s:Edit() where possible 2018-07-27 13:39:53 -04:00
Tim Pope
cec05fac01 Fix missing :Gblame in work tree files
Closes https://github.com/tpope/vim-fugitive/issues/1066
2018-07-27 08:54:58 -04:00
Tim Pope
4b0475f9d8 Map <CR> in blobs to jump to blamed commit 2018-07-27 01:48:44 -04:00
Tim Pope
8edc9cd006 Work around janky autocommands when returning to diffed window
Closes https://github.com/tpope/vim-fugitive/issues/1065
2018-07-27 01:46:13 -04:00
Tim Pope
382c0a5405 Provide config functions globally
This makes it easier to check for them with exists().
2018-07-27 01:46:13 -04:00
Tim Pope
c472b8f2c1 Provide file permission API 2018-07-27 01:34:49 -04:00
Tim Pope
30c2490b6e Provide file writing API 2018-07-27 01:34:49 -04:00
Tim Pope
5a9b7a593b Provide file deletion API 2018-07-27 01:34:49 -04:00
Tim Pope
4ce8646410 Remove s:repo().aliases() 2018-07-27 01:34:49 -04:00
Tim Pope
321f63ff19 Compartmentalize filetype support 2018-07-27 00:19:57 -04:00
Tim Pope
7f299fbbe3 Eliminate remaining uses of s:buffer().type() 2018-07-27 00:19:57 -04:00
Tim Pope
6d0df81732 Run correct auto-commands for BufWrite and FileWrite 2018-07-26 20:56:26 -04:00
Tim Pope
5cea916e9c Support Vim without SourceCmd 2018-07-26 20:54:39 -04:00
Tim Pope
c3c39d904b Try embedding shell cd if -C not available
Old Git versions lacking -C are often paired with old Vim versions
lacking haslocaldir(), so chance some shell weirdness over screwing up
Vim's local directory.
2018-07-26 15:51:06 -04:00
Tim Pope
6bab1a0c39 Map p to jump to file in preview window
Closes https://github.com/tpope/vim-fugitive/issues/1047
2018-07-25 16:30:54 -04:00
Tim Pope
49c2a4acb5 Revert "Unify jump to file logic"
This reverts commit 73c39195ae, which
broke opening in a different window from :Gstatus.
2018-07-25 16:12:19 -04:00
Tim Pope
73c39195ae Unify jump to file logic 2018-07-25 02:04:48 -04:00
Tim Pope
f818a947ae Map p to in :Gblame to open commit in preview window 2018-07-25 01:06:08 -04:00
Tim Pope
fbaa831e57 Show error on :Gblame jump on uncommitted line 2018-07-25 01:06:08 -04:00
Tim Pope
07d30de8be Return relative paths with second argument to FugitivePath() 2018-07-25 01:04:36 -04:00
Tim Pope
c693da9cb0 Drop support for uppercase statusline indicator
If you want this, I'm happy to bring it back as a separate function.  I
think it's a bit too clever to detect automatically.
2018-07-25 01:04:36 -04:00
Tim Pope
1e7e707696 Preserve trailing slash in FugitiveReal() 2018-07-24 23:13:29 -04:00
Tim Pope
d818ac93af Make bang argument to :Glog explicit
Playing with some changes here and committing this part makes it easier
to reload the plugin after stashing changes.
2018-07-24 23:13:29 -04:00
Tim Pope
2fcf95467f Remove obsolete instaweb reference from README 2018-07-24 23:13:29 -04:00
Tim Pope
286476d58f Fix upwards navigation on "-" 2018-07-24 23:13:29 -04:00
Tim Pope
b78a8ab860 Remove indirection 2018-07-24 23:13:29 -04:00
Tim Pope
e6e3f3f225 Don't :cd if directory already correct 2018-07-24 19:58:01 -04:00
Tim Pope
240127f5a5 Eliminate use of buffer.commit()
Can't add a s:Commit() helper because that's the :Gcommit implementation
function, dang it.
2018-07-24 19:58:01 -04:00
Tim Pope
bfc1745f3b Handle bare repository case when shelling out 2018-07-23 13:55:50 -04:00
Tim Pope
93f29cf831 Fix shelling out from subdirectory
Closes https://github.com/tpope/vim-fugitive/issues/1061
2018-07-23 13:50:48 -04:00
Tim Pope
5879304769 Move GIT_INDEX_FILE override closer to home 2018-07-23 13:50:48 -04:00
Tim Pope
196e448375 Make :Gmove always relative to repository root 2018-07-22 19:16:17 -04:00
Tim Pope
e0b770a9bd Drop instaweb support
I had been considering extracting it, but it's so badly broken that
clearly nobody actually uses it.
2018-07-22 17:33:59 -04:00
Tim Pope
c938737960 Encapsulate fugitive#buffer().relative() 2018-07-22 16:17:17 -04:00
Tim Pope
978ca4a5ce Encapsulate fugitive#repo().git_chomp_in_tree() 2018-07-22 16:14:42 -04:00
Tim Pope
a8626a4ca4 Avoid false positive matches of status files in non-status buffers 2018-07-22 01:58:20 -04:00
Tim Pope
4a5781bc1b Fix issue generating Fugitive URLs 2018-07-22 01:57:39 -04:00
Tim Pope
71acb7da35 Provide FugitiveGenerate() and FugitiveParse() 2018-07-22 01:29:49 -04:00
Tim Pope
1e41a88ec9 Default to branch remote rather than origin 2018-07-21 21:53:26 -04:00
Tim Pope
9e7b67e9b0 Refactor repo.translate for future extraction 2018-07-21 21:53:26 -04:00
Tim Pope
445a8160d2 Provide Git dir to browse handlers 2018-07-21 21:53:26 -04:00
Tim Pope
cb49f8b4be Drop repo.dirglob 2018-07-21 21:53:26 -04:00
Tim Pope
6aa3f09eb7 Drop buffer.up 2018-07-21 21:42:34 -04:00
Tim Pope
197ca58a95 Remove unused variable 2018-07-21 21:42:34 -04:00
Tim Pope
7165817b69 Attempt 2 at fixing :Gbrowse tagname 2018-07-21 21:42:34 -04:00
Tim Pope
be68a8ec8a Add Git config query functions
Querying the remote URL is a behavior needed by Rhubarb and similar
plugins, so add a function for it in particular.
2018-07-21 17:36:51 -04:00
Tim Pope
b8046d1c5e Reduce noise on E211 from :Git 2018-07-21 17:36:51 -04:00
Tim Pope
b7e57637ba Add warning for editing invalid Fugitive URL
Closes https://github.com/tpope/vim-fugitive/issues/1060
2018-07-21 17:36:51 -04:00
Tim Pope
35f94eef48 Make argument to FugitiveTreeForGitDir optional 2018-07-21 15:43:10 -04:00
Tim Pope
c118dabb89 Fix :Glog
Closes https://github.com/tpope/vim-fugitive/issues/1059
2018-07-20 22:06:22 -04:00
Tim Pope
8c076e3f68 Drop some silly instance methods 2018-07-20 15:30:54 -04:00
Tim Pope
0aa3389f5c Decouple :Gcommit from repo object 2018-07-20 15:30:54 -04:00
Tim Pope
fb2289982b Rename overlooked snakecase function 2018-07-20 02:11:19 -04:00
Tim Pope
56e4947843 Support FileWriteCmd
This correctly requires a bang to write a partial file, but the error
message is E212 rather than the more appropriate E140.
2018-07-20 00:03:45 -04:00
Tim Pope
99f0431135 Thorough error reporting for broken system() calls 2018-07-19 02:59:29 -04:00
Tim Pope
29411e2801 Decouple autocommand functions from repo object 2018-07-19 02:59:29 -04:00
Tim Pope
c0b6faeae7 Support SourceCmd for Fugitive URLs 2018-07-18 20:11:19 -04:00
Tim Pope
792154e45d Unify FileReadCmd autocommands 2018-07-18 20:01:58 -04:00
Tim Pope
0717396aa2 Avoid some redundant --git-dir arguments 2018-07-18 20:01:58 -04:00
Tim Pope
9b9a81b170 Fix error on failure to load buffer 2018-07-18 20:01:58 -04:00
Tim Pope
598ad040b3 Fix b:fugitive_type in temp buffers 2018-07-18 19:46:48 -04:00
Tim Pope
805c0bbdd9 Fix i and a in :Gstatus
This is a stupid feature that needs to be ripped out.
2018-07-18 19:46:48 -04:00
Tim Pope
1971f8fd62 Restore highlight after warning message 2018-07-18 17:58:56 -04:00
Tim Pope
5ba918ea7b Support :Gread commit to read commit message 2018-07-17 01:42:57 -04:00
Tim Pope
27475a5d08 Provide function for preparing Git shell command 2018-07-17 01:42:57 -04:00
Tim Pope
e3b1af604c Work around bad b:git_dir from ftplugin/git.vim 2018-07-17 01:42:57 -04:00
Tim Pope
c9d6c83470 Loosen regexp to allow for Windows paths 2018-07-16 21:44:32 -04:00
Tim Pope
8df073165a Extract helper for robust tempname 2018-07-16 21:38:21 -04:00
Tim Pope
9bc425e943 Add missing function 2018-07-16 21:38:16 -04:00
Tim Pope
65346f0926 Fix readfile 2018-07-16 20:29:48 -04:00
Tim Pope
5a7469d899 Improve error reporting for BufReadCmd autocommands 2018-07-16 17:11:50 -04:00
Tim Pope
6f07b18012 Allow opting out of :terminal in Neovim
Closes https://github.com/tpope/vim-fugitive/issues/1051
2018-07-13 15:14:09 -04:00
Tim Pope
302f30c924 Handle :Gcommit % when working dir isn't Git dir 2018-07-11 00:21:03 -04:00
Tim Pope
7316baffdd Fix typo in regexp 2018-07-10 17:28:00 -04:00
Tim Pope
85c6c7a837 fugitive.vim 2.4
* Split into plugin, autoload, and ftdetect files.
* Support mods like :vertical on :Gstatus and :Gedit family.
* Provide :Grebase (no --interactive).
* Bug fixes.
2018-07-10 00:04:17 -04:00
Tim Pope
6f9fa8a4b1 Document P as preferred :Gcommit map for patching 2018-07-02 18:26:52 -04:00
Tim Pope
65a53b5f5c Guard against future NERDTree API changes 2018-07-02 15:12:09 -04:00
Tim Pope
0a75ec5d9b Provide file API
You can call these functions directly if you want, but they're designed
to be a generic interface for any URL:

    function! s:fcall(fn, file, ...) abort
      let ns = matchstr(a:file, '^\a\a\+\ze:')
      if len(ns) && exists('*' . ns . '#' . a:fn)
        return call(ns . '#' . a:fn, [a:file] + a:000)
      else
        return call(a:fn, [a:file] + a:000)
      endif
    endfunction
2018-07-01 20:22:25 -04:00
Tim Pope
80ff014d21 Add function alias
This might become the official version.
2018-06-29 18:11:17 -04:00
Tim Pope
b5f7c37d93 Replace buffer.path() with buffer.relative() 2018-06-28 15:44:22 -04:00
Tim Pope
6d2a83232a Handle bare repos in FugitivePath() 2018-06-28 15:43:52 -04:00
Tim Pope
ea38c7d664 Don't include newline in Git version 2018-06-28 15:43:52 -04:00
Tim Pope
2c30e116ed Avoid unnecessary IO in translate() 2018-06-27 20:25:43 -04:00
Tim Pope
1988518904 Rename FugitiveFilename() to FugitivePath() 2018-06-27 17:20:15 -04:00
Tim Pope
2a817bb53a Fix :Gbrowse tagname 2018-06-25 18:30:37 -04:00
Tim Pope
38c69cfebc Rename blob() to relative()
On second thought, we should exclude .git/ files from blob, so pick a
different name for now.
2018-06-25 16:44:11 -04:00
Tim Pope
70a36ceef8 Alias buffer.path() as buffer.blob()
Blob isn't a great name, but it's less ambiguous.
2018-06-25 16:05:57 -04:00
Tim Pope
f71079db4d Work around guioptions+=! on Windows
Closes https://github.com/tpope/vim-fugitive/issues/1042
2018-06-25 12:52:24 -04:00
Tim Pope
cbf96cc01a Clean up repetition in URL parsing 2018-06-20 18:28:25 -04:00
Tim Pope
8fa5cad8d7 Fix references to renamed functions 2018-06-20 18:05:43 -04:00
Tim Pope
251853bc1e Fix use of <Plug> in a <script> map
References https://github.com/tpope/vim-fugitive/issues/1044
2018-06-20 14:32:10 -04:00
Tim Pope
639b9f9a54 Fix load order issue setting up maps
References https://github.com/tpope/vim-fugitive/issues/1044
2018-06-20 14:24:35 -04:00
Tim Pope
13f39967f4 Loosen match for hunk header 2018-06-17 17:23:59 -04:00
Tim Pope
d39d5ca429 Accept alternate forms of Fugitive URL
This is to prepare for a potential transition to a URL replacement that
isn't mutilated by simplify().
2018-06-15 23:23:11 -04:00
Tim Pope
bb54881388 Jump directly to commit rather than ref file in more cases 2018-06-15 15:31:27 -04:00
Tim Pope
f7bcf51c56 Extract ftdetect file 2018-06-14 15:37:24 -04:00
Tim Pope
cc9d8d93c8 Add FugitiveFilename() to determine corresponding real file 2018-06-14 15:37:24 -04:00
rhysd
b571bff9ec Specify 'nowrite' to status buffer and blame buffer 2018-06-07 11:27:48 -04:00
Tim Pope
5c2095be39 Camel case public functions 2018-06-01 16:26:05 -04:00
Tim Pope
5d11ff7501 Extract autoload file 2018-06-01 16:26:05 -04:00
Tim Pope
dd4d4c7595 Update statusline function in README 2018-06-01 16:26:05 -04:00
Tim Pope
013ee636f5 Drop 'compatible' check
You really have to go out of your way to load a plugin in compatible
mode.
2018-06-01 13:38:22 -04:00
Tim Pope
ddec4bfa86 Move foldtext autocommand back to folding section 2018-06-01 13:25:29 -04:00
Tim Pope
f8913cda12 Fix :Gcommit invocation of :Gstatus
Closes https://github.com/tpope/vim-fugitive/issues/1034
2018-05-31 20:32:52 -04:00
Tim Pope
68e097db6f Gather up global autocommands and functions 2018-05-31 18:43:17 -04:00
Tim Pope
d850dff16e Expose Cmd autocommand functions 2018-05-31 18:43:17 -04:00
Tim Pope
8977570aa6 Handle symlinked directories more aggressively 2018-05-31 18:43:17 -04:00
Tim Pope
caf89d797f Provide official function for configured tree 2018-05-31 18:43:17 -04:00
Tim Pope
c8b1a7d9b6 Remove self evident comment 2018-05-31 18:43:17 -04:00
Tim Pope
0e2680f9ae Separate detection from initialization 2018-05-31 18:43:17 -04:00
Tim Pope
8c43505037 Provide :Grebase (no --interactive) 2018-05-31 18:43:17 -04:00
Tim Pope
fecd42864a Handle unusually named netrw buffers 2018-05-31 18:43:17 -04:00
Tim Pope
01e7a7e1e6 Switch out new and old official functions 2018-05-31 13:49:34 -04:00
Tim Pope
b129752c07 Fix maps that rely on s:Edit 2018-05-31 13:49:34 -04:00
Tim Pope
aa0210a986 Support <mods> on :Gstatus and :Gedit family 2018-05-30 00:49:48 -04:00
Tim Pope
d7c377f3ba Loosen regexps to accept alternate comment chars
References https://github.com/tpope/vim-fugitive/issues/1025
2018-05-30 00:49:48 -04:00
Tim Pope
cde670ee81 fugitive.vim 2.3
* Support worktrees.
* Provide API for extensible :Gbrowse support.
* Remove GitHub URL support in favor of rhubarb.vim.
* Provide :Gdelete to delete both file and buffer.
* Provide :Grename to move relative to file's parent directory.
* Split to open file when :Gstatus is only window.
* Provide U in :Gstatus to discard changes.
* Provide additional :Gstatus commit maps.
* Provide d2o and d3o to obtain diff during conflict.
* Support :tab Gcommit.
* Open :Gcommit tab before current.
* Support :Gdiff +cmd.
* Support gf in Git file types.
* Add flagship.vim statusline indicator.
* Use the Neovim terminal emulator for :Git.
* Bug fixes.
2018-05-28 14:22:08 -04:00
Tim Pope
26433842e9 Revert accidentally committed changes
This partially reverts commit 65be0ae749.
2018-05-27 15:21:22 -04:00
Tim Pope
eeaadf7255 Fix off by one error 2018-05-27 15:18:57 -04:00
Tim Pope
65be0ae749 Fix accidental version bump 2018-05-27 15:18:40 -04:00
Tim Pope
6faf165ef2 Avoid non-file windows for :Gstatus open
Closes https://github.com/tpope/vim-fugitive/issues/1002
2018-05-27 01:02:44 -04:00
Tim Pope
614e20bb65 Dispatch BufReadPre 2018-05-22 22:02:13 -04:00
Tim Pope
33b7c1a5b7 Don't run autocommands loading temp file
This should bring about a small performance improvement as prevent some
confusion in other plugins.
2018-05-22 22:01:19 -04:00
Tim Pope
2a4714335f Remove #Repo and #Buffer
Let's save these for when we're ready to rename the instance variables
too.
2018-05-19 19:30:08 -04:00
Tim Pope
994d781f90 Add deprecation warning for :Gstatus cA 2018-05-19 15:41:25 -04:00
Tim Pope
a5a75aca92 Bring back :Gstatus C with a warning 2018-05-16 00:28:17 -04:00
Tim Pope
0078c76106 Blow up if user assigns string to map variable 2018-05-15 23:11:13 -04:00
Tim Pope
e0fa72363a Fix missing bang on function 2018-05-15 23:03:13 -04:00
Tim Pope
a22adef4e0 Use capitalized names for official functions
The distinction between "Fugitive" and "fugitive#" functions is whether
it will live in the plugin or autoload file, once the separation finally
comes to pass.
2018-05-15 23:03:13 -04:00
Tim Pope
b14434bae0 Tweak :Gstatus commit maps 2018-05-11 17:12:18 -04:00
Tim Pope
5c2eccd55d Fix unique map check 2018-05-06 22:35:44 -04:00
Tim Pope
b1df5f1226 Allow mapping overrides
Not bothering with the read only buffer maps for now but it would
certainly make sense to.

References https://github.com/tpope/vim-fugitive/issues/761
2018-05-06 19:14:05 -04:00
Tim Pope
b34083549e Make :s use more robust 2018-05-06 19:10:51 -04:00
Tim Pope
dcecb762b0 Add :Grename
I'll rip out the weird current directory stuff later.
2018-05-04 21:42:38 -04:00
Tim Pope
fa1b8652f1 Add .gitattributes 2018-04-22 19:01:53 -04:00
Teo Ljungberg
40d78f07de Strip out carriage returns 2018-04-15 15:54:35 -04:00
Teo Ljungberg
63a80f4bfe Remove unused variable 2018-04-15 15:54:35 -04:00
Tim Pope
3bdac8b603 Tighten explanation of no commands FAQ 2018-04-12 20:35:14 -04:00
Tim Pope
d87ad99e28 Remove outdated FAQ about :Gbrowse 2018-04-12 19:31:30 -04:00
Tim Pope
b680699450 Don't force tab for :Gcommit --verbose
Keep it for -v, for now.

Closes https://github.com/tpope/vim-fugitive/issues/1011
2018-04-06 15:05:24 -04:00
Tim Pope
3ac95c4dde Add support for :tab Gcommit
References https://github.com/tpope/vim-fugitive/issues/1011
2018-04-06 15:05:24 -04:00
Daniel Hahler
409b098c93 Optimize fugitive#foldtext
Only really relevant when using `set cursorline` [1], but good in
general after all.

1: https://github.com/vim/vim/issues/2773
2018-04-04 17:40:08 -04:00
Tim Pope
3e0bd86b99 Add a note about options 2018-03-14 17:11:34 -04:00
Tim Pope
9268cb4ea4 Link to commit.style 2018-03-14 17:11:34 -04:00
Tim Pope
b82abd5bd5 Link to quickfix help topic
Closes https://github.com/tpope/vim-fugitive/issues/987
2018-01-25 13:08:57 -05:00
Daniel Hahler
f3ccb0c12e BufReadObject: handle rev-parse errors
With `:Gdiff ^` on a file that has just been added, you would get an
error via `git rev-parse --verify`:

> fatal: Needed a single revision

The error message is clearer when not using `--verify`:

> fatal: Path 'X' exists on disk, but not in 'SHA'.

The behavior depends on if you use `:set hidden`, where the second
invocation works, as in will open an empty buffer - apparently since it
has been created as "a buffer with read errors" ("x" in `:ls!`) before.

Fixes https://github.com/tpope/vim-fugitive/issues/866.
2017-12-16 13:41:32 -05:00
Tim Pope
5032d9ee72 Strip backslashes on expansion
Closes https://github.com/tpope/vim-fugitive/issues/975
2017-11-30 15:04:21 -05:00
Carlos Coelho
de6c05720c Use NERDTree.root instead of removed NERDTreeRoot
As of scrooloose/nerdtree@d36b793, it was recommended to use
NERDTree.root instead of deprecated NERDTreeRoot. Also, this command
seems to be recently removed since it was throwing an Undefined
variable: b:NERDTreeRoot when starting Vim.
2017-11-25 23:21:51 -05:00
Jesse Atkinson
d16cd9ced1 Update "OS X" to "macOS" in README 2017-11-09 18:52:12 -05:00
Tim Pope
7c9b87a3c3 Fix escaping in :Gblame
Closes https://github.com/tpope/vim-fugitive/issues/952
2017-10-21 18:06:41 -04:00
Michael Budde
42daa3183b Do not accept :Gread count in argument position
Use `-range` instead of `-count` to prevent Vim from interpreting a
branch name starting with a number as a count, e.g. `:Gread 123-foo`
being interpreted as `:123Gread -foo`.
2017-10-09 23:14:23 -04:00
Stephen Rasku
8f60d1d459 Use https:// to clone
HTTPS is better supported in proxied corporate environments.
2017-09-01 02:43:35 -04:00
Samuel Roeca
913fff1cea Limit use of :terminal to nvim 2017-07-12 17:33:37 -04:00
Tim Pope
be2ff98db5 Provide :Gdelete
Closes https://github.com/tpope/vim-fugitive/issues/804
2017-06-08 01:25:15 -04:00
Tim Pope
280bbdb6eb Fix syntax error
Closes https://github.com/tpope/vim-fugitive/issues/623
2017-06-07 19:32:02 -04:00
Tim Pope
366996484e Limit use of lookbehind in :Gblame highlighting
Closes https://github.com/tpope/vim-fugitive/issues/921
2017-06-07 13:34:15 -04:00
Tim Pope
7be1f0aef6 Eliminate use of =... 2017-05-30 14:10:37 -04:00
Tim Pope
7195586b79 Remove debugging statement 2017-05-30 13:09:24 -04:00
Tim Pope
be770419fc Follow redirect when determining :Gbrowse url
This is a really contrived feature, but I want to make it possible for
people to have their cake and eat it too when it comes to custom
repository URLs that redirect to GitHub.
2017-05-29 22:44:00 -04:00
Tim Pope
0648abc018 Fix regexp checking Git version in :Gbrowse
References https://github.com/tpope/vim-fugitive/issues/844
2017-05-29 21:17:47 -04:00
Tim Pope
e272080f0d Don't trust CSApprox_loaded
Capitalized variables can end up in session files, folks.  Don't use
them for include guards.
2017-05-29 21:17:47 -04:00
Stephen Rasku
2c8d15a790 Add help for 'a' command in :Gstatus 2017-05-26 14:19:35 -04:00
Tim Pope
d6e7e20123 Work around Vim issue with hidden diff window
If you call :Gdiff on a file that's also open in a separate tab, close
it, switch to another file, and call :Gdiff again, Vim thinks the first
file is part of a 3-way diff, despite no longer being displayed in a
window.  Curiously, :diffoff! seems to work around this, despite both
the documentation and source code suggesting it merely iterates over
open windows.

Closes https://github.com/tpope/vim-fugitive/issues/534
2017-05-19 18:15:21 -04:00
kaihowl
1d2f150331 Unstage single files from git move and do not move them back
This fixes #824
2017-05-19 10:37:09 -04:00
gautaz
e5935c1165 Throw joined errors if error is empty on commit
Fixes tpope/vim-fugitive#907
2017-05-13 00:23:44 -04:00
Tim Pope
7ebe5c143d Handle .git in file system root
References https://github.com/tpope/vim-fugitive/issues/908
2017-05-08 11:03:29 -04:00
Tim Pope
c640ee78a8 This time I actually tried it 2017-05-02 19:34:47 -04:00
Tim Pope
c9b26e20d3 Fix substitute in jump to file 2017-05-02 19:32:31 -04:00
Tim Pope
79f4a49a94 Fix regexes in jump to file
Closes https://github.com/tpope/vim-fugitive/issues/906
2017-05-02 19:31:17 -04:00
Tim Pope
0cb46585ac Use same character class in all diff matches 2017-05-02 19:31:17 -04:00
Tim Pope
d4df8882c5 Better support for diff.mnemonicPrefix 2017-05-01 14:47:32 -04:00
Tim Pope
d5208d494f Force resolution of symlinked buffers
Closes https://github.com/tpope/vim-fugitive/issues/831
2017-05-01 14:47:32 -04:00
Chris DeLuca
cf248fa66d Fix readme links to Gbrowse plugins
Github changed the way they parse markdown, breaking a bunch of patterns.
2017-05-01 11:41:00 -04:00
Matěj Cepl
779949c255 Add a bit of documentation for d2o and d3o commands
Covering changes in #801.
2017-04-29 12:10:03 -04:00
Jack Nagel
785bb15745 Highlight blame hashes if 'termguicolors' is present 2017-04-27 21:27:20 -04:00
Tim Pope
fbf89773b4 Don't assume support for remote get-url
References https://github.com/tpope/vim-fugitive/issues/844
2017-04-26 13:06:15 -04:00
Geoff Harcourt
02a0be79aa Fix README typo
Recent update b2767d2 misspelled `instaweb`.
2017-04-24 21:09:32 -04:00
Tim Pope
b2767d204b Mention :Gbrowse providers in README
Closes https://github.com/tpope/vim-fugitive/issues/898
2017-04-24 16:07:42 -04:00
Tim Pope
26504eecbd Correctly eliminate trailing space in :Gpush
Note to self: don't test changes to :Gpush by pushing them.
2017-04-23 22:34:41 -04:00
Tim Pope
0d281a2607 Eliminate trailing space in :Gpush 2017-04-23 22:32:01 -04:00
Tim Pope
b2665cc650 Add g:fugitive_git_command
The idea is that g:fugitive_git_command is for user facing commands and
suitable to be changed to something like "hub", while
g:fugitive_git_executable is for low level internals.
2017-04-11 18:54:53 -04:00
Tim Pope
c3052fba84 Heavy handed rhubarb.vim suggestion 2017-04-11 17:59:32 -04:00
dummyunit
4f24757df2 Fix temp_files cache on Windows when TEMP is set to a short path (#893)
If %TEMP% is set to a short path (e.g. "C:\LongDi~1") then tempname()
will return a file name that contains that short path. If that path is
later used as key for entry in s:temp_files dictionary, that entry won't
be found in BufNewFile,BufReadPost events because <afile> is expand()'ed
before it is used as a key for s:temp_files.
In the end, user gets cryptic error message about
"C:\LongDirName\VI12345.tmp.fugitiveblame" not being a git repository
when he tries to open a commit in Gblame window.

To workaround that we expand paths of temp files when adding entries to
s:temp_files. Also, because expand() can't expand short path if it
doesn't exist in the file system, we have to extract the directory part
and expand it separately.
2017-04-05 14:58:03 -04:00
Tim Pope
eb945e9a11 :Gbrowse remote/branch should not resolve upstream
Old behavior: Follow remote/branch to local branch to upstream,
wherever that happens to live.

New behavior: Open branch at remote, without further resolution.
2017-04-03 17:18:20 -04:00
Tim Pope
90cbbf5854 Make unrecognized git type error more informative 2017-04-02 17:04:02 -04:00
Tim Pope
87c1bda4d5 Fix implicit use of v: variable 2017-02-25 17:05:12 -05:00
Tim Pope
c5c1bd66d8 Ensure v:shell_error comes from correct command
Closes https://github.com/tpope/vim-fugitive/issues/648
2017-02-25 16:38:19 -05:00
Jonathan Arnett
f44845e440 Fix for empty buffer :Git command in Neovim (#785)
Detects whether the current buffer is empty; opens a new empty tab if so, a new tab of the same buffer if not.
2017-02-10 12:35:36 -05:00
fREW Schmidt
245ce889e2 Support insteadOf for Gbrowse (#874)
Fixes #873
2017-02-07 18:49:17 -05:00
Nate Bosch
444ba9fda5 Stricter match for fugitive:// buffers (#872)
Fixes #871

It is valid - though odd - to open a file at `some//path`. In that case
the current check for fugitive buffers matches and changes &path
unexpectedly. A stricter match against `://` prevents this.
2017-02-03 11:04:54 -05:00
Tim Pope
b754bc2031 Fix mismatched quotes
References https://github.com/tpope/vim-fugitive/issues/844
2016-11-13 19:04:07 -05:00
Matěj Cepl
b3a8be6975 Add shortcuts for getting hunks from other views of the diff. (#801)
Fixes #798
2016-11-05 12:20:24 -04:00
Tommy Allen
58ed86e434 Use -z for splitting alias config. (#850) 2016-10-21 16:01:34 -04:00
tmsanrinsha
aac85a268e Fix U does not delete Untracked files (#823) 2016-08-08 15:18:18 -04:00
KabbAmine
c00ebd75ac Match printable character in git status
With `LANG=fr_FR.UTF-8`, a non-breakable space character is added to the
text of git status, this commit allows matching it.

Closes #815
2016-07-06 17:50:38 -04:00
Alex Rodionov
50cc268d29 Add --fixup= and --squash= to :Gcommit completion (#811) 2016-06-24 13:45:00 -04:00
canaaerus
4865891565 s:cfile: Match multi-byte characters #806 (#810)
For some locales like de_DE.UTF8 the text of `git status` contains multi-byte characters.
This change allows a subsequent file name to be matched correctly .
2016-06-22 15:46:54 -04:00
Daniel Hahler
3439f999b1 Call s:define_commands directly (#792)
This removes the fugitive_utility augroup, and allows for something like
the following:

> vim --cmd 'au User Fugitive Gbrowse!' path/to/file

Without this patch the user's User autocommand would be run before
fugitive's, and therefore the commands would not be defined already.
2016-05-11 18:01:39 -04:00
Daniel Hahler
6460734b5e Fix typo in s:repo_translate: s/,/./ (#791) 2016-05-11 17:37:45 -04:00
Quinn Strahl
bdd216827a Make :Git open a tab to the left for :terminal
- Users of multiple tabs will find themselves back where they started
  when the terminal closes, instead of in the next tab over
2016-04-14 19:08:11 -04:00
Quinn Strahl
0ac4915cd7 Simplify tabedit invocation for :Gcommit -v
- `-tabedit` does the same thing as `(tabpagenr()-1).'tabedit'`
2016-04-14 19:08:11 -04:00
Ari Pollak
841adb49ad Use "+ instead of "* 2016-04-06 19:51:16 -04:00
Andy Stewart
57afba5bdd Trigger BufWritePost after adding to index with Gwrite
See airblade/vim-gitgutter#278.
2016-03-24 18:54:08 -04:00
Tim Pope
e1ae9effbc Document bang to :Ggrep
Closes https://github.com/tpope/vim-fugitive/issues/767
2016-03-18 11:26:11 -04:00
Tim Pope
19d1c944db Remove unmerged files on :Gstatus U 2016-03-09 21:31:25 -05:00
Tyler Hallada
9315ec694d Document StageUndo key map (U) in :Gstatus 2016-03-09 21:28:26 -05:00
Tim Pope
90250785d1 Call git clean for U on untracked file 2016-03-09 21:26:09 -05:00
Vadim Zeitlin
099d65826e Don't use spaces in Git command to avoid problems under Windows
When using a helper script to make Windows Vim work with Cygwin Git, arguments
containing spaces don't survive being passed through "cmd /c" to this script
and are decomposed into several tokens.

Just use "%x20" instead of spaces in the pretty format to avoid the problem.
2016-03-05 16:14:18 -05:00
Tim Pope
008b957086 Ignore worktree with broken gitdir
References https://github.com/tpope/vim-fugitive/issues/751
2016-02-24 19:29:27 -05:00
Tim Pope
16c2b7abb9 Support worktrees
Closes https://github.com/tpope/vim-fugitive/issues/655
2016-02-24 16:20:52 -05:00
Tim Pope
1e3f1103d9 DRY up refs/ paths 2016-02-24 15:53:51 -05:00
Tim Pope
9835920a3c Use includeexpr on default <cfile>
Closes https://github.com/tpope/vim-fugitive/issues/744
2016-01-22 20:03:58 -05:00
Tim Pope
fd36aa9c61 Fix issue extracting remote 2016-01-08 17:05:54 -05:00
Tim Pope
4dd41688cf Entertain P as a p alternative in :Gstatus
This could potentially free up `p` as "open in new tab", which would
correspond nicely with `vim -p`.
2016-01-01 16:55:17 -05:00
Tim Pope
18d6d1ab82 Overhaul :Gbrowse remote handling 2015-12-26 19:53:07 -05:00
Tim Pope
9ce67cdc93 Always pass commit SHA to :Gbrowse handlers 2015-12-26 15:09:08 -05:00
Tim Pope
bf04261080 Revert "Remove guard against index stage in :Gbrowse handler"
This reverts commit 14daf094d9.  My
assertion was wrong; commit will no longer be an index stage but it
still might be an empty string.
2015-12-26 14:54:35 -05:00
Tim Pope
52d180af0a Include trailing / in tree paths for :Gbrowse handlers 2015-12-26 14:37:45 -05:00
Tim Pope
14daf094d9 Remove guard against index stage in :Gbrowse handler
This parameter can now always be directly used within a URL, without any
sanity checking
2015-12-26 14:36:39 -05:00
Tim Pope
ac904e806d Don't pass stage number as commit to :Gbrowse handler 2015-12-26 14:18:00 -05:00
Tim Pope
9f768cd3bc Minimum viable URL escaping in :Gbrowse
Closes https://github.com/tpope/vim-fugitive/issues/703.
2015-12-26 14:11:54 -05:00
Tim Pope
09cdce7add Fix jump to file for tree at root of commit
Closes https://github.com/tpope/vim-fugitive/issues/735
2015-12-23 21:27:43 -05:00
Tim Pope
8851b8fe64 Fix jump from diff to file
This code hasn't been touched in 4 years; how did it break?!
2015-12-15 21:19:33 -05:00
Tim Pope
cfa485ede7 Better support for binary file grep results 2015-12-15 19:01:40 -05:00
Tim Pope
207c643ea4 Bring GitHub handler in line with rhubarb.vim
Closes https://github.com/tpope/vim-fugitive/issues/730
2015-12-11 16:38:05 -05:00
Tim Pope
cac2c8ef8e Fix instaweb current buffer assumption 2015-12-01 18:41:29 -05:00
Tim Pope
a9a22e0e4e Never :Gedit with a trailing slash 2015-12-01 18:35:25 -05:00
Tim Pope
c3e918072f Accommodate @ as alias for HEAD 2015-12-01 18:06:38 -05:00
Tim Pope
d854197c03 Open release page for tags on GitHub 2015-12-01 04:04:55 -05:00
Tim Pope
d8ce8d1d03 Document transition to rhubarb.vim 2015-11-30 22:25:50 -05:00
Tim Pope
23faeadc7c Revert "Show all untracked files in :Gstatus window"
This reverts commit 21b6dd7aee.

Closes https://github.com/tpope/vim-fugitive/issues/726
2015-11-30 19:38:48 -05:00
Andy Russell
1ecd12d523 Add support for fish shell syntax
Closes #626.
2015-11-06 15:54:34 -05:00
Jerome Reybert
f8aa87a4b5 Fix when $GIT_DIR is set and is not an absolute path 2015-11-03 09:52:22 -05:00
Jacob Niehus
dba8a0705d Fix diff sometimes opening in preview window
If the previous window no longer exists when Gedit is called, the
attempt to change windows with 'wincmd p' fails and 'wincmd w' should be
used instead.
2015-10-16 23:48:38 -04:00
Tim Pope
8cf3d94a3a Support gf in git filetypes
Closes https://github.com/tpope/vim-fugitive/issues/697
2015-10-07 00:21:49 -04:00
Tim Pope
28de2a1ddd Enable jumping on @@ hunk header 2015-10-07 00:21:49 -04:00
Tim Pope
01cda4d443 :Gdiff! keeps window focus 2015-10-07 00:21:35 -04:00
Tim Pope
b5188a1b4f Accept +cmd with :Gdiff 2015-10-07 00:05:07 -04:00
Tim Pope
8e63140181 Resplit when :Gstatus is final window 2015-10-07 00:05:07 -04:00
Tim Pope
cec56ef5ff Extract current file logic from s:GF 2015-10-06 21:45:40 -04:00
Tim Pope
1e755064e9 Better error on :Gwrite failure
References https://github.com/tpope/vim-fugitive/issues/696
2015-10-06 20:33:41 -04:00
Daniel Hahler
0b43b51d77 Expand % instead of <amatch> in the Buf* autocommands
This is relevant in case a previous BufReadPost autocmd changes the file
name using `:file` - fugitive should use the new/current name then.
2015-10-02 19:40:37 -04:00
Daniel Hahler
5dcf8a0175 ReplaceCmd: redirect stderr to tmp file / buffer
The option `status.showUntrackedFiles=all` used with `git status` for
`:Gstatus` might cause an error, which then causes fugitive to display an
empty status window / index file.

Redirecting the stderr output is useful in this case.

The generated command was:

    git --git-dir=/home/user/.dotfiles/.git -c 'status.displayCommentPrefix=true' -c 'color.status=false' -c 'status.short=false' -c 'status.showUntrackedFiles=all' status

The error from git is related to submodules being moved to another
subdirectory, where the relative "gitdir" now does not exist anymore:

    fatal: Not a git repository: vim/bundle.old.nobackup/CLEAN/colorscheme-base16/../../../.git/modules/vim/bundle/colorscheme-base16

While that's a Git / user error after all, fugitive should be more
helpful in that case by displaying the error.

It uses the 'shellpipe' setting to detect if '2>&1' is supported (Ref:
https://github.com/tpope/vim-fugitive/pull/661#issuecomment-120438667).

Closes #661.
2015-10-02 19:39:07 -04:00
Daniel Hahler
2509641eac Add "stash" and stash refs in repo.superglob
This looks for `refs/stash` and calls `git stash list` to get all of
them in case it exists.
2015-10-02 19:27:35 -04:00
Tim Pope
073f3a37b9 Short circuit when jumping too far in blame history
References https://github.com/tpope/vim-fugitive/issues/607
2015-09-30 18:49:56 -04:00
David Elentok
b7b23001de Allow using the "%" variable in git commands
Closes https://github.com/tpope/vim-fugitive/issues/686

For example, when running:

  :Git add %

neovim throws the following exception:

  E499: Empty file name for '%' or '#',
  only works with ":p:h": terminal git add %

It is a result of the tabnew command, it creates a new blank tab where
"%" is empty.

This commit changes "tabnew" to "tabedit %" so you're still working on
the same file.

Once the command is done running the tab closes.
2015-09-10 15:32:35 -04:00
Patrick Davey
b319b69453 Add the "L" prefix which github requires for highlighting ranges now
Fixes https://github.com/tpope/vim-fugitive/issues/669
2015-08-02 15:26:14 -04:00
Pieter-Jan Van de Maele
03cc95cc19 Support for Ggrep when only %f is available 2015-07-20 15:06:06 -04:00
Tim Pope
7c4a906147 Support Vim without 'wildignorecase'
Closes #659.
2015-07-01 10:55:35 -04:00
Tim Pope
b5b2548a87 Support older Vim without 'fileignorecase' 2015-06-30 20:39:54 -04:00
Tim Pope
ca727b07f1 Better support for case insensitive file systems
Closes #451.
2015-06-30 17:43:16 -04:00
Tim Pope
0fbbe0b3a4 Open :Gcommit tab before current
Pretty ridiculous, but this seems to be the only way to return to the
right tab after closing the commit message.
2015-06-29 17:52:39 -04:00
Tim Pope
1c844375fa Add support for flagship.vim 2015-06-14 20:06:38 -04:00
Daniel Hahler
e065e4f841 (Re)store the current window in s:diffoff_all
This is required to make Vim execute the "Enter" autocommands when
closing the fugitive window.

Fixes: https://github.com/tpope/vim-fugitive/issues/421
2015-05-31 12:14:23 -04:00
Eli Young
21b6dd7aee Show all untracked files in :Gstatus window
Previously, if there were untracked files inside an untracked folder,
:Gstatus would only show the new folder. Attempting to run a diff on the
folder would pass the directory name, which would result in Vim opening
a directory listing. This makes :Gstatus list all untracked files, even
if they're inside untracked folders. This requires Git >=1.4, and will
silently fall back to the old behavior on earlier versions.

Closes #605.
2015-05-22 17:50:42 -04:00
Tim Pope
935a2cccd3 Don't close window after :Gremove
This is nothing more than a change in personal preference on my part.
It's particularly annoying when :Gstatus or the quickfix window is the
only other window open.
2015-05-19 12:27:22 -04:00
Tim Pope
c2908b174d Support older Git in :Gpull
Closes #645.
2015-05-19 11:15:30 -04:00
Diego Vera
b0e38f08dc Make Ggrep to work properly on Mac
- Color were causing to appear strange characters in the result.
- These characters made impossible to navigate the results
- The solution was to disable colors while executing git grep
2015-05-16 10:12:41 -04:00
Ole Reifschneider
4cc201cbe3 Use the neovim terminal emulator for :Git 2015-03-31 13:40:01 -04:00
Tim Pope
baa05dcfda Pass correct files to git reset --patch 2015-03-29 16:29:18 -04:00
Fedor Gusev
0095769029 Provide g:fugitive_no_maps to disable key maps
Add variable g:fugitive_no_maps. If set y<C-G> and <C-R><C-G> are not
mapped.

Resolves tpope/vim-fugitive#394
2015-02-20 15:50:02 -05:00
Eli Young
e8b94098bb Support browsing with new netrw.vim
The previous fix for #594 didn't handle the case in which the net netrw
was installed on older versions of Vim.
2015-02-20 15:49:36 -05:00
Tim Pope
eb8eb1850a Support for browsing with recent Vim
Closes #594.
2015-02-08 22:31:37 -05:00
Daniel Hahler
933f6a1e1d s:Diff: use winnr with <C-W>w instead of <C-W>p
This is more reliable and fixes an issue where the syntastic location
list of the original file would be focused after `:Gdiff`.

Ref: c99f0ff06b (commitcomment-9434351)
2015-01-25 19:23:45 -05:00
Tim Pope
34719016ec fugitive.vim 2.2
* Provide :Gpush, :Gfetch, :Gmerge, and Gpull.
* Use -L to handle :Glog range.
* :Gcommit -v opens message in new tab.
* API for custom :Gbrowse handlers.
* Invoke :Browse if available to open URL.
* Colorize hashes in :Gblame buffer.
* Set cursorbind and nobuflisted in :Gblame buffers.
* :Gblame in blame buffer toggles buffer.
2015-01-20 01:37:22 -05:00
Daniel Hahler
2c8461db08 Use <nomodeline> with Fugitive autocmds, and un-silent them
Closes #580.
2014-11-21 03:25:20 -05:00
John Whitley
d3b98d9886 Make configured_tree a caching global function
This implements the changes suggested in tpope/fugitive#415.
s:repo_configured_tree is now a global, s:configured_tree() that caches
the bidirectional relation between the worktree and the git_dir.
extract_git_dir() now uses that relation to check whether the
directories it scans are valid worktrees known by the repo at $GIT_DIR.
2014-11-06 13:49:30 -05:00
Tim Pope
5699f4613c Fix instaweb support
Closes #571.
2014-11-06 13:47:26 -05:00
Tim Pope
0374322ba5 Fix :Glog
Closes #545.
2014-09-02 12:05:34 -04:00
Tim Pope
90ee6fb5d2 Pass line1 and line2 as 0 for :Gbrowse without range
Closes #530.
2014-07-27 12:14:42 -04:00
Tim Pope
04fe4bfcd9 Set nobuflisted in blame buffers 2014-07-23 17:55:15 -04:00
Tom McDonald
7423d72b51 Ensure clipboard support before using * register
Closes #526.
2014-07-23 17:46:47 -04:00
Tim Pope
24d4098ceb Change arity of browse API
It's debatable whether the repo object should be passed at all, so let's
not commit to a positional parameter for it.

References #445.
2014-07-22 20:48:40 -04:00
Tim Pope
5aaa65736d Browse handler API
Taking experimental out of the name, but small tweaks may occur before
then next release.

For future compatibility, any third party handlers should bail and
return an empty string if any of the following are true:

* More than 2 arguments are given.
* The second argument isn't a dictionary.
* The dictionary doesn't contain a "remote" key.

Closes #445.
2014-07-22 00:18:24 -04:00
Tim Pope
5d1c219ee5 Fix load order issue 2014-07-17 21:05:03 -04:00
Tim Pope
a739112bfc Experimentally expose browse API
References #445.
2014-07-17 20:16:28 -04:00
Tim Pope
d376506177 Try including helptags instructions in README 2014-07-17 19:57:09 -04:00
Tim Pope
9af975c82c Don't run pre-commit hook on merge 2014-07-07 21:23:22 -04:00
Tim Pope
11f89ba749 Only change 'tags' if tags file exists
Closes #402.  References #426.
2014-07-06 00:20:19 -04:00
Tim Pope
45e5317200 Try harder to avoid -esp on :Gcommit follow-up
Closes #516.
2014-07-05 19:01:00 -04:00
Tim Pope
ee2b0ecdb8 Provide :Gpush and :Gfetch
Closes #450.
2014-06-30 14:30:44 -04:00
Tim Pope
94a5d6fe2f Fix :Gcommit when closing message lands in different project 2014-06-30 14:02:53 -04:00
Tim Pope
0cd33c6170 :Gcommit -v opens message in new tab
Closes #513.  References #480.
2014-06-29 14:52:43 -04:00
Tim Pope
6239f5ed8e Ignore ^[[K lines from progress output 2014-06-29 14:46:16 -04:00
Tim Pope
188692556a Fix subcommand complete when cursor mid-line 2014-06-29 11:02:47 -04:00
Tim Pope
716f3d2d4e Expose list of global git subcommands 2014-06-29 10:54:57 -04:00
Tim Pope
8576741d61 Don't quote url argument to :Browse 2014-06-26 17:08:59 -04:00
Tim Pope
32957cb552 Invoke :Browse if available to open URL
Example that invokes open(1) on OS X:

    command! -bar -nargs=1 Browse silent! !open <args>

Closes #509.
2014-06-26 17:07:07 -04:00
Tim Pope
fdc8569c18 :Gblame in blame buffer deletes buffer
Closes #511.
2014-06-26 14:40:09 -04:00
Tim Pope
7fb703534a :Gmerge and :Gpull 2014-06-25 13:05:14 -04:00
Tim Pope
41cdbdcd62 Force :Gstatus U to root of tree
References #97.
2014-06-25 10:29:17 -04:00
Tim Pope
91900baad1 Set cursorbind in :Gblame 2014-06-24 23:10:57 -04:00
Tim Pope
fb5661211d Colorize hashes in blame
References #369.
2014-06-24 21:54:25 -04:00
Tim Pope
276f89837f Use -L to handle :Glog range
Closes #507.  References #286.
2014-06-24 19:36:47 -04:00
Tim Pope
4581cd4217 Support -L in :Glog errorformat
References #507.
2014-06-24 19:36:47 -04:00
11 changed files with 9957 additions and 2903 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
.git* export-ignore
*.markdown export-ignore

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
github: tpope
custom: ["https://www.paypal.me/vimpope"]

View File

@@ -8,8 +8,14 @@ platform issues, and interactions with other plugins. I end up bisecting a
lot more than other projects, and thus I'm especially meticulous here about
maintaining a clean, readable, history. Squash and force push any requested
changes to a pull request. And if your [commit message
sucks](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
I'm not going to accept it. Period.
sucks](https://commit.style), I'm not going to accept it. Period.
If your contribution involves adding a configuration option, you are going to
need a very compelling justification for it. Options add a maintenance
burden, support burden, and documentation bloat, and oftentimes can be
achieved much more simply with a custom map or autocommand. If your option
controls an underlying Git command, ask yourself why Git itself does not offer
such configuration.
Beyond that, don't be shy about asking before patching. What takes you hours
might take me minutes simply because I have both domain knowledge and a

View File

@@ -1,49 +1,80 @@
# fugitive.vim
I'm not going to lie to you; fugitive.vim may very well be the best
Git wrapper of all time. Check out these features:
Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git
plugin for Vim? Either way, it's "so awesome, it should be illegal". That's
why it's called Fugitive.
View any blob, tree, commit, or tag in the repository with `:Gedit` (and
`:Gsplit`, `:Gvsplit`, `:Gtabedit`, ...). Edit a file in the index and
write to it to stage the changes. Use `:Gdiff` to bring up the staged
version of the file side by side with the working tree version and use
Vim's diff handling capabilities to stage a subset of the file's
changes.
The crown jewel of Fugitive is `:Git` (or just `:G`), which calls any
arbitrary Git command. If you know how to use Git at the command line, you
know how to use `:Git`. It's vaguely akin to `:!git` but with numerous
improvements:
Bring up the output of `git status` with `:Gstatus`. Press `-` to
`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch`. And guess
what `:Gcommit` does!
* The default behavior is to directly echo the command's output. Quiet
commands like `:Git add` avoid the dreaded "Press ENTER or type command to
continue" prompt.
* `:Git commit`, `:Git rebase -i`, and other commands that invoke an editor do
their editing in the current Vim instance.
* `:Git diff`, `:Git log`, and other verbose, paginated commands have their
output loaded into a temporary buffer. Force this behavior for any command
with `:Git --paginate` or `:Git -p`.
* `:Git blame` uses a temporary buffer with maps for additional triage. Press
enter on a line to view the commit where the line changed, or `g?` to see
other available maps. Omit the filename argument and the currently edited
file will be blamed in a vertical, scroll-bound split.
* `:Git mergetool` and `:Git difftool` load their changesets into the quickfix
list.
* Called with no arguments, `:Git` opens a summary window with dirty files and
unpushed and unpulled commits. Press `g?` to bring up a list of maps for
numerous operations including diffing, staging, committing, rebasing, and
stashing. (This is the successor to the old `:Gstatus`.)
* This command (along with all other commands) always uses the current
buffer's repository, so you don't need to worry about the current working
directory.
`:Gblame` brings up an interactive vertical split with `git blame`
output. Press enter on a line to edit the commit where the line
changed, or `o` to open it in a split. When you're done, use `:Gedit`
in the historic buffer to go back to the work tree version.
Additional commands are provided for higher level operations:
`:Gmove` does a `git mv` on a file and simultaneously renames the
buffer. `:Gremove` does a `git rm` on a file and simultaneously deletes
the buffer.
* View any blob, tree, commit, or tag in the repository with `:Gedit` (and
`:Gsplit`, etc.). For example, `:Gedit HEAD~3:%` loads the current file as
it existed 3 commits ago.
* `:Gdiffsplit` (or `:Gvdiffsplit`) brings up the staged version of the file
side by side with the working tree version. Use Vim's diff handling
capabilities to apply changes to the staged version, and write that buffer
to stage the changes. You can also give an arbitrary `:Gedit` argument to
diff against older versions of the file.
* `:Gread` is a variant of `git checkout -- filename` that operates on the
buffer rather than the file itself. This means you can use `u` to undo it
and you never get any warnings about the file changing outside Vim.
* `:Gwrite` writes to both the work tree and index versions of a file, making
it like `git add` when called from a work tree file and like `git checkout`
when called from the index or a blob in history.
* `:Ggrep` is `:grep` for `git grep`. `:Glgrep` is `:lgrep` for the same.
* `:GMove` does a `git mv` on the current file and changes the buffer name to
match. `:GRename` does the same with a destination filename relative to the
current file's directory.
* `:GDelete` does a `git rm` on the current file and simultaneously deletes
the buffer. `:GRemove` does the same but leaves the (now empty) buffer
open.
* `:GBrowse` to open the current file on the web front-end of your favorite
hosting provider, with optional line range (try it in visual mode). Plugins
are available for popular providers such as [GitHub][rhubarb.vim],
[GitLab][fugitive-gitlab.vim], [Bitbucket][fubitive.vim],
[Gitee][fugitive-gitee.vim], [Pagure][pagure],
[Phabricator][vim-phabricator], [Azure DevOps][fugitive-azure-devops.vim],
and [sourcehut][srht.vim].
Use `:Ggrep` to search the work tree (or any arbitrary commit) with
`git grep`, skipping over that which is not tracked in the repository.
`:Glog` loads all previous revisions of a file into the quickfix list so
you can iterate over them and watch the file evolve!
[rhubarb.vim]: https://github.com/tpope/vim-rhubarb
[fugitive-gitlab.vim]: https://github.com/shumphrey/fugitive-gitlab.vim
[fubitive.vim]: https://github.com/tommcdo/vim-fubitive
[fugitive-gitee.vim]: https://github.com/linuxsuren/fugitive-gitee.vim
[pagure]: https://github.com/FrostyX/vim-fugitive-pagure
[vim-phabricator]: https://github.com/jparise/vim-phabricator
[fugitive-azure-devops.vim]: https://github.com/cedarbaum/fugitive-azure-devops.vim
[srht.vim]: https://git.sr.ht/~willdurand/srht.vim
`:Gread` is a variant of `git checkout -- filename` that operates on the
buffer rather than the filename. This means you can use `u` to undo it
and you never get any warnings about the file changing outside Vim.
`:Gwrite` writes to both the work tree and index versions of a file,
making it like `git add` when called from a work tree file and like
`git checkout` when called from the index or a blob in history.
Add `%{FugitiveStatusline()}` to `'statusline'` to get an indicator
with the current branch in your statusline.
Use `:Gbrowse` to open the current file on GitHub, with optional line
range (try it in visual mode!). If your current repository isn't on
GitHub, `git instaweb` will be spun up instead.
Add `%{fugitive#statusline()}` to `'statusline'` to get an indicator
with the current branch in (surprise!) your statusline.
Last but not least, there's `:Git` for running any arbitrary command,
and `Git!` to open the output of a command in a temp file.
For more information, see `:help fugitive`.
## Screencasts
@@ -55,55 +86,41 @@ and `Git!` to open the output of a command in a temp file.
## Installation
If you don't have a preferred installation method, I recommend
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
then simply copy and paste:
Install using your favorite package manager, or use Vim's built-in package
support:
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-fugitive.git
Once help tags have been generated, you can view the manual with
`:help fugitive`.
If your Vim version is below 7.2, I recommend also installing
[vim-git](https://github.com/tpope/vim-git) for syntax highlighting and
other Git niceties.
mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/fugitive.git
vim -u NONE -c "helptags fugitive/doc" -c q
## FAQ
> I installed the plugin and started Vim. Why don't any of the commands
> exist?
> What happened to the dispatch.vim backed asynchronous `:Gpush` and
> `:Gfetch`?
Fugitive cares about the current file, not the current working
directory. Edit a file from the repository.
This behavior was divisive, confusing, and complicated inputting passwords, so
it was removed. Use `:Git! push` to use Fugitive's own asynchronous
execution, or retroactively make `:Git push` asynchronous by pressing
`CTRL-D`.
> I opened a new tab. Why don't any of the commands exist?
> Why am I getting `core.worktree is required when using an external Git dir`?
Fugitive cares about the current file, not the current working
directory. Edit a file from the repository.
Git generally sets `core.worktree` for you automatically when necessary, but
if you're doing something weird, or using a third-party tool that does
something weird, you may need to set it manually:
> Why is `:Gbrowse` not using the right browser?
git config core.worktree "$PWD"
`:Gbrowse` delegates to `git web--browse`, which is less than perfect
when it comes to finding the right browser. You can tell it the correct
browser to use with `git config --global web.browser ...`. On OS X, for
example, you might want to set this to `open`. See `git web--browse --help`
for details.
This may be necessary even when simple `git` commands seem to work fine
without it.
> Here's a patch that automatically opens the quickfix window after
> `:Ggrep`.
> So I have a symlink and...
This is a great example of why I recommend asking before patching.
There are valid arguments to be made both for and against automatically
opening the quickfix window. Whenever I have to make an arbitrary
decision like this, I ask what Vim would do. And Vim does not open a
quickfix window after `:grep`.
Luckily, it's easy to implement the desired behavior without changing
fugitive.vim. The following autocommand will cause the quickfix window
to open after any grep invocation:
autocmd QuickFixCmdPost *grep* cwindow
Stop. Just stop. If Git won't deal with your symlink, then Fugitive won't
either. Consider using a [plugin that resolves
symlinks](https://github.com/aymericbeaumet/symlink.vim), or even better,
using fewer symlinks.
## Self-Promotion

8445
autoload/fugitive.vim Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -15,115 +15,169 @@ COMMANDS *fugitive-commands*
These commands are local to the buffers in which they work (generally, buffers
that are part of Git repositories).
*fugitive-:Git*
:Git [args] Run an arbitrary git command. Similar to :!git [args]
but chdir to the repository tree first.
*fugitive-:G*
:G [args] Same as :Git, but two characters shorter.
*fugitive-:Git!*
:Git! [args] Like |:Git|, but capture the output into a temp file,
and edit that temp file.
*fugitive-summary*
:Git With no arguments, bring up a summary window vaguely
akin to git-status. If a summary window is already
open for the current repository, it is focused
instead. Press g? or see |fugitive-maps| for usage.
*fugitive-:Gcd*
:Gcd [directory] |:cd| relative to the repository.
*:Git*
:Git {args} Run an arbitrary git command and display any output.
On UNIX this uses a pty and on other platforms it uses
a pipe, which will cause some behavior differences
such as the absence of progress bars. Any file the
command edits (for example, a commit message) will be
loaded into a split window. Closing that window will
resume running the command. A few Git subcommands
have different behavior; these are documented below.
*fugitive-:Glcd*
:Glcd [directory] |:lcd| relative to the repository.
*:Git!*
:Git! {args} Run an arbitrary git command in the background and
stream the output to the preview window. Requires a
Vim with |setbufline()|. Press CTRL-D during an
interactive :Git invocation to switch to this mode
retroactively.
*fugitive-:Gstatus*
:Gstatus Bring up the output of git-status in the preview
window. The following maps, which work on the cursor
line file where sensible, are provided:
*:Git_--paginate* *:Git_-p*
:Git --paginate {args} Run an arbitrary git command, capture output to a temp
:Git -p {args} file, and |:split| that temp file. Pass ++curwin as
the first argument to |:edit| the temp file instead.
A temp file is always used for commands like diff and
log that typically uses a pager, and for any command
that has the pager.<cmd> Git configuration option set.
:{range}Git! --paginate {args}
:{range}Git! -p {args} Run an arbitrary git command, and insert the output
after {range} in the current buffer.
*:Git_blame*
:Git blame [flags] Run git-blame [flags] on the current file and open the
results in a scroll-bound vertical split. The
following maps, which work on the cursor line commit
where sensible, are provided:
g? show this help
<C-N> next file
<C-P> previous file
<CR> |:Gedit|
- |:Git| add
- |:Git| reset (staged files)
cA |:Gcommit| --amend --reuse-message=HEAD
ca |:Gcommit| --amend
cc |:Gcommit|
cva |:Gcommit| --amend --verbose
cvc |:Gcommit| --verbose
D |:Gdiff|
ds |:Gsdiff|
dp |:Git!| diff (p for patch; use :Gw to apply)
dp |:Git| add --intent-to-add (untracked files)
dv |:Gvdiff|
O |:Gtabedit|
o |:Gsplit|
p |:Git| add --patch
p |:Git| reset --patch (staged files)
q close status
r reload status
S |:Gvsplit|
A resize to end of author column
C resize to end of commit column
D resize to end of date/time column
gq close blame, then |:Gedit| to return to work
tree version
<CR> close blame, and jump to patch that added line
(or directly to blob for boundary commit)
o jump to patch or blob in horizontal split
O jump to patch or blob in new tab
p jump to patch or blob in preview window
- reblame at commit
*fugitive-:Gcommit*
:Gcommit [args] A wrapper around git-commit. If there is nothing
to commit, |:Gstatus| is called instead. Unless the
arguments given would skip the invocation of an editor
(e.g., -m), a split window will be used to obtain a
commit message. Write and close that window (:wq or
|:Gwrite|) to finish the commit. Unlike when running
the actual git-commit command, it is possible (but
unadvisable) to muck with the index with commands like
git-add and git-reset while a commit message is
pending.
The maps |fugitive_P| and |fugitive_~| are also
supported to reblame on a parent commit, but this is
inherently fragile, as the line being blamed will no
longer exist. The preferred alternative is to use
<CR> to open up the commit, select the corresponding
`-` line that you care about, and press <CR> twice
more to reblame at that line. Viewing the commit also
gives you additional context as to why the line
changed.
*fugitive-:Ggrep*
:Ggrep [args] |:grep| with git-grep as 'grepprg'.
*g:fugitive_dynamic_colors*
In the GUI or a 256 color terminal, commit hashes will
be highlighted in different colors. To disable this:
>
let g:fugitive_dynamic_colors = 0
<
:[range]Git blame [...] If a range is given, just that part of the file will
:Git blame [...] {file} be blamed, and a horizontal split without
scrollbinding is used. You can also give an arbitrary
filename.
*fugitive-:Glgrep*
:Glgrep [args] |:lgrep| with git-grep as 'grepprg'.
*:Git_difftool*
:Git[!] difftool [args] Invoke `git diff [args]` and load the changes into the
quickfix list. Each changed hunk gets a separate
quickfix entry unless you pass an option like
--name-only or --name-status. Jumps to the first
change unless [!] is given.
*fugitive-:Glog*
:Glog [args] Load all previous revisions of the current file into
the quickfix list. Additional git-log arguments can
be given (for example, --reverse). If "--" appears as
an argument, no file specific filtering is done, and
previous commits rather than previous file revisions
are loaded.
:Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a
new tab, and invoke |:Gdiffsplit!| against the
appropriate commit.
*fugitive-:Gllog*
:Gllog [args] Like |:Glog|, but use the location list instead of the
quickfix list.
*:Git_mergetool*
:Git mergetool [args] Like |:Git_difftool|, but target merge conflicts.
*fugitive-:Gedit* *fugitive-:Ge*
:Gedit [revision] |:edit| a |fugitive-revision|.
Wrappers for Vim built-ins ~
*fugitive-:Gsplit*
:Gsplit [revision] |:split| a |fugitive-revision|.
These all directly map onto a built-in Vim command, and generally have names
that prepend "G" to the command they are wrapping. For example, :Ggrep is G
plus |:grep|.
*fugitive-:Gvsplit*
:Gvsplit [revision] |:vsplit| a |fugitive-revision|.
*:Ggrep* *:Git_grep*
:Ggrep[!] [args] An approximation of |:grep|[!] with git-grep as
:Git[!] grep -O [args] 'grepprg'.
*fugitive-:Gtabedit*
:Gtabedit [revision] |:tabedit| a |fugitive-revision|.
:Ggrep[!] --quiet [args]
:Ggrep[!] -q [args] Like |:Ggrep|, but instead of displaying output, open
the quickfix list.
*fugitive-:Gpedit*
:Gpedit [revision] |:pedit| a |fugitive-revision|.
*:Glgrep*
:Glgrep[!] [args] :Ggrep but for |:lgrep|.
:0Git[!] grep -O [args]
:Gsplit! [args] *fugitive-:Gsplit!* *fugitive-:Gvsplit!*
:Gvsplit! [args] *fugitive-:Gtabedit!* *fugitive-:Gpedit!*
:Gtabedit! [args] Like |:Git!|, but open the resulting temp file in a
:Gpedit! [args] split, tab, or preview window.
*:Gclog*
:Gclog[!] [args] Use git-log [args] to load the commit history into the
|quickfix| list. Jumps to the first commit unless [!]
is given. This command wraps |:cfile|.
*fugitive-:Gread*
:Gread [revision] Empty the buffer and |:read| a |fugitive-revision|.
The quickfix list can be awkward for many use cases
and exhibits extremely poor performance with larger
data sets. Consider using |:Git| log --oneline
instead.
:{range}Gclog[!] [args] Use git-log -L to load previous revisions of the given
range of the current file into the |quickfix| list.
The cursor is positioned on the first line of the
first diff hunk for each commit. Use :0Gclog to
target the entire file.
*:Gllog*
:Gllog [args] Like |:Gclog|, but use the location list instead of the
|quickfix| list.
*:Gcd*
:Gcd [directory] |:cd| relative to the repository.
*:Glcd*
:Glcd [directory] |:lcd| relative to the repository.
*:Gedit* *fugitive-:Ge*
:Gedit [object] |:edit| a |fugitive-object|.
*:Gsplit*
:Gsplit [object] |:split| a |fugitive-object|.
*:Gvsplit*
:Gvsplit [object] |:vsplit| a |fugitive-object|.
*:Gtabedit*
:Gtabedit [object] |:tabedit| a |fugitive-object|.
*:Gpedit*
:Gpedit [object] |:pedit| a |fugitive-object|.
*:Gdrop*
:Gdrop [object] |:drop| a |fugitive-object|.
*:Gread* *fugitive-:Gr*
:Gread [object] Empty the buffer and |:read| a |fugitive-object|.
When the argument is omitted, this is similar to
git-checkout on a work tree file or git-add on a stage
file, but without writing anything to disk.
:{range}Gread [revision]
|:read| in a |fugitive-revision| after {range}.
:{range}Gread [object] |:read| in a |fugitive-object| after {range}.
*fugitive-:Gread!*
:Gread! [args] Empty the buffer and |:read| the output of a Git
command. For example, :Gread! show HEAD:%.
:{range}Gread! [args] |:read| the output of a Git command after {range}.
*fugitive-:Gw* *fugitive-:Gwrite*
*:Gwrite* *fugitive-:Gw*
:Gwrite Write to the current file's path and stage the results.
When run in a work tree file, it is effectively git
add. Elsewhere, it is effectively git-checkout. A
@@ -133,188 +187,561 @@ that are part of Git repositories).
:Gwrite {path} You can give |:Gwrite| an explicit path of where in
the work tree to write. You can also give a path like
:0:foo.txt or even :0 to write to just that stage in
:0:foo.txt or :0:% to write to just that stage in
the index.
*fugitive-:Gwq*
*:Gwq*
:Gwq [path] Like |:Gwrite| followed by |:quit| if the write
succeeded.
:Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write
succeeded.
*fugitive-:Gdiff*
:Gdiff [revision] Perform a |vimdiff| against the current file in the
given revision. With no argument, the version in the
index is used (which means a three-way diff during a
merge conflict, making it a git-mergetool
alternative). The newer of the two files is placed
to the right or bottom, depending on 'diffopt' and
the width of the window relative to 'textwidth'. Use
|do| and |dp| and write to the index file to simulate
"git add --patch".
*:Gdiffsplit*
:Gdiffsplit [object] Perform a |vimdiff| against the given file, or if a
commit is given, the current file in that commit.
With no argument, the version in the index or work
tree is used, and the work tree version is always
placed to the right or bottom, depending on available
width. Use Vim's |do| and |dp| to stage and unstage
changes.
*fugitive-:Gsdiff*
:Gsdiff [revision] Like |:Gdiff|, but always split horizontally.
*:Gdiffsplit!*
:Gdiffsplit! Diff against any and all direct ancestors, retaining
focus on the current window. During a merge conflict,
this is a three-way diff against the "ours" and
"theirs" ancestors. Additional d2o and d3o maps are
provided to obtain the hunk from the "ours" or
"theirs" ancestor, respectively.
*fugitive-:Gvdiff*
:Gvdiff [revision] Like |:Gdiff|, but always split vertically.
:Gdiffsplit! {object} Like |:Gdiffsplit|, but retain focus on the current
window.
*fugitive-:Gmove*
:Gmove {destination} Wrapper around git-mv that renames the buffer
afterward. The destination is relative to the current
directory except when started with a /, in which case
it is relative to the work tree. Add a ! to pass -f.
*:Gvdiffsplit*
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*fugitive-:Gremove*
:Gremove Wrapper around git-rm that deletes the buffer
*:Ghdiffsplit*
:Gdiffsplit ++novertical [object]
:Ghdiffsplit [object] Like |:Gdiffsplit|, but with "vertical" removed from
'diffopt'. The split will still be vertical if
combined with |:vertical|.
Other commands ~
These do not directly correspond to any built-in Vim command, and have a
capital letter after the "G" to convey this. For example, the file move
operation has nothing to do with the |:move| built-in, so it is named :GMove,
not :Gmove.
*:GMove*
:GMove {destination} Wrapper around git-mv that renames the buffer
afterward. Add a ! to pass -f.
*:GRename*
:GRename {destination} Like |:GMove| but operates relative to the parent
directory of the current file.
*:GDelete*
:GDelete Wrapper around git-rm that deletes the buffer
afterward. When invoked in an index file, --cached is
passed. Add a ! to pass -f and forcefully discard the
buffer.
*fugitive-:Gblame*
:Gblame [flags] Run git-blame on the file and open the results in a
scroll bound vertical split. You can give any of
ltfnsewMC as flags and they will be passed along to
git-blame. The following maps, which work on the
cursor line commit where sensible, are provided:
*:GRemove* *:GUnlink*
:GRemove Like |:GDelete|, but keep the (now empty) buffer around.
:GUnlink
g? show this help
A resize to end of author column
C resize to end of commit column
D resize to end of date/time column
q close blame and return to blamed window
gq q, then |:Gedit| to return to work tree version
<CR> q, then open commit
o open commit in horizontal split
O open commit in new tab
- reblame at commit
~ reblame at [count]th first grandparent
P reblame at [count]th parent (like HEAD^[count])
*:GBrowse*
:GBrowse Open the current file, blob, tree, commit, or tag
in your browser at the upstream hosting provider.
Upstream providers can be added by installing an
appropriate Vim plugin. For example, GitHub can be
supported by installing rhubarb.vim, available at
<https://github.com/tpope/vim-rhubarb>.
:[range]Gblame [flags] Run git-blame on the given range.
:GBrowse {object} Like :GBrowse, but for a given |fugitive-object|.
*fugitive-:Gbrowse*
:[range]Gbrowse If the remote for the current branch is on GitHub,
open the current file, blob, tree, commit, or tag
(with git-web--browse) on GitHub. Otherwise, open the
current file, blob, tree, commit, or tag in
git-instaweb (if you have issues, verify you can run
"git instaweb" from a terminal). If a range is given,
it is appropriately appended to the URL as an anchor.
:{range}GBrowse [args] Appends an anchor to the URL that emphasizes the
selected lines. This also forces the URL to include a
commit rather than a branch name so it remains valid
if the file changes. You can give a range of "0" to
force this behavior without including an anchor.
To use with GitHub FI, point g:fugitive_github_domains
at a list of domains:
>
let g:fugitive_github_domains = ['https://example.com']
~
:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
:GBrowse [...]@{remote} Force using the given remote rather than the remote
for the current branch. The remote is used to
determine which upstream repository to link to.
:GBrowse {url} Open an arbitrary URL in your browser.
:[range]GBrowse! [args] Like :GBrowse, but put the URL on the clipboard rather
than opening it.
:[range]Gbrowse {revision}
Like :Gbrowse, but for a given |fugitive-revision|. A
useful value here is -, which ties the URL to the
latest commit rather than a volatile branch.
MAPS *fugitive-maps*
:[range]Gbrowse [...]@{remote}
Force using the given remote rather than the remote
for the current branch. The remote is used to
determine which GitHub repository to link to.
These maps are available in both the |fugitive-summary| buffer and Fugitive
object buffers, although not all maps make sense in all buffers. Mappings
that operate on the file or hunk under the cursor are generally available in
visual mode to operate on multiple files or partial hunks.
MAPPINGS *fugitive-mappings*
*fugitive-staging-maps*
Staging/unstaging maps ~
These maps are available everywhere.
*fugitive_s*
s Stage (add) the file or hunk under the cursor.
*fugitive-c_CTRL-R_CTRL-G*
*fugitive_u*
u Unstage (reset) the file or hunk under the cursor.
*fugitive_-*
- Stage or unstage the file or hunk under the cursor.
*fugitive_U*
U Unstage everything.
*fugitive_X*
X Discard the change under the cursor. This uses
`checkout` or `clean` under the hood. A command is
echoed that shows how to undo the change. Consult
`:messages` to see it again. During a merge conflict,
use 2X to call `checkout --ours` or 3X to call
`checkout --theirs` .
*fugitive_=*
= Toggle an inline diff of the file under the cursor.
*fugitive_>*
> Insert an inline diff of the file under the cursor.
*fugitive_<*
< Remove the inline diff of the file under the cursor.
*fugitive_gI*
gI Open .git/info/exclude in a split and add the file
under the cursor. Use a count to open .gitignore.
*fugitive_I*
I Invoke |:Git| add --patch or reset --patch on the file
P under the cursor. On untracked files, this instead
calls |:Git| add --intent-to-add.
*fugitive_d*
Diff maps ~
*fugitive_dp*
dp Invoke |:Git| diff on the file under the cursor.
Deprecated in favor of inline diffs.
*fugitive_dd*
dd Perform a |:Gdiffsplit| on the file under the cursor.
*fugitive_dv*
dv Perform a |:Gvdiffsplit| on the file under the cursor.
*fugitive_ds* *fugitive_dh*
ds Perform a |:Ghdiffsplit| on the file under the cursor.
dh
*fugitive_dq*
dq Close all but the currently focused diff buffer, and
invoke |:diffoff|!.
*fugitive_d?*
d? Show this help.
*fugitive-navigation-maps*
Navigation maps ~
*fugitive_<CR>*
<CR> Open the file or |fugitive-object| under the cursor.
In a blob, this and similar maps jump to the patch
from the diff where this was added, or where it was
removed if a count was given. If the line is still in
the work tree version, passing a count takes you to
it.
*fugitive_o*
o Open the file or |fugitive-object| under the cursor in
a new split.
*fugitive_gO*
gO Open the file or |fugitive-object| under the cursor in
a new vertical split.
*fugitive_O*
O Open the file or |fugitive-object| under the cursor in
a new tab.
*fugitive_p*
p Open the file or |fugitive-object| under the cursor in
a preview window. In the status buffer, 1p is
required to bypass the legacy usage instructions.
*fugitive_~*
~ Open the current file in the [count]th first ancestor.
*fugitive_P*
P Open the current file in the [count]th parent.
Experimental: In the "Unpushed" section of the status
buffer, this will populate the command line with a
":Git push" command for the commit under the cursor.
*fugitive_C*
C Open the commit containing the current file.
*fugitive_CTRL-P* *fugitive_(*
( Jump to the previous file, hunk, or revision.
*fugitive_CTRL-N* *fugitive_)*
) Jump to the next file, hunk, or revision.
*fugitive_[c*
[c Jump to previous hunk, expanding inline diffs
automatically. (This shadows the Vim built-in |[c|
that provides a similar operation in |diff| mode.)
*fugitive_]c*
]c Jump to next hunk, expanding inline diffs
automatically. (This shadows the Vim built-in |]c|
that provides a similar operation in |diff| mode.)
*fugitive_[/* *fugitive_[m*
[/ Jump to previous file, collapsing inline diffs
[m automatically. (Mnemonic: "/" appears in filenames,
"m" appears in "filenames".)
*fugitive_]/* *fugitive_]m*
]/ Jump to next file, collapsing inline diffs
]m automatically. (Mnemonic: "/" appears in filenames,
"m" appears in "filenames".)
*fugitive_i*
i Jump to the next file or hunk, expanding inline diffs
automatically.
*fugitive_[[*
[[ Jump [count] sections backward.
*fugitive_]]*
]] Jump [count] sections forward.
*fugitive_[]*
[] Jump [count] section ends backward.
*fugitive_][*
][ Jump [count] section ends forward.
*fugitive_star*
* On the first column of a + or - diff line, search for
the corresponding - or + line. Otherwise, defer to
built-in |star|.
*fugitive_#*
# Same as "*", but search backward.
*fugitive_gu*
gu Jump to file [count] in the "Untracked" or "Unstaged"
section.
*fugitive_gU*
gU Jump to file [count] in the "Unstaged" section.
*fugitive_gs*
gs Jump to file [count] in the "Staged" section.
*fugitive_gp*
gp Jump to file [count] in the "Unpushed" section.
*fugitive_gP*
gP Jump to file [count] in the "Unpulled" section.
*fugitive_gr*
gr Jump to file [count] in the "Rebasing" section.
*fugitive_gi*
gi Open .git/info/exclude in a split. Use a count to
open .gitignore.
*fugitive_c*
Commit maps ~
cc Create a commit.
cvc Create a commit with -v.
ca Amend the last commit and edit the message.
cva Amend the last commit with -v.
ce Amend the last commit without editing the message.
cw Reword the last commit.
cW Create an `amend!` commit that rewords the commit
under the cursor.
cf Create a `fixup!` commit for the commit under the
cursor.
cF Create a `fixup!` commit for the commit under the
cursor and immediately rebase it.
cs Create a `squash!` commit for the commit under the
cursor.
cS Create a `squash!` commit for the commit under the
cursor and immediately rebase it.
cn Create a `squash!` commit for the commit under the
(formerly cA) cursor and edit the message.
c<Space> Populate command line with ":Git commit ".
*fugitive_cr*
crc Revert the commit under the cursor.
crn Revert the commit under the cursor in the index and
work tree, but do not actually commit the changes.
cr<Space> Populate command line with ":Git revert ".
*fugitive_cm*
cm<Space> Populate command line with ":Git merge ".
c? Show this help.
*fugitive_cb*
*fugitive_co*
Checkout/branch maps ~
coo Check out the commit under the cursor.
cb<Space> Populate command line with ":Git branch ".
co<Space> Populate command line with ":Git checkout ".
cb? Show this help.
co?
*fugitive_cz*
Stash maps ~
czz Push stash. Pass a [count] of 1 to add
`--include-untracked` or 2 to add `--all`.
czw Push stash of the work-tree. Like `czz` with
`--keep-index`.
czs Push stash of the stage. Does not accept a count.
czA Apply topmost stash, or stash@{count}.
cza Apply topmost stash, or stash@{count}, preserving the
index.
czP Pop topmost stash, or stash@{count}.
czp Pop topmost stash, or stash@{count}, preserving the
index.
cz<Space> Populate command line with ":Git stash ".
cz? Show this help.
*fugitive_r*
Rebase maps ~
ri Perform an interactive rebase. Uses ancestor of
u commit under cursor as upstream if available.
rf Perform an autosquash rebase without editing the todo
list. Uses ancestor of commit under cursor as
upstream if available.
ru Perform an interactive rebase against @{upstream}.
rp Perform an interactive rebase against @{push}.
rr Continue the current rebase.
rs Skip the current commit and continue the current
rebase.
ra Abort the current rebase.
re Edit the current rebase todo list.
rw Perform an interactive rebase with the commit under
the cursor set to `reword`.
rm Perform an interactive rebase with the commit under
the cursor set to `edit`.
rd Perform an interactive rebase with the commit under
the cursor set to `drop`.
r<Space> Populate command line with ":Git rebase ".
r? Show this help.
*fugitive-misc-maps*
Miscellaneous maps ~
*fugitive_gq* *fugitive_q*
gq Close the status buffer.
*fugitive_.*
. Start a |:| command line with the file under the
cursor prepopulated.
*fugitive_g?*
g? Show help for |fugitive-maps|.
*fugitive-global-maps*
Global maps ~
*fugitive_c_CTRL-R_CTRL-G*
<C-R><C-G> On the command line, recall the path to the current
object (that is, a representation of the object
recognized by |:Gedit|).
|fugitive-object| (that is, a representation of the
object recognized by |:Gedit|).
*fugitive-y_CTRL-G*
["x]y<C-G> Yank the commit SHA and path to the current object.
*fugitive_y_CTRL-G*
["x]y<C-G> Yank the path to the current |fugitive-object|.
These maps are available in Git objects.
*g:fugitive_no_maps*
Global maps can be disabled with the g:fugitive_no_maps option.
>
let g:fugitive_no_maps = 1
<
SPECIFYING OBJECTS *fugitive-object* *fugitive-revision*
*fugitive-<CR>*
<CR> Jump to the revision under the cursor.
Fugitive objects are either work tree files or Git revisions as defined in the
"SPECIFYING REVISIONS" section in the git-rev-parse man page, with expansions
inspired by |cmdline-special| layered on top. For commands that accept an
optional object, the default is the file in the index for work tree files and
the work tree file for everything else. Example objects follow.
*fugitive-o*
o Jump to the revision under the cursor in a new split.
*fugitive-S*
S Jump to the revision under the cursor in a new
vertical split.
*fugitive-O*
O Jump to the revision under the cursor in a new tab.
*fugitive--*
- Go to the tree containing the current tree or blob.
*fugitive-~*
~ Go to the current file in the [count]th first
ancestor.
*fugitive-P*
P Go to the current file in the [count]th parent.
*fugitive-C*
C Go to the commit containing the current file.
*fugitive-.*
. Start a |:| command line with the current revision
prepopulated at the end of the line.
*fugitive-a*
a Show the current tag, commit, or tree in an alternate
format.
SPECIFYING REVISIONS *fugitive-revision*
Fugitive revisions are similar to Git revisions as defined in the "SPECIFYING
REVISIONS" section in the git-rev-parse man page. For commands that accept an
optional revision, the default is the file in the index for work tree files
and the work tree file for everything else. Example revisions follow.
Revision Meaning ~
HEAD .git/HEAD
master .git/refs/heads/master
HEAD^{} The commit referenced by HEAD
HEAD^ The parent of the commit referenced by HEAD
HEAD: The tree referenced by HEAD
/HEAD The file named HEAD in the work tree
Object Meaning ~
@ The commit referenced by @ aka HEAD
master The commit referenced by master
master^ The parent of the commit referenced by master
master...other The merge base of master and other
master: The tree referenced by master
./master The file named master in the working directory
:(top)master The file named master in the work tree
Makefile The file named Makefile in the work tree
HEAD^:Makefile The file named Makefile in the parent of HEAD
@^:Makefile The file named Makefile in the parent of HEAD
:Makefile The file named Makefile in the index (writable)
- The current file in HEAD
^ The current file in the previous commit
~3 The current file 3 commits ago
: .git/index (Same as |:Gstatus|)
:0 The current file in the index
:1 The current file's common ancestor during a conflict
:2 The current file in the target branch during a conflict
:3 The current file in the merged branch during a conflict
:/foo The most recent commit with "foo" in the message
@~2:% The current file in the grandparent of HEAD
:% The current file in the index
:1:% The current file's common ancestor during a conflict
:2:# The alternate file in the target branch during a conflict
:3:#5 The file from buffer #5 in the merged branch during a conflict
! The commit owning the current file
!:Makefile The file named Makefile in the commit owning the current file
!3^2 The second parent of the commit owning buffer #3
.git/config The repo config file
: The |fugitive-summary| buffer
- A temp file containing the last |:Git| invocation's output
<cfile> The file or commit under the cursor
STATUSLINE *fugitive-statusline*
*fugitive#statusline()*
Add %{fugitive#statusline()} to your statusline to get an indicator including
*FugitiveStatusline()* *fugitive#statusline()*
Add %{FugitiveStatusline()} to your statusline to get an indicator including
the current branch and the currently edited file's commit. If you don't have
a statusline, this one matches the default when 'ruler' is set:
>
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P
<
*fugitive#head(...)*
Use fugitive#head() to return the name of the current branch. If the current
HEAD is detached, fugitive#head() will return the empty string, unless the
optional argument is given, in which case the hash of the current commit will
be truncated to the given number of characters.
AUTOCOMMANDS *fugitive-autocommands*
A handful of |User| |autocommands| are provided to allow extending and
overriding Fugitive behaviors. Example usage:
>
autocmd User FugitiveBlob,FugitiveStageBlob call s:BlobOverrides()
<
*User_FugitiveTag*
FugitiveTag After loading a tag object.
*User_FugitiveCommit*
FugitiveCommit After loading a commit object.
*User_FugitiveTree*
FugitiveTree After loading a tree (directory) object.
*User_FugitiveBlob*
FugitiveBlob After loading a committed blob (file) object.
*User_FugitiveObject*
FugitiveObject After loading any of the 4 above buffer types.
*User_FugitiveStageBlob*
FugitiveStageBlob After loading a staged blob (file) object. These
buffers are 'modifiable' and oftentimes don't want the
same behavior as the other buffer types.
*User_FugitiveIndex*
FugitiveIndex After loading the |fugitive-summary| buffer.
*User_FugitivePager*
FugitivePager After loading a temp file created by a command like
:Git --paginate or :Git blame.
*User_FugitiveEditor*
FugitiveEditor After a :Git command (e.g., :Git commit) edits a file
(e.g., the commit message).
*User_FugitiveChanged*
FugitiveChanged After any event which can potentially change the
repository, for example, any invocation of |:Git|.
Originally intended for expiring caches, but can have
other uses.
API *fugitive-api*
Officially supported functions are documented inline in plugin/fugitive.vim.
DEPRECATIONS *fugitive-deprecated*
The following commands are deprecated in favor of replacements that adhere to
a new naming scheme. Remember that |:Git| can be shortened to |:G|, so
replacements using it are just one space character longer than the legacy
version.
*:Gremove* Superseded by |:GRemove|.
*:Gdelete* Superseded by |:GDelete|.
*:Gmove* Superseded by |:GMove|.
*:Grename* Superseded by |:GRename|.
*:Gbrowse* Superseded by |:GBrowse|.
*:Gdiff* Superseded by |:Gdiffsplit|
*:Gsdiff* Superseded by |:Ghdiffsplit|
*:Gvdiff* Superseded by |:Gvdiffsplit| or |:vert| |:Gdiffsplit|.
*:Gblame* Superseded by |:Git_blame|.
*:Gcommit* Superseded by |:Git| commit.
*:Gmerge* Superseded by |:Git| merge and |:Git_mergetool|.
*:Gpull* Superseded by |:Git| pull.
*:Grebase* Superseded by |:Git| rebase.
*:Grevert* Superseded by |:Git| revert.
*:Gpush* Superseded by |:Git| push.
*:Gfetch* Superseded by |:Git| fetch.
*:Glog* Superseded by |:Gclog|.
*:Gstatus* Superseded by |:Git| (with no arguments).
*:Gsplit!* Superseded by |:Git_--paginate|.
*:Gvsplit!* Superseded by :vert Git --paginate.
*:Gtabsplit!* Superseded by :tab Git --paginate.
*:Gpedit!* Superseded by :Git! --paginate.
*User_Fugitive*
Fugitive used to support `:autocmd User Fugitive` to run an autocommand after
loading any buffer belonging to a Git repository, but this has been phased
out. Instead, one can leverage regular autocommand events like |BufNewFile|
and |BufReadPost|, and check !empty(FugitiveGitDir()) to confirm Fugitive has
found a repository. See also |fugitive-autocommands| for other, more
selective events.
ABOUT *fugitive-about*
Grab the latest version or report a bug on GitHub:
http://github.com/tpope/vim-fugitive
https://github.com/tpope/vim-fugitive
vim:tw=78:et:ft=help:norl:

1
ftdetect/fugitive.vim Normal file
View File

@@ -0,0 +1 @@
autocmd BufReadPost *.fugitiveblame setfiletype fugitiveblame

View File

@@ -0,0 +1,6 @@
if exists("b:did_ftplugin") || !exists("*FugitiveGitDir")
finish
endif
let b:did_ftplugin = 1
call fugitive#BlameFileType()

File diff suppressed because it is too large Load Diff

57
syntax/fugitive.vim Normal file
View File

@@ -0,0 +1,57 @@
if exists("b:current_syntax")
finish
endif
syn sync fromstart
syn spell notoplevel
syn include @fugitiveDiff syntax/diff.vim
syn match fugitiveHeader /^[A-Z][a-z][^:]*:/
syn match fugitiveHeader /^Head:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveSymbolicRef skipwhite
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
syn match fugitiveHelpTag /\S\+/ contained
syn region fugitiveSection start=/^\%(.*(\d\++\=)$\)\@=/ contains=fugitiveHeading end=/^$/ fold
syn cluster fugitiveSection contains=fugitiveSection
syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
syn match fugitiveCount /(\d\++\=)/hs=s+1,he=e-1 contained
syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveDone /^done\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveStop /^stop\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSection
syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@<!/ contained
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
for s:section in ['Untracked', 'Unstaged', 'Staged']
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\++\=)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/ fold'
exe 'syn match fugitive' . s:section . 'Modifier /^[MADRCU?] / contained containedin=fugitive' . s:section . 'Section'
exe 'syn cluster fugitiveSection add=fugitive' . s:section . 'Section'
exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
endfor
unlet s:section
hi def link fugitiveHelpHeader fugitiveHeader
hi def link fugitiveHeader Label
hi def link fugitiveHelpTag Tag
hi def link fugitiveHeading PreProc
hi def link fugitiveUntrackedHeading PreCondit
hi def link fugitiveUnstagedHeading Macro
hi def link fugitiveStagedHeading Include
hi def link fugitiveModifier Type
hi def link fugitiveUntrackedModifier StorageClass
hi def link fugitiveUnstagedModifier Structure
hi def link fugitiveStagedModifier Typedef
hi def link fugitiveInstruction Type
hi def link fugitiveStop Function
hi def link fugitiveHash Identifier
hi def link fugitiveSymbolicRef Function
hi def link fugitiveCount Number
let b:current_syntax = "fugitive"

7
syntax/fugitiveblame.vim Normal file
View File

@@ -0,0 +1,7 @@
if exists("b:current_syntax") || !exists("*FugitiveGitDir")
finish
endif
call fugitive#BlameSyntax()
let b:current_syntax = "fugitiveblame"