3

I use meld for graphical diff comparisons.

I would like to associate .tpp as a C++ source file for syntax highlighting purposes.

How do I do this?

Steve Lorimer
  • 473
  • 1
  • 7
  • 20

2 Answers2

3

Meld uses the Gnome project's GtkSourceView component for syntax highlighting.

In order to change the file associations, edit the following file:

/usr/share/gtksourceview-3.0/language-specs/cpp.lang

Edit the "globs" section under language/metadata/property and add ;*.tpp

<property name="globs">*.cpp;*.cxx;*.cc;*.C;*.c++;*.tpp</property>
                                                 ^^^^^^
Steve Lorimer
  • 473
  • 1
  • 7
  • 20
  • Is that still the case for Meld 3.18.0? Asking because `/usr/share/gtksourceview-3.0/language-specs/javascript.lang` lists `*.js;*.node` in the globs, yet Meld highlights `.mjs` files just fine. – Dan Dascalescu Jan 09 '19 at 02:44
  • I'm using Meld on Windows but found this question while looking for the same info. For Windows users, these files are in `C:\Program Files (x86)\Meld\share\gtksourceview-3.0\language-specs` (for Meld 3.20.4). – kwc Oct 16 '21 at 01:22
3

You can create custom lang files in

~/.local/share/gtksourceview-3.0/language-specs/

If the directory does not already exist, you can create it. Then copy the lang file you want to use as a template from

/usr/share/gtksourceview-3.0/language-specs/
Aaron Swan
  • 131
  • 2