Commit Graph

582 Commits

Author SHA1 Message Date
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
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
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
19d1c944db Remove unmerged files on :Gstatus U 2016-03-09 21:31:25 -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
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