7

I've configured Vim as git difftool in .gitconfig

[diff]
    tool = vimdiff

If there are changes in N files, i have to close vim (:qa) to see the next diff.

How do i navigate to the next/previous diff without quitting vim?

3
  • 1
    does this help you? stackoverflow.com/questions/8156493/git-vimdiff-and-dirdiff Commented Feb 5, 2013 at 12:39
  • Fugitive D command was helpful. Thanks Commented Feb 5, 2013 at 12:55
  • What version of Git do you use? Commented Feb 5, 2013 at 12:55

2 Answers 2

6

There is no way to tell vimdiff to go to the next file, because git difftool invocates vimdiff for each diff file.

So when you end vimdiff with qa, git diff executes vimdiff again with the next file. From vimdiff's perspective there is no next diff file.

You can suppress the prompt for launching vimdiff, which makes it less annoying:

git config --global difftool.prompt false

But, as you already found out yourself, the vim plugin vim-fugitive is the way to go. This excellent plugin offers various commands for diffing and merging.

Sign up to request clarification or add additional context in comments.

Comments

0

Found this helper script useful (not mine). https://gist.github.com/Osse/4709787

Download the script and set executable permissions.

❯ git config --global difftool.vimtabdiff.cmd '~/path/to/vimtabdiff.zsh $LOCAL $REMOTE'

And set an alias

❯ git config --global alias.dt 'difftool --tool vimtabdiff --dir-diff'                          

Now, the the files with differences each open in a new tab with git dt

]c and [c to move to next and previous diffs within the file. gt, gT to move to next and previous file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.