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.
-
I'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'Sep 24, 2021 at 13:07
-
Thank 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.– FabioSep 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.
-
I 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?– FabioDec 19, 2022 at 10:41