Search code examples
vimgit-workflowvim-fugitive

vim-fugitive automatically gdiff on enter from gstatus


When using vim-fugitive if you issue :Gstatus it splits the screen and gives you the would be git commit editor and you can move over different files that have changes and press enter to see them in the other half of the screen. I believe it is like issuing :Gedit .

I then need to issue a :Gdiff manually to split the editor in half and see the side by side diff of the file to review and or stage it.

My question is is there a way to make it automatically go to :Gdiff when I press enter, while my cursor is on a file name that has changes.

Basically trying to save some time when going through a large list of files.


Solution

  • You can use D or dd inside the :Gstatus window to run :Gdiff on the file under the cursor. See :h :fugitive-:Gstatus or use g? inside the :Gstatus window.

    For additional help you may wan to look at Vimcasts, which has some very nice fugitive.vim series.