I've got vim setup as my external diff tool:
[diff]
external = git_diff_wrapper
#!/bin/sh
vimdiff "$2" "$5"
Say I have 300 files that have been modified; via bash, I type "git diff". It launches 300 vimdiffs sequentially, how do I abort it?
Just kill the parent process. Open up a terminal, use
pstree -p
to find the process ID (PID) of thegit
process, thenkill -9
it. On my system, it looks something like this:Not exactly elegant, but it works. On your system,
pager
will probably be something different, but it will havegit
as a parent process.If stopping the process is not enough, killing the shell itself (in which you launched the
git diff
) might be more effective.See also Git Diff with Vimdiff
But if you still want the modified
git diff
, agit status
might help before launching it ;)And you can setup a function to get the old
git diff
behavior if needed:Use :cquit to exit vim with an error code. Git will detect the error and stop opening new vimdiffs. You'll probably want to create a mapping for it in your .vimrc:
Then just hit Q to early abort from a git diff run.
In order for this to work you must edit your gitconfig: