Kate Modeline Editor
by Dominik • 2011-07-23 • Developers, Users • 9 Comments
As you may know, Kate supports the concept of document variables, also known as modelines. In short, document variables can be used to set Kate settings local to a file. For instance, this is useful for settings specific indenter options than the ones defined in Kate’s settings dialog. Assume you work on two projects, the first indents with spaces and the second with tabs, then you can simply add a modeline that contains the specific document variables that set the specific indentation properties.
While the concept is very mighty, it is not intuitive to use: You have to know the exact syntax and correct varialbes and their valid values.
To improve this for the next KDE release (v4.8?), Kate gained a variable / modeline editor this week:

If you click the Edit button, a list view pops up showing all valid document variables with the valid values. Right now, this editor is included only in the “Modes & Filetypes” config page. However, the idea is to support it in the context menu over a Kate modeline in the text editor area as well.
Wow, that looks nice. I wished a lot of configuration dialogs had their options for configuring text, ident and similar like this.
Supreme work, I hope this helps more people to understand the possibilities hidden in the Kate modelines
That popup desparately needs a proper alpha mask, though
. Have a look at the code behind KDevelop’s outline popup.
Great news, as you are working with modeline could you please have a look at https://bugs.kde.org/show_bug.cgi?id=125974 , a fix seems to exist https://svn.reviewboard.kde.org/r/1915/ but it has not been applied.
nice, very nice
as you talk about modelines: there exists a very annoying bug since many years in kate (encoding settings do not work)
https://bugs.kde.org/show_bug.cgi?id=125974
I leave that one for Christoph.
Great news! And there’s even a specification of mode-line variables now (been looking for this for a long time): https://projects.kde.org/projects/kde/kdebase/kate/repository/revisions/b3eb57233bd3504415167669e02c75c92841a98b/entry/part/variableeditor/variablelineedit.cpp
Uhm, the official specification is here:
- http://docs.kde.org/stable/en/kdebase-runtime/kate/config-variables.html
- http://kate-editor.org/2006/02/09/kate-modelines/