28

When using vimdiff with git and lots of changed files, vimdiff will open each file sequentially. It opens up the next file once you have closed the current file.

But what if I just want to break out of the whole diff process and also do not want to have coming diffs open?

How can I stop all diffs when using vimdiff?

lockdoc
  • 1,539
  • 1
  • 18
  • 31

2 Answers2

44

OK, I found it.

in .gitconfig:

[difftool]
    # Be able to abort all diffs with `:cq` or `:cquit`
    trustExitCode = true

Then inside vim just enter :cq or :cquit. This will exit vim with error codes and git has been told to rely on the error codes with trustExitCode.

lockdoc
  • 1,539
  • 1
  • 18
  • 31
10

How can I stop all diffs when using vimdiff?

Probably no need to customize your .gitconfig. Use the vim commands instead:

:qa close all (without saving)
:wqa save all then quit

For both commands you can force the action by adding the ! at the end:

:qa! force quit all (without saving any modifications)
:wqa! force quit all (force saving your modifications)

In vim check :help :qa

xaa
  • 818
  • 13
  • 13