My goal is to set Kate up to work properly on Python files but to use different settings (tabs not spaces) on other documents. I'm sure others are doing this, but I can't figure out a convenient solution. I appreciate any advice.

Kate has settings for indentation here:

  1. Click the Settings menu
  2. Click "Configure - Kate"
  3. On the right expand "Editor"
  4. Click "Indentation"

One option is "Default indentation mode". One choice for that setting is Python. However, I cannot find where to set (or even display) the options used for the Python choice.

Furthermore, it is not clear what is the interaction between "Default indentation mode" and the explicit settings for indentation on that page. Does one override the other?


There are multiple ways to achieve what you want. In order, Kate is doing the following:

  1. Kate reads the settings that are configured globally in the config dialog in the Indentation tab.
  2. Kate reads optional session data, i.e. if you use sessions and manually chose settings in a file, these settings should be restored again when opening the file.
  3. Kate reads the "Filetype" configuration: The filetype, also called mode, can be configured in Settings > Configure Kate > Open/Save > Modes & Filetypes tab. Choose your filetype, e.g. Scripts/Python and then add a modeline like this: kate: indent-pasted-text false; indent-width 4;
  4. Kate searches for document variables in .kateconfig files recursively upwards. If found, it will apply these settings
  5. Kate reads document variables in the document itself. So in a Python file, you can simply add a comment in the first or last 10 lines of the file and write e.g.:# kate: indent-pasted-text false; indent-width 4;

All this is also described in the Kate Handbook.

| improve this answer | |
  • The link in you post does not seem to work. I found an alternative here – Scz Jul 24 '15 at 8:25
  • Thanks, I updated the link to the 'katepart' handbook, since the Kate handbook and KWrite handbook now share this part. – dhaumann Aug 1 '15 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.