Commit Graph

471 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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