How to compare two files in Notepad++
Asked Answered
C

8

241

I want to compare values from two different files.
In Notepad++ version 5.0.3 we had shortcut button Alt+d but in version 6.6.8 I cannot find any option to compare.

Also let me know which version is most stable.

Cursive answered 15/4, 2015 at 4:33 Comment(0)
G
252

There is the "Compare" plugin. You can install it via Plugins > Plugin Manager.

Alternatively you can install a specialized file compare software like WinMerge.

Giovannagiovanni answered 15/4, 2015 at 18:47 Comment(9)
WinMerge is the way to go (even while being fan of Notepad++)Heavyweight
@Heavyweight Yes that is true. I installed both programs and created a NppExec script to start winmerge. If there is a split view, winmerge loads the file from the left view and compares it to the one on the right, with one click in Notepad++. The best of both worlds :)Giovannagiovanni
@LarsFischer That sounds awesome. I managed to download all the plugins and WinMerge. But I don't really know how I would go about the NppExec script to start winmerge. Would you mind sharing your script? We could meet up in a Chat. Thanks.Wrongly
@Wrongly You would install e.g. WinMerge, then install the NppExec Plugin for Notepad++. Then create a script via Plugins -> NppExec-> Execute ... with this content: npp_console keep npp_save "$(LEFT_VIEW_FILE)" npp_save "$(Right_VIEW_FILE)" npp_run "C:\Program Files (x86)\WinMerge\WinMergeU.exe" "$(LEFT_VIEW_FILE)" "$(Right_VIEW_FILE)" ( four lines) That will run WinMerge with left and right views file (or the current file if only one view is active). Save the script under some name and see https://mcmap.net/q/118985/-notepad-adding-a-new-shortcut-for-an-existing-command for assigning a shortcut to it.Giovannagiovanni
@LarsFischer Thanks a lot for the script! It works like a charm. However, I couldn't follow your instructions for assigning it to a shortcut. Every time after I saved the script, added it as a Menu item and closed and reopened N++, my script is gone. I tried opening N++ as admin and even tried another version of NppExec. Have you ever encountered something like this? I couldn't find anything online. Also my N++ uses %appdata% so I guess it's not a portable version. What else could it be?Wrongly
@Wrongly No I have never had issues with NppExec not storing my scripts. When you run this NppExec script: npp_run $(PLUGINS_CONFIG_DIR) it should open the config directory in explorer. There you find should find a file npes_saved.txt. It contains the scripts saved in NppExec. Does it exist? Has this file strange access rights?Giovannagiovanni
@LarsFischer The whole directory plugins in AppData\Roaming\Notepad++ was missing. I created it and also added the config folder. I even created a npes_saved.txt file (not sure if this was necessary). Restarted N++; and BOOM! All other files were created. Then I could follow the rest of your instructions and I'm all set - awesome! The Folder should have been created by NppExec but I did struggle during the installation so I guess I messed something up there. However, thanks for bearing with me and helping me out, I really appreciate it! It really is the best of both worlds. :)Wrongly
The OP asked how to do this using Notepad++, many answers diverge.Dissatisfaction
@ConradB The Compare Plugin mentioned is a notepad++ plugin. This is the way to do it using notepad++ other than open both files and compare manually. But I have to admit that specialized tools like winmerge or kdiff3 are better.Giovannagiovanni
P
82

Update:

  • for Notepad++ 7.5 and above use Compare v2.0.0
  • for Notepad++ 7.7 and above use Compare v2.0.0 for Notepad++ 7.7, if you need to install manually follow the description below, otherwise use "Plugin Admin".

I use Compare plugin 2 for notepad++ 7.5 and newer versions. Notepad++ 7.5 and newer versions do not have plugin manager. You have to download and install plugins manually. And YES it matters if you use 64bit or 32bit (86x).

So Keep in mind, if you use a 64-bit version of Notepad++, you should also use a 64-bit version of the plugin, and the same is valid for 32-bit.

I wrote a guideline how to install it:

  1. Start your Notepad++ in administrator mode.
  2. Press F1 to find out if your Notepad++ is 64bit or 32bit (86x), hence you need to download the correct plugin version. Download Compare-plugin 2.
  3. Unzip Compare-plugin in a temporary folder.
  4. Import the plugin from the temporary folder.
  5. The plugin should appear under the Plugins menu.

Note:
It is also possible to drag and drop the plugin .dll file directly in the plugin folder.
64bit: %programfiles%\Notepad++\plugins
32bit: %programfiles(x86)%\Notepad++\plugins

Update Thanks to @TylerH for this update: Notepad++ Now has "Plugin Admin" as a replacement for the old Plugin Manager. But this method (answer) is still valid for adding plugins manually for almost any Notepad++ plugins.

Disclaimer: the link to this guideline refer to my personal website.

Primeval answered 4/3, 2018 at 19:10 Comment(2)
In case it was missed, step 4 import is done via the Settings menu > Import > import plugin(s).Supramolecular
It's far easier than this. Plugins > Plugin Admin > Tick Compare > Install (V 7.8.4 - 32 bit)Kegler
S
27

Update (2022-09-22): use the ComparePlus plug-in, and not the outdated Compare plug-in.

enter image description here

Demo:

  1. Open 2 files side-by-side
  2. Plug-ins -> ComparePlus -> Compare:

enter image description here

Features:

enter image description here


The Compare plug-in is no longer maintained:

Compare plugin will not be supported anymore (at least by me) because I consider it obsolete and because (as Peter Jones said) I am working on another plugin - ComparePlus that is Compare plugin’s successor.

For example, the Compare plug-in doesn't show the compared text clearly with dark mode:

enter image description here

Satinwood answered 23/9, 2022 at 3:25 Comment(0)
K
11

I give the answer because I need to compare 2 files in notepad++ and there is no option available.

So first enable the plugin manager as asked by question here, Then follow this step to compare 2 files which is free in this software.

1.open notepad++, go to

Plugin -> Plugin Manager -> Show Plugin Manager

2.Show the available plugin list, choose Compare and Install

3.Restart Notepad++.

http://www.technicaloverload.com/compare-two-files-using-notepad/

Kelter answered 13/2, 2018 at 10:1 Comment(2)
This seems to be the correct answer as it mentions that Notepad++ doesn't come with PluginManager directly and you have to first install that as @Kelter mentioned in that link. This was helpful.Convent
This is the only answer at linking a solution, how to actually use the plugin.Bevel
W
7

Alternatively, you can install "SourceForge Notepad++ Compare Plugin 1.5.6". It provides compare functionality between two files and show the differences between two files.

Link to refer : https://sourceforge.net/projects/npp-compare/files/1.5.6/

Wargo answered 5/5, 2016 at 10:30 Comment(3)
I believe that this is actually the same plugin that @LarsFischer mentionedSprouse
This is beneficial when you cannot download the plugin because of the access control matter.Kephart
Only 32-bit seems to not be rebuild recently either, sorry.Dissatisfaction
D
5

2018 10 25. Update.

Notepad++ 7.5.8 does not have plugin manager by default. You have to download plugins manually.

Keep in mind, if you use 64 bit version of Notepad++, you should also use 64 bit version of plugin. I had a similar issue here.

Deci answered 25/10, 2018 at 15:3 Comment(1)
Now it has a plugin manager againAufmann
S
2

If you are looking for the latest release of Compare, here it is:

https://github.com/pnedev/compare-plugin/releases/latest

Selachian answered 21/6, 2022 at 21:39 Comment(0)
R
0

If you installed Notepad++ with the Plugin Manager then its easy: open notepad++, go to Plugin -> Plugin Manager -> Show Plugin Manager and then search/install the Plugin „compare“. Restart Notepad++

Tutorial: https://youtu.be/8ESbIZbXI7I

If you do not have installed the Plugin Manager:

-Copy the contents of the zip file into Notepad++'s plugins installation folder (%Notepad++_program_folder%\Plugins). use the correct archive version based on your Notepad++ architecture - x86 or x64.

  • restart Notepad++
Rudich answered 20/4, 2022 at 12:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.