Custom indentation settings in kate per file type

A little hard to find but actually very flexible. :slight_smile:

I wanted to have 2-space indents for YAML files only.

Ideally, open the filetype for which you want to configure the settings.

Go to SettingsConfigure KateOpen/SaveModels & Filetypes.

If you opened the file, its “Filetype” might already be detected in the dropdown, otherwise select it.

Now ignore the Indentation mode setting and instead add a Variable using the magic wand button to the right. You can set all kinds of settings including indentation width.

Click OK and restart.


Alternatively one can use an .editorconfig file (see

indent_style = space
indent_size = 2

Kate and many other editors use the settings in the editorconfig file.