139 Commits
v3.0 ... v3.2

Author SHA1 Message Date
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
5 changed files with 1303 additions and 729 deletions

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

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

View File

@@ -4,8 +4,8 @@ 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:
Bring up an enhanced version of `git status` with `:G` (also known as
`:Gstatus`). Press `g?` to bring up a list of mappings for numerous
operations including diffing, staging, committing, rebasing, and stashing.
`:Gstatus`). Press `g?` to bring up a list of maps for numerous operations
including diffing, staging, committing, rebasing, and stashing.
View any blob, tree, commit, or tag in the repository with `:Gedit` (and
`:Gsplit`, `:Gvsplit`, `:Gtabedit`, ...). Edit a file in the index and
@@ -33,6 +33,9 @@ Use `:Ggrep` to search the work tree (or any arbitrary commit) with
list. Give them a range (e.g., using visual mode and `:'<,'>Gclog`) to
iterate over every change to that portion of the current file.
`:Git mergetool` loads conflicts into the quickfix list. `:Git difftool` does
the same for any arbitrary set of changes.
`: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.
@@ -43,13 +46,16 @@ making it like `git add` when called from a work tree file and like
Use `: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], and
[Gitee][fugitive-gitee.vim].
[GitLab][fugitive-gitlab.vim], [Bitbucket][fubitive.vim],
[Gitee][fugitive-gitee.vim], [Pagure][pagure], and
[Phabricator][vim-phabricator].
[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
Add `%{FugitiveStatusline()}` to `'statusline'` to get an indicator
with the current branch in your statusline.
@@ -68,22 +74,15 @@ For more information, see `:help fugitive`.
## Installation
If you don't have a preferred installation method, one option is to install
[pathogen.vim](https://github.com/tpope/vim-pathogen), and then copy
and paste:
Install using your favorite package manager, or use Vim's built-in package support:
cd ~/.vim/bundle
git clone https://github.com/tpope/vim-fugitive.git
vim -u NONE -c "helptags vim-fugitive/doc" -c q
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
> Why don't any of the commands exist?
Fugitive cares about the current file, not the current working directory.
Edit a file from the repository. To avoid the blank window problem, favor
commands like `:split` and `:tabedit` over commands like `:new` and `:tabnew`.
> Why can't I enter my password when I `:Gpush`?
It is highly recommended to use SSH keys or [credentials caching][] to avoid
@@ -93,9 +92,8 @@ request the password via a GUI. Fugitive will configure this for you
automatically if you have `ssh-askpass` or `git-gui` installed; otherwise it's
your responsibility to set this up.
As an absolute last resort, you can invoke `:Git --paginate push`. Fugitive
recognizes the pagination request and fires up a `:terminal`, which allows for
interactive password entry.
If you absolutely must type in your password by hand, sidestep Fugitive and
use `:terminal git push`.
[credentials caching]: https://help.github.com/en/articles/caching-your-github-password-in-git

File diff suppressed because it is too large Load Diff

View File

@@ -15,186 +15,62 @@ COMMANDS *fugitive-commands*
These commands are local to the buffers in which they work (generally, buffers
that are part of Git repositories).
*fugitive-:G* *fugitive-:Gstatus*
:G Bring up a summary window vaguely akin to git-status.
:Gstatus Press g? or see |fugitive-mappings| for usage.
*fugitive-:Git*
*:Git* *fugitive-:G*
:Git {args} Run an arbitrary git command. Similar to :!git [args]
:G {args} but chdir to the repository tree first. For some
subcommands, a Fugitive command is called instead.
Invoking :Git push will call :Gpush for example.
*fugitive-:Git!*
:Git! {args} Like |:Git|, but capture the output into a temp file,
:Git --no-pager {args} and |:split| that temp file. Use :0Git to
:Git -P {args} |:edit| the temp file instead. A temp file is always
:Git --paginate {args} and |:split| that temp file. Use :0Git to
:Git -p {args} |:edit| the temp file instead. A temp file is always
used for diff and log commands.
*fugitive-:Gcd*
:Gcd [directory] |:cd| relative to the repository.
*:Gstatus*
:Git Bring up a summary window vaguely akin to git-status.
:G Press g? or see |fugitive-maps| for usage.
:Gstatus
*fugitive-:Glcd*
:Glcd [directory] |:lcd| relative to the repository.
*fugitive-:Gcommit*
:Gcommit [args] A wrapper around git-commit. Unless the arguments
given would skip the invocation of an editor (e.g.,
*:Git-commit* *:Gcommit*
:Git commit [args] A wrapper around git-commit. Unless the arguments
:Gcommit [args] given would skip the invocation of an editor (e.g.,
-m), a split window will be used to obtain a commit
message, or a new tab if -v is given. Write and close
the window (:wq) to finish the commit. To cancel, use
an empty message.
*fugitive-:Grevert*
:Grevert [args] A wrapper around git-revert. Similar to |:Gcommit|.
*:Git-revert* *:Grevert*
:Git revert [args] A wrapper around git-revert. Similar to |:Gcommit|.
:Grevert [args]
*fugitive-:Gmerge*
:Gmerge [args] Calls git-merge and loads errors and conflicted files
into the |quickfix| list. Opens a |:Gcommit| style
*:Git-merge* *:Gmerge*
:Git merge [args] Calls git-merge and loads errors and conflicted files
:Gmerge [args] into the |quickfix| list. Opens a |:Gcommit| style
split window for the commit message if the merge
succeeds. If called during a merge conflict, the
conflicted files from the current index are loaded
into the |quickfix| list.
*fugitive-:Gpull*
:Gpull [args] Like |:Gmerge|, but for git-pull.
*:Git-pull* *:Gpull*
:Git pull [args] Like |:Gmerge|, but for git-pull.
:Gpull [args]
*fugitive-:Grebase*
:Grebase [args] Like |:Gmerge|, but for git-rebase. Interactive
rebase is experimentally supported.
*:Git-rebase* *:Grebase*
:Git rebase [args] Like |:Gmerge|, but for git-rebase. Interactive
:Grebase [args] rebase is experimentally supported.
*fugitive-:Gpush*
:Gpush [args] Invoke git-push, load the results into the |quickfix|
list, and invoke |:cwindow| to reveal any errors.
*:Git-push* *:Gpush*
:Git push [args] Invoke git-push, load the results into the |quickfix|
:Gpush [args] list, and invoke |:cwindow| to reveal any errors.
|:Dispatch| is used if available for asynchronous
invocation.
*fugitive-:Gfetch*
:Gfetch [args] Like |:Gpush|, but for git-fetch.
*:Git-fetch* *:Gfetch*
:Git fetch [args] Like |:Gpush|, but for git-fetch.
:Gfetch [args]
*fugitive-:Ggrep* *fugitive-:Gcgrep*
:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'.
*fugitive-:Glgrep*
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
*fugitive-:Gclog* *fugitive-:Glog*
:Gclog[!] [args] Use git-log [args] to load the commit history into the
:Glog[!] [args] |quickfix| list. Jump to the first commit unless [!]
is given.
:{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.
*fugitive-:Gllog*
:Gllog [args] Like |:Gclog|, but use the location list instead of the
|quickfix| list.
*fugitive-:Gedit* *fugitive-:Ge*
:Gedit [object] |:edit| a |fugitive-object|.
*fugitive-:Gsplit*
:Gsplit [object] |:split| a |fugitive-object|.
*fugitive-:Gvsplit*
:Gvsplit [object] |:vsplit| a |fugitive-object|.
*fugitive-:Gtabedit*
:Gtabedit [object] |:tabedit| a |fugitive-object|.
*fugitive-:Gpedit*
:Gpedit [object] |:pedit| a |fugitive-object|.
:Gsplit! [args] *fugitive-:Gsplit!* *fugitive-:Gvsplit!*
:Gvsplit! [args] *fugitive-:Gtabedit!* *fugitive-:Gpedit!*
:Gtabedit! [args] Capture the output of `git [args]` to a temp file and
:Gpedit! [args] open it in a split, tab, or preview window. Use
:0Gsplit! to suppress the split and open it in the
current window.
*fugitive-:Gread*
: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 [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 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
great deal of effort is expended to behave sensibly
when the work tree or index version of the file is
open in another buffer.
: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 :0:% to write to just that stage in
the index.
*fugitive-:Gwq*
:Gwq [path] Like |:Gwrite| followed by |:quit| if the write
succeeded.
:Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write
succeeded.
*fugitive-: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. 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
Vim's |do| and |dp| to stage and unstage changes.
*fugitive-: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 to obtain the hunk from the "ours" or
"theirs" ancestor, respectively.
:Gdiffsplit! {object} Like |:Gdiffsplit|, but retain focus on the current
window.
*fugitive-:Gvdiffsplit*
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*fugitive-:Ghdiffsplit* *fugitive-:Gsdiff*
:Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally.
*fugitive-:Gmove*
:Gmove {destination} Wrapper around git-mv that renames the buffer
afterward. Add a ! to pass -f.
*fugitive-:Grename*
:Grename {destination} Like |:Gmove| but operates relative to the parent
directory of the current file.
*fugitive-: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-:Gremove*
:Gremove Like :Gdelete, but keep the (now empty) buffer around.
*fugitive-:Gblame*
:Gblame [flags] Run git-blame [flags] on the current file and open the
results in a scroll-bound vertical split. The
*:Git-blame* *:Gblame*
:Git blame [flags] Run git-blame [flags] on the current file and open the
:Gblame [flags] results in a scroll-bound vertical split. The
following maps, which work on the cursor line commit
where sensible, are provided:
@@ -215,10 +91,152 @@ that are part of Git repositories).
:[range]Gblame [flags] If a range is given, just that part of the file will
:Gblame [flags] {file} be blamed, and a horizontal split without
scrollbinding is used. You can also give an arbitrary
:Git blame ... scrollbinding is used. You can also give an arbitrary
filename.
*fugitive-:Gbrowse*
*:Ggrep* *:Gcgrep* *:Git-grep*
:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'.
:Git[!] grep [args]
*:Glgrep*
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
:0Git[!] grep [args]
*: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.
:Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a
new tab, and invoke `:Gdiffsplit!` against the
appropriate commit.
*:Git-mergetool*
:Git mergetool [args] Like |:Git-difftool|, but target merge conflicts.
*:Gclog* *:Glog*
:Gclog[!] [args] Use git-log [args] to load the commit history into the
:Glog[!] [args] |quickfix| list. Jumps to the first commit unless [!]
is given.
:{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|.
:Gsplit! [args] *:Gsplit!* *:Gvsplit!*
:Gvsplit! [args] *:Gtabedit!* *:Gpedit!*
:Gtabedit! [args] Capture the output of `git [args]` to a temp file and
:Gpedit! [args] open it in a split, tab, or preview window. Use
:0Gsplit! to suppress the split and open it in the
current window.
*: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 [object] |:read| in a |fugitive-object| after {range}.
*:Gread!* *fugitive-:Gr!*
: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}.
*: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
great deal of effort is expended to behave sensibly
when the work tree or index version of the file is
open in another buffer.
: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 :0:% to write to just that stage in
the index.
*:Gwq*
:Gwq [path] Like |:Gwrite| followed by |:quit| if the write
succeeded.
:Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write
succeeded.
*: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. 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
Vim's |do| and |dp| to stage and unstage changes.
*: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.
:Gdiffsplit! {object} Like |:Gdiffsplit|, but retain focus on the current
window.
*:Gvdiffsplit*
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*:Ghdiffsplit* *:Gsdiff*
:Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally.
*: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.
*:Gremove*
:Gremove Like :Gdelete, but keep the (now empty) buffer around.
*:Gbrowse*
:Gbrowse Open the current file, blob, tree, commit, or tag
in your browser at the upstream hosting provider.
If a range is given, it is appropriately appended to
@@ -244,15 +262,15 @@ that are part of Git repositories).
:[range]Gbrowse! [args] Like :Gbrowse, but put the URL on the clipboard rather
than opening it.
MAPPINGS *fugitive-mappings*
MAPS *fugitive-maps*
These mappings are available in both the |:Gstatus| buffer and Fugitive object
buffers, although not all mappings make sense in all buffers. Mappings that
These maps are available in both the |:Gstatus| 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.
*fugitive-staging-mappings*
Staging/unstaging mappings ~
*fugitive-staging-maps*
Staging/unstaging maps ~
*fugitive_s*
s Stage (add) the file or hunk under the cursor.
@@ -294,7 +312,7 @@ P under the cursor. On untracked files, this instead
calls |:Git| add --intent-to-add.
*fugitive_d*
Diff mappings ~
Diff maps ~
*fugitive_dp*
dp Invoke |:Git!| diff on the file under the cursor.
Deprecated in favor of inline diffs.
@@ -315,8 +333,8 @@ dq Close all but one diff buffer, and |:diffoff|! the
*fugitive_d?*
d? Show this help.
*fugitive-navigation-mappings*
Navigation mappings ~
*fugitive-navigation-maps*
Navigation maps ~
*fugitive_<CR>*
<CR> Open the file or |fugitive-object| under the cursor.
@@ -426,7 +444,7 @@ gi Open .git/info/exclude in a split. Use a count to
open .gitignore.
*fugitive_c*
Commit mappings ~
Commit maps ~
cc Create a commit.
@@ -455,7 +473,7 @@ cS Create a `squash!` commit for the commit under the
cA Create a `squash!` commit for the commit under the
cursor and edit the message.
c<Space> Populate command line with ":Gcommit ".
c<Space> Populate command line with ":Git commit ".
*fugitive_cr*
crc Revert the commit under the cursor.
@@ -463,28 +481,28 @@ 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 ":Grevert ".
cr<Space> Populate command line with ":Git revert ".
*fugitive_cm*
cm<Space> Populate command line with ":Gmerge ".
cm<Space> Populate command line with ":Git merge ".
c? Show this help.
*fugitive_cb*
*fugitive_co*
Checkout/branch mappings ~
Checkout/branch maps ~
coo Check out the commit under the cursor.
cb<Space> Populate command line with ":G branch ".
cb<Space> Populate command line with ":Git branch ".
co<Space> Populate command line with ":G checkout ".
co<Space> Populate command line with ":Git checkout ".
cb? Show this help.
co?
*fugitive_cz*
Stash mappings ~
Stash maps ~
czz Push stash. Pass a [count] of 1 to add
`--include-untracked` or 2 to add `--all`.
@@ -502,12 +520,12 @@ czP Pop topmost stash, or stash@{count}.
czp Pop topmost stash, or stash@{count}, preserving the
index.
cz<Space> Populate command line with ":G stash ".
cz<Space> Populate command line with ":Git stash ".
cz? Show this help.
*fugitive_r*
Rebase mappings ~
Rebase maps ~
ri Perform an interactive rebase. Uses ancestor of
u commit under cursor as upstream if available.
@@ -538,12 +556,12 @@ rm Perform an interactive rebase with the commit under
rd Perform an interactive rebase with the commit under
the cursor set to `drop`.
r<Space> Populate command line with ":Grebase ".
r<Space> Populate command line with ":Git rebase ".
r? Show this help.
*fugitive-misc-mappings*
Miscellaneous mappings ~
*fugitive-misc-maps*
Miscellaneous maps ~
*fugitive_gq* *fugitive_q*
gq Close the status buffer.
@@ -553,10 +571,10 @@ gq Close the status buffer.
cursor prepopulated.
*fugitive_g?*
g? Show help for |fugitive-mappings|.
g? Show help for |fugitive-maps|.
*fugitive-global-mappings*
Global mappings ~
*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
@@ -566,6 +584,11 @@ Global mappings ~
*fugitive_y_CTRL-G*
["x]y<C-G> Yank the path to the current |fugitive-object|.
*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 objects are either work tree files or Git revisions as defined in the
@@ -581,7 +604,7 @@ 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 the work tree
:(top)master The file named master in the work tree
Makefile The file named Makefile in the work tree
@^:Makefile The file named Makefile in the parent of HEAD
:Makefile The file named Makefile in the index (writable)

View File

@@ -1,6 +1,6 @@
" fugitive.vim - A Git wrapper so awesome, it should be illegal
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 3.0
" Version: 3.2
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
if exists('g:loaded_fugitive')
@@ -9,8 +9,15 @@ endif
let g:loaded_fugitive = 1
function! FugitiveGitDir(...) abort
if !a:0 || a:1 ==# -1
return get(b:, 'git_dir', '')
if !a:0 || type(a:1) == type(0) && a:1 < 0
if exists('g:fugitive_event')
return g:fugitive_event
endif
let dir = get(b:, 'git_dir', '')
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$')
return FugitiveExtractGitDir(getcwd())
endif
return dir
elseif type(a:1) == type(0)
return getbufvar(a:1, 'git_dir')
elseif type(a:1) == type('')
@@ -59,8 +66,8 @@ function! FugitivePath(...) abort
endfunction
" FugitiveParse() takes a fugitive:// URL and returns a 2 element list
" containing the Git dir and an object name ("commit:file"). It's effectively
" then inverse of FugitiveFind().
" containing an object name ("commit:file") and the Git dir. It's effectively
" the inverse of FugitiveFind().
function! FugitiveParse(...) abort
let path = s:Slash(a:0 ? a:1 : @%)
if path !~# '^fugitive:'
@@ -96,6 +103,24 @@ function! FugitiveConfig(...) abort
endif
endfunction
" Retrieve a Git configuration value. An optional second argument provides
" the Git dir as with FugitiveFind(). Pass a blank string to limit to the
" global config.
function! FugitiveConfigGet(name, ...) abort
return call('FugitiveConfig', [a:name] + a:000)
endfunction
" Like FugitiveConfigGet(), but return a list of all values.
function! FugitiveConfigGetAll(name, ...) abort
if a:0 && type(a:1) ==# type({})
let config = a:1
else
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
endif
let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g')
return copy(get(config, name, []))
endfunction
function! FugitiveRemoteUrl(...) abort
return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1))
endfunction
@@ -150,16 +175,16 @@ function! s:Tree(path) abort
let config = readfile(config_file,'',10)
call filter(config,'v:val =~# "^\\s*worktree *="')
if len(config) == 1
let worktree = s:Slash(FugitiveVimPath(matchstr(config[0], '= *\zs.*')))
let worktree = FugitiveVimPath(matchstr(config[0], '= *\zs.*'))
endif
elseif filereadable(dir . '/gitdir')
let worktree = s:Slash(fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h'))
let worktree = fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h')
if worktree ==# '.'
unlet! worktree
endif
endif
if exists('worktree')
let s:worktree_for_dir[dir] = worktree
let s:worktree_for_dir[dir] = s:Slash(resolve(worktree))
let s:dir_for_worktree[s:worktree_for_dir[dir]] = dir
endif
endif
@@ -170,10 +195,29 @@ function! s:Tree(path) abort
endif
endfunction
function! s:CeilingDirectories() abort
if !exists('s:ceiling_directories')
let s:ceiling_directories = []
let resolve = 1
for dir in split($GIT_CEILING_DIRECTORIES, has('win32') ? ';' : ':', 1)
if empty(dir)
let resolve = 0
elseif resolve
call add(s:ceiling_directories, resolve(dir))
else
call add(s:ceiling_directories, dir)
endif
endfor
endif
return s:ceiling_directories + get(g:, 'ceiling_directories', [])
endfunction
function! FugitiveExtractGitDir(path) abort
let path = s:Slash(a:path)
if path =~# '^fugitive:'
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
elseif empty(path)
return ''
elseif isdirectory(path)
let path = fnamemodify(path, ':p:s?/$??')
else
@@ -194,7 +238,7 @@ function! FugitiveExtractGitDir(path) abort
if root =~# '\v^//%([^/]+/?)?$'
break
endif
if index(split($GIT_CEILING_DIRECTORIES, ':'), root) >= 0
if index(s:CeilingDirectories(), root) >= 0
break
endif
if root ==# $GIT_WORK_TREE && FugitiveIsGitDir(env_git_dir)
@@ -278,17 +322,31 @@ function! s:ProjectionistDetect() abort
endif
endfunction
if v:version + has('patch061') < 703
runtime! autoload/fugitive.vim
endif
let g:io_fugitive = {
\ 'simplify': function('fugitive#simplify'),
\ 'resolve': function('fugitive#resolve'),
\ 'getftime': function('fugitive#getftime'),
\ 'getfsize': function('fugitive#getfsize'),
\ 'getftype': function('fugitive#getftype'),
\ 'filereadable': function('fugitive#filereadable'),
\ 'filewritable': function('fugitive#filewritable'),
\ 'isdirectory': function('fugitive#isdirectory'),
\ 'getfperm': function('fugitive#getfperm'),
\ 'setfperm': function('fugitive#setfperm'),
\ 'readfile': function('fugitive#readfile'),
\ 'writefile': function('fugitive#writefile'),
\ 'glob': function('fugitive#glob'),
\ 'delete': function('fugitive#delete'),
\ 'Real': function('FugitiveReal')}
augroup fugitive
autocmd!
autocmd BufNewFile,BufReadPost * call FugitiveDetect(expand('<amatch>:p'))
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<amatch>')), ':p'))
autocmd User NERDTreeInit,NERDTreeNewRoot
\ if exists('b:NERDTree.root.path.str') |
\ call FugitiveDetect(b:NERDTree.root.path.str()) |
\ endif
autocmd VimEnter * if empty(expand('<amatch>'))|call FugitiveDetect(getcwd())|endif
autocmd CmdWinEnter * call FugitiveDetect(expand('#:p'))
autocmd FileType git
\ if len(FugitiveGitDir()) |
@@ -324,7 +382,10 @@ augroup fugitive
\ silent doautocmd BufNewFile |
\ endif
autocmd BufReadCmd fugitive://*//* exe fugitive#BufReadCmd()
autocmd BufReadCmd fugitive://*//* exe fugitive#BufReadCmd() |
\ if &path =~# '^\.\%(,\|$\)' |
\ let &l:path = substitute(&path, '^\.,\=', '', '') |
\ endif
autocmd BufWriteCmd fugitive://*//[0-3]/* exe fugitive#BufWriteCmd()
autocmd FileReadCmd fugitive://*//* exe fugitive#FileReadCmd()
autocmd FileWriteCmd fugitive://*//[0-3]/* exe fugitive#FileWriteCmd()
@@ -337,19 +398,93 @@ augroup fugitive
autocmd User ProjectionistDetect call s:ProjectionistDetect()
augroup END
let g:io_fugitive = {
\ 'simplify': function('fugitive#simplify'),
\ 'resolve': function('fugitive#resolve'),
\ 'getftime': function('fugitive#getftime'),
\ 'getfsize': function('fugitive#getfsize'),
\ 'getftype': function('fugitive#getftype'),
\ 'filereadable': function('fugitive#filereadable'),
\ 'filewritable': function('fugitive#filewritable'),
\ 'isdirectory': function('fugitive#isdirectory'),
\ 'getfperm': function('fugitive#getfperm'),
\ 'setfperm': function('fugitive#setfperm'),
\ 'readfile': function('fugitive#readfile'),
\ 'writefile': function('fugitive#writefile'),
\ 'glob': function('fugitive#glob'),
\ 'delete': function('fugitive#delete'),
\ 'Real': function('FugitiveReal')}
let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete G exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete Git exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#CommitComplete Gcommit exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "commit " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RevertComplete Grevert exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "revert " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#MergeComplete Gmerge exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "merge " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RebaseComplete Grebase exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "rebase " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PullComplete Gpull exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "pull " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PushComplete Gpush exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "push " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#FetchComplete Gfetch exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "fetch " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#BlameComplete Gblame exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "blame " . <q-args>)'
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(<q-args>, 0)"
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(<q-args>, 1)"
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#Command(0, <count> > 0 ? <count> : 0, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "split" : "edit"), <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gvsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "vsplit" : "edit!"), <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_tabs '-complete=customlist,fugitive#ReadComplete Gtabedit exe fugitive#Open((<count> >= 0 ? <count> : "")."tabedit", <bang>0, "<mods>", <q-args>, [<f-args>])'
if exists(':Gr') != 2
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gr exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
endif
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gread exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, <bang>0, "vert <mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
if get(g:, 'fugitive_no_maps')
finish
endif
let s:nowait = v:version >= 704 ? '<nowait>' : ''
function! s:Map(mode, lhs, rhs, ...) abort
for mode in split(a:mode, '\zs')
let flags = (a:0 ? a:1 : '') . (a:rhs =~# '<Plug>' ? '' : '<script>')
let head = a:lhs
let tail = ''
let keys = get(g:, mode.'remap', {})
if type(keys) == type([])
return
endif
while !empty(head)
if has_key(keys, head)
let head = keys[head]
if empty(head)
return
endif
break
endif
let tail = matchstr(head, '<[^<>]*>$\|.$') . tail
let head = substitute(head, '<[^<>]*>$\|.$', '', '')
endwhile
if flags !~# '<unique>' || empty(mapcheck(head.tail, mode))
exe mode.'map' s:nowait flags head.tail a:rhs
endif
endfor
endfunction
call s:Map('c', '<C-R><C-G>', 'fnameescape(fugitive#Object(@%))', '<expr>')
call s:Map('n', 'y<C-G>', ':<C-U>call setreg(v:register, fugitive#Object(@%))<CR>', '<silent>')