Gstatus changed behaviour in vim-fugitive
Asked Answered
L

2

6

I've been using vim with the excellent fugitive plugin for a few months now. But today, for reasons that I can't work out, the :Gstatus command has changed behaviour.

It still opens up a "git status"-like screen, which does respond to "R" to refresh it. But when I go to a "modified: ..." listing and hit "D", instead of getting two split windows showing the diff, I just get the "git diff" output. Also, hitting "-" on the modified file does not stage it at all.

It's like all the power has vanished from this mode ?

I also suspect the "git status"-like screen it's opening is in fact the exact output from git status. It's also got different formatting than before; the top line is green, and the next line bolded with a red background - this is the same colorscheme as I get for git commit messages (which highlight an error if you don't leave the second line blank). Not sure if this helps or just confuses the issue...

In line with a comment below, I've checked the key mappings on that screen:

:verbose nmap D
> n  D           *@:<C-U>execute <SNR>72_StageDiff('Gvdiff')<CR>                                                                                                                                                       
> Last set from ~/.dotfiles/vim/bundle/vim-fugitive/plugin/fugitive.vim 

:verbose nmap -
> n  -           *@:<C-U>silent execute <SNR>72_StageToggle(line('.'),line('.')+v:count1-1)<CR>                                                                                                                        
> Last set from ~/.dotfiles/vim/bundle/vim-fugitive/plugin/fugitive.vim

Anyone know what mistake I'm making, or what this other status-like screen I'm getting is ?

Lengthwise answered 5/12, 2013 at 1:15 Comment(6)
Please take a look at :verbose nmap <buffer> and make sure D and - are mapped to Fugitive's <Plug> mappings. Please also make sure you have the latest version of fugitive.Intemperate
They seem to map correctly - have added the values in the main descriptionLengthwise
SO is not an issue tracker, use fugitive's issue tracker.Stigmatize
This was working for me two days ago, and is broken now. I've not changed my version of vim or vim-fugitive. So I'm fairly sure this is a "user error" rather than a problem with fugitive.Lengthwise
Did you recently upgrade to Git 1.8.5 ? The status output has changed and it's not compatible with older versions of vim-fugitive because it lacks the # prefix. Try updating your vim-fugitive.Zwickau
Kamil - that was it ! Thanks a lot. I'm going to add it as an answer in case others come across this post, if that's OK.Lengthwise
L
6

In this case, my version of Git had been updated by a regular system update, whereas my version of vim-fugitive had not been updated for some time.

This meant the new Git status format was not compatible with the older version of vim-fugitive's expectataions.

I use vundle to manage my vim plugins, so the solution in vim was to run

:BundleInstall!

This updated ALL my plugins of course, so hopefully won't cause more problems. But for now, my :Gstatus command in vim is working nicely again.

Thanks to Kamil Kisiel for this answer

Lengthwise answered 9/12, 2013 at 0:43 Comment(1)
+1 Re-installing vim-fugitive fixed my issue after I upgraded to git 1.8.5.1Lechner
E
0

Just in case anyone else has the same problem as I had: If you set up a custom core.commentchar in your gitconfig, those mappings of fugitive won't work anymore.

There is a pull request open on GitHub that provides a partial fix for the issue (https://github.com/tpope/vim-fugitive/pull/689) - haven't tried it myself though.

Erine answered 27/11, 2015 at 14:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.