7

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.

2
  • 1
    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. Sep 24, 2021 at 13:07
  • 1
    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.
    – Fabio
    Sep 24, 2021 at 13:14

1 Answer 1

7

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.

3
  • 1
    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?
    – Fabio
    Dec 19, 2022 at 10:41
  • 1
    There 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
    Feb 22, 2023 at 20:23
  • @Fabio Check that diff tools (kdiff3, kompare, meld) in the PATH - Kate editor compare option on Win 10 : r/kde Apr 15 at 2:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .