So sánh 2 file text hay source code bằng notepad++

Notepad++ là ứng dụng máy tính miễn phí, chạy trên Windows, dùng để soạn thảo văn bản / code (text or source code editor).

Đây là chương trình tuyệt vời để làm việc với một người làm trong nghề công nghệ thông tin như mình. Có thể kể cho các bạn vài chức năng mà mình sử dụng hàng ngày:

  1. so sánh 2 file để xem sự khác biệt:

  1. dùng để chỉnh sửa, hiển thị file XML:

và nhiều chức năng khác nữa.

So với những chương trình soạn thảo văn bản /code khác như: notepad của Microsoft, PsPad, EditPlus .. etc .. thì NotePad++ có ưu điểm hơn so với cách chương trình khác như: - miễn phí. - GUI cực kỳ đơn giản, ko rối mắt - chạy nhẹ - rất nhiều chức năng - cập nhập thường xuyên - hỗ trợ nhiều ngôn ngữ và hỗ trợ nhiều bảng mã hóa - bằng nhiều thứ tiếng: cả thái, indo, mã lai, hàn quốc, trung quốc, nhật bản ....

TUY NHIÊN: NOTEPAD++ lại ko có phiên bản tiếng Việt!!!!!

Nếu bạn có thời gian, xin mời bạn dùng thử NotePad++.

Và nếu bạn có thời gian, mong bạn hãy giúp NotePad++ dịch ra ngôn ngữ tiếng Việt. Đơn giản bạn chỉ cần dịch file sau đây english.xml ra tiếng Việt, rồi gửi tới NotePad++ website. (You can make Notepad++ to speak your mother tongue - Just download english.xml and translate it into your language.) Nhưng việc này yêu cầu bạn phải biết thuật ngữ tin học trong tiếng Việt. Mình ko học công nghệ thông tin ở VN nên ko rõ mấy cái thuật ngữ này lắm, các bạn trong nước có điều kiện thì giúp đỡ nhé.

Chi tiết cụ thể nữa thì bạn có thể tham khảo thêm ở đây để giúp NotePad++ có phiên bản tiếng Việt: http://notepad-plus-plus.org/contribute/binary-translation-howto.html

Notepad++ is a free, open-source code and text editor jam-packed with many features for casual users and programmers. It supports various programming languages with custom syntax highlighting, auto-completion, and more.

The inclusion of sophisticated editing tools, user-defined style options, and support for dozens of plugins is the icing on the cake. Despite all these, Notepad++ doesn't come with a diff tool to let you compare files.

Fortunately, Notepad++ plugins enable you to make up for any missing features. One such powerful plugin is the Notepad++ Compare plugin, which lets you see the visual difference between two files.

1. Install Plugins Admin for Notepad++

Notepad++ Plugins Admin is a repository of plugins that extend the functionality of Notepad++. You can use this feature to browse the repository and install plugins such as Compare for Notepad++.

Plugins Admin is not installed by default, and you have to check it in the Notepad++ installation wizard. If you've installed Notepad++, albeit without Plugins Admin, you can safely uninstall the program without losing your data. Once you've done that, you can reinstall Notepad++ with Plugins Admin.

So sánh 2 file text hay source code bằng notepad++

When installing Notepad++, be mindful of the settings for Plugins Admin. On the Choose Component screen, make sure to select the Custom option from the dropdown list, then check Plugins Admin. Many users skip the installation steps. If you do so, Plugins Admin will not install.

If your Notepad++ doesn't have Plugins Admin, and you're reluctant to reinstall the program, you can manually install the Compare plugin. In that case, skip this step and move on to the final part of the next step.

2. Install the Compare Plugin for Notepad++

You can use the Plugins Admin to install, update, or remove plugins. A revamped version came into effect in version 7.6 and above. It's better if you update Notepad++ to get the best possible experience.

So sánh 2 file text hay source code bằng notepad++

The Compare plugin is included in Plugins Admin, and you can easily install it from there:

  1. Launch Notepad++.
  2. Navigate to Plugins > Plugins Admin.
  3. In the Plugins Admin window, type Compare in the search bar.
  4. Check Compare, then click Install.

So sánh 2 file text hay source code bằng notepad++

Notepad++ will restart after installing the plugin. You should now see Compare in the Plugins menu.

Install the Compare Plugin Without Plugins Admin

You can also manually install Notepad++ plugins without Plugins Admin. To do this, you'll need to simply download the plugin's file and move it to the Notepad++ plugins folder.

As of now, you can download the latest iteration of this plugin (version 2.0.2) from the Compare plugin's GitHub. This particular release is compatible with Notepad++ 8.2.2 and later. If you're using the older version of Notepad++ and have no plan to upgrade the app, use version 2.0.1. Both 32-bit and 64-bit versions are available.

  1. Download the Compare plugin from GitHub.
  2. Extract the file.
  3. Copy the content. This will be a .dll file and a folder containing two more files.
  4. Go to the Notepad++ installation folder.
  5. Open the Plugins folder.
  6. Create a new folder and name it ComparePlugin. The folder's name should be identical to the .dll file's name.
  7. Paste the files in the new folder.

So sánh 2 file text hay source code bằng notepad++

Now, launch Notepad++ and go to the Plugins menu. You should see Compare there! If you already had Notepad++ open, close it and open it again.

3. Compare Two Files in Notepad++

The compare plugin assumes you want to compare an old version of your work to the new version. The plugin uses the old file as a comparison reference.

Open the two files you want to compare in Notepad++. To compare the two files, go to the Plugins menu, open Compare, and then select Compare.

So sánh 2 file text hay source code bằng notepad++

The Compare plugin will now put the files side by side and highlight their differences. You can set any open file as the reference with Compare > Set as First to Compare.

Colors and Symbols

The Compare plugin uses various colors and symbols to denote the changes in your file. The difference can be added, deleted, moved, or changed between lines.

So sánh 2 file text hay source code bằng notepad++

  • Added (+): The line only exists in the new file and not in the old one. The highlight color is green.
  • Deleted (-): The line does not exist in the new file and is only present in the old file. The highlight color is red.
  • Moved: The line appears at a different location in the other file. The highlight color is blue.
  • Changed: Most of the line is identical in both files. You'll see any changes highlighted in orange.

The Compare > Detect Moves option allows you to show or hide icons for the differences between the files.

The navigation bar on the right side of Notepad++ is helpful for quickly navigating big files and finding differences. In a big file, navigating the whole file top-up and down to find the difference is difficult and time-consuming. The navigation bar fulfills the dual role of both a sitemap and a bookmark browser.

So sánh 2 file text hay source code bằng notepad++

Click any area to scroll through your file. Since the navigation bar uses the same convention for colors and symbols, you'll quickly identify the changes with a glance.

View Modes

By default, when you compare two files, Notepad++ displays them in a vertical double-view mode. You can change the view mode by right-clicking the gripper—the middle border between the two files—and choosing Rotate to the right or Rotate to the left.

So sánh 2 file text hay source code bằng notepad++

This splits the window horizontally or vertically. If you continue rotating, your old file appears on the left, and the new file appears on the right.

4. Explore the Settings and Features

When you select Compare from the Plugins menu, it'll expand to display all the commands and options. The menu also lists keyboard shortcuts for those commands.

The Notepad++ Compare plugin offers many features similar to other diff tools used for file comparison. Navigate to Compare > Settings to explore the settings you can tweak.

So sánh 2 file text hay source code bằng notepad++

  • Main Settings: The options listed here let you customize the file positions. First is determines whether you're comparing the old or new file. Old file position allows you to position the old file at the left or right view (top/bottom in vertical split). Single-view default lets you compare the active file in a single-view mode with the previous or next file.
  • Color Settings: This option allows you to set the color for Added, Deleted, Moved, and Changed lines. You can choose a different color, change the highlight color, and the highlight transparency.
  • Warn about encodings mismatch: This shows you a warning message when comparing two files with different encodings, such as ASCII and Unicode.
  • Wrap around diffs: Determines whether running the Next command after reaching the last diff should go to the first diff.
  • Go to first diff after re-compare: When unchecked, the caret position will not change after you re-compare the files.

So sánh 2 file text hay source code bằng notepad++

There's an additional Ignore Spaces setting in the Compare menu. Checking this will ignore the difference in spaces. This might be useful if you're editing text strings; however, it would be best to uncheck this option for better output when comparing codes.

The Compare menu also gives you access to two practical features: SVN Diff and Git Diff. These features simplify comparing the current file version with a local Git/SVN database, which is particularly useful for reviewing changes made by collaborators while coding.

Discover Differences With Notepad++

Notepad++ is a feature-packed code and text editor app, but it lacks a compare feature. The good news is that you can customize Notepad++ to any level depending on your needs and expand it with plugins.

The Compare plugin is a solid example that demonstrates the power of plugins. The plugin adds the absent comparison feature to Notepad++, allowing you to compare and analyze your files. With the Compare plugin, Notepad++ becomes an even more comprehensive and versatile tool for your text and code editing endeavors.