Ben G
Ben G

Reputation: 26771

Setting up Notepad++ Compare as the diff tool in git?

Is there an easy way to setup Notepad++'s Compare plugin as the diff tool for Git on Windows? I'm not sure whether it can be called from the command line so maybe not.

Upvotes: 17

Views: 23850

Answers (3)

Tare
Tare

Reputation: 616

Since ComparePlus is out, it is actually easily possible to set it up as the git difftool.

ComparePlus is the successor of Compare, I set it up with version 1.1 installed from the Plugins Admin.

In your .gitconfig file, add the following lines (adjust the path to notepad++.exe, if you installed it elsewhere):

[diff]
tool = npp_compareplus

[difftool]
prompt = false

[difftool "npp_compareplus"]
cmd = \"C:\\Program Files\\Notepad++\\notepad++.exe\" -multiInst -nosession -pluginMessage=compare \"$REMOTE\" \"$LOCAL\"

-multiInst will start the diff in a new window, -nosession will open the new window without any other files open of your old/other session and -pluginMessage=compare tells npp to use the ComparePlus and let's it know of the arguments for the local/remote file.

Upvotes: 2

ufo
ufo

Reputation: 1642

I've just posted a solution to a similar question over here. Btw, one of the main points in preferring N++ as a diff viewer is, for instance, that if you're anyway handling Git-managed code in N++, then you can always directly "Compare against GIT base" (v1.5.6.3!). Another reason is of course looking at a diff in a "real" editor with syntax highlighting and all the other well known goodies at hand.

Upvotes: 3

ajcl
ajcl

Reputation: 381

As far as I know, Notepad++ doesn't allow custom command-line options for its plugins, so it would be a tad tricky to do so. You would need to create a wrapper script for it or call the executable directly. In my humble opinion, not worth it given that there are some very nice options for diff tools out there.

In any case, git difftool allows you to specify what exactly you'd like git to use for diff. You'll add this to your .gitconfig file:

[diff]
tool = araxis // enter your tool of choice here, Araxis is just an example

If you'd like to read more about it, here's a link to the man page: http://www.kernel.org/pub/software/scm/git/docs/git-difftool.html

Upvotes: 6

Related Questions