I am using Kate text editor, and I would like to compare two files, and find (highlight) their differences. Maybe there is a plugin to do that? I would be open to solutions other than using Kate, e.g. a shell script, but I would like to integrate that somehow with Kate.
- 1I've seen good recommendations of Kompare, the KDE diff viewer. But I don't use it myself and I don't know if it has any kind of integration with Kate. What do you mean by “integrate that somehow” anyway? It's a really vague statement.Gilles 'SO- stop being evil'– Gilles 'SO- stop being evil'2021-09-24 13:07:25 +00:00Commented Sep 24, 2021 at 13:07
- 1Thank you @Gilles! I will have a look to Kompare. With the integration I mean something that allows me to do it while still in Kate, e.g. a script that I can launch in Kate's terminal. Or something that would open the results (different parts in the files, with line numbers) in Kate.Fabio– Fabio2021-09-24 13:14:28 +00:00Commented Sep 24, 2021 at 13:14
1 Answer
Using Kate 20.12.2, when you have at least two tabs open, you can right-click any tab and select "Compare with active document".
The choices I have in Debian 11 are "kdiff3", "kompare", and "meld". (These packages are not installed with the distro, and will need to be installed before they can be used.)
Alternatively, if you have a file open in Kate and the file is modified by another program, switching back to Kate will trigger a prompt that the file has been modified, and there will be a "View Difference" button that will compare with the previous version of the file.
- 1I ave moved to the Flatpak version of Kate, and now this doesn't work anymore... I still have meld installed, and the menu appears, when I right-click on the tab with two documents. However, I get a message: "The selected program can not be started. Maybe is not installed". I guess this has to do with the "sandboxing" of Flatpak. I have messed with some of the settings for Kate in "Flatseal" (the sandboxing manager for Flatpak", but I can't get meld back. Maybe I need to export an environment variable? but which one?Fabio– Fabio2022-12-19 10:41:57 +00:00Commented Dec 19, 2022 at 10:41
- 1There is a better answer now. Kate now comes with a built-in diff viewer. The context menu option noted in the answer now will now open that diff viewer. To be able to use an external diff tool there is another option below this one.Waqar– Waqar2023-02-22 20:23:11 +00:00Commented Feb 22, 2023 at 20:23
- 1@Fabio Check that diff tools (
kdiff3,kompare,meld) in thePATH- Kate editor compare option on Win 10 : r/kdeAnton Samokat– Anton Samokat2024-04-15 02:52:46 +00:00Commented Apr 15, 2024 at 2:52 - Thanks! i saw the help messge from File menu -> file actions -> compare which says
use tab bar context menu. it took me 5 minutes and a google search to figure out what it is.Yvon– Yvon2025-08-21 18:04:00 +00:00Commented Aug 21 at 18:04