这篇文章将帮助您如何compare two files in Notepad++。无论您是想比较两个文本文件(compare two text files)以找出它们之间的差异,还是需要比较一个具有两个不同版本的编程文件,您都可以在Notepad++中完成。
如果在添加用于比较的两个文件中的任何一个中添加了任何新行(new line added),删除或删除(a line is deleted or removed)了一行,移动(line is moved)了一行,并更改了一行(line is changed)(例如在一行中添加或删除了某些单词或字母),则您可以看到那些变化。
对于添加的行、删除的行、更改的行等,差异会以不同的颜色突出显示。您还可以看到一个绿色的加号图标(plus icon with green color)和一个红色的减号图标,(minus icon with red color)表示在这两个文件中的任何一个文件中添加或删除的行。
在 Notepad++ 中比较两个文件
Notepad++没有内置功能来比较两个文件,但是您可以使用一个名为Compare的(Compare)free Notepad++ plugin来实现它。Notepad++的界面上并排显示了两个文件之间的差异。
Notepad++中比较两个文件的步骤:
- 打开记事本++
- 访问插件管理(Plugins Admin)选项
- (Search Compare)在插件管理(Plugins Admin)页面中搜索比较插件
- 安装插件
- 在记事本++中打开两个文件
- 访问(Access Compare)插件菜单下的比较插件选项
- 使用比较(Compare)插件的比较选项。
首先,使用其桌面快捷方式、Windows 搜索(Windows Search)框或开始(Start)菜单启动Notepad++
单击插件(Plugins)菜单,然后选择插件管理(Plugins Admin)选项。插件管理员(Admin)(以前称为插件管理器(Plugin Manager))页面将打开。
在插件管理(Plugins Admin)页面上,搜索比较插件。在搜索结果中,选择比较(Compare)插件,然后按安装(Install)按钮。将打开一个确认框。按该框中的“是”(Yes)按钮。
它将关闭并重新启动Notepad++,Compare插件将自动安装。
现在在Notepad++中打开两个要比较的文件。之后,单击插件(Plugins)菜单并访问比较(Compare)插件。您将看到以下选项:
- 设置为第一个比较:(Set as First to Compare:)使用此选项,您可以使前景文件成为第一个文件(或旧文件),您可以与在Notepad++
- 比较:(Compare:)此选项有助于比较第一个文件和第二个文件。您必须转到第二个文件,然后使用此选项进行比较。两个文件之间的任何差异,例如添加或删除的行、更改的行等,都在Notepad++
- 清除主动比较
- Clear All Compares:关闭所有文件的比较
- SVN Diff 和 Git Diff:(SVN Diff and Git Diff:)将文件的当前版本与本地Git/SVN数据库进行比较。有助于(Helpful)编码文件。
- 忽略空格(Ignore Spaces)进行比较。为了获得更好的输出,您应该取消选中此选项
- 检测(Detect)移动选项以显示/隐藏添加或删除行的图标
- 导航栏:(Navigation Bar:)此选项在比较期间在右上角提供导航栏。在比较大文件时很有帮助。您可以使用导航栏快速转到您正在比较的文件的特定部分,而不是手动滚动。
对于每个可供比较的选项,还有一个热键可以快速使用特定选项。根据您的需要使用比较选项。(Use)
比较插件设置
如果您想调整颜色设置以进行比较和主要设置,那么您可以访问此比较(Compare)插件的设置并根据您的方便进行自定义。使用比较(Compare)插件选项下的设置选项。(Settings)将打开一个单独的框。
使用该框,您可以使用您选择的任何颜色更改添加线的默认颜色、更改突出显示、移动线、更改线等。您还可以在 0 到 100 之间设置高光透明度级别。(highlight transparency level)
除此之外,设置框还可以让您显示/隐藏紧凑的导航栏,设置第一个文件的位置(左或右),环绕差异,完成完整比较后自动转到第一个差异等。
调整设置后,按OK保存更改。就这样。
这样您就可以在Notepad++中比较两个文本文件、编程文件等。希望这篇文章有帮助。
How to compare two files in Notepad++
This post will help you how to compare two files in Notepad++. Whether you want to compare two text files to find the differences between them or you need to compare a programming file with two different versions, you will be able to do it within Notepad++.
If there is any new line added, a line is deleted or removed, a line is moved, and a line is changed (like some word or letter is added or removed in a line) in any of the two files added for comparison, you can see those changes.
The differences are highlighted with different colors for added lines, deleted lines, changed lines, etc. You can also see a plus icon with green color and a minus icon with red color for a line added or removed in any of those two files.
Compare two files in Notepad++
Notepad++ doesn’t come with a built-in feature to compare two files, but you can use a free Notepad++ plugin called Compare to make it possible. It shows the differences between the two files side by side on the interface of Notepad++.
Here are the steps to compare two files in Notepad++:
- Open Notepad++
- Access Plugins Admin option
- Search Compare plugin in Plugins Admin page
- Install the plugin
- Open two files in Notepad++
- Access Compare plugin options under Plugins menu
- Use the comparison options of the Compare plugin.
At first, launch Notepad++ using its desktop shortcut, Windows Search box, or Start menu.
Click on the Plugins menu and then select the Plugins Admin option. Plugins Admin (earlier known as Plugin Manager) page will open.
On the Plugins Admin page, search for compare plugin. In the search results, select the Compare plugin, and press the Install button. A confirmation box will open. Press the Yes button in that box.
It will close and restart Notepad++ and the Compare plugin will be installed automatically.
Now open two files in Notepad++ that you want to compare. After doing that, click on the Plugins menu and access the Compare plugin. You will see the following options:
- Set as First to Compare: Using this option, you can make the foreground file the first file (or old file) with which you can compare any other background file (or new file) opened in Notepad++
- Compare: this option helps to compare the first file with the second file. You have to go to the second file and then use this option for comparison. Any difference such as line added or removed, the line changed, etc., between two files, are highlighted and visible in Notepad++
- Clear Active Compare
- Clear All Compares: to close the comparison of all files
- SVN Diff and Git Diff: to compare the current version of a file with the local Git/SVN database. Helpful for coding files.
- Ignore Spaces for comparison. For better output, you should uncheck this option
- Detect Moves option to show/hide icons for added or removed lines
- Navigation Bar: this option provides a navigation bar on the top right part during the comparison. It is helpful when you are comparing large files. Instead of scrolling manually, you can use a navigation bar to quickly go to a particular part of files that you’re comparing.
For each option available for comparison, there is also a hotkey to quickly use a particular option. Use comparison options as per your needs.
Compare Plugin Settings
If you want to adjust color settings for comparison and main settings, then you can access Settings of this Compare plugin and customize them as per your convenience. Use the Settings option available under Compare plugin options. A separate box will open.
Using that box, you can change the default color for an added line, change highlight, moved line, changed line, etc., with any color of your choice. You can also set a highlight transparency level between 0 to 100.
Apart from that, the settings box also lets you show/hide the compact navigation bar, set the position of the first file (left or right), wrap-around diffs, automatically go to first difference after full comparison is done, etc.
When Settings are adjusted, press OK to save the changes. That’s all.
This way you can compare two text files, programming files, etc., in Notepad++. Hope this post is helpful.