Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git and vimdiff - close all files at once

Tags:

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?

like image 908
lockdoc Avatar asked Dec 03 '15 07:12

lockdoc


2 Answers

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.

like image 117
lockdoc Avatar answered Sep 20 '22 18:09

lockdoc


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

like image 35
xaa Avatar answered Sep 20 '22 18:09

xaa