Komodo indentation settings

Posted by toddw on 2013-06-12 07:36
OS: All / Any | Product: Komodo | tags: indentation tab spaces

How does Komodo determine indentation settings?


There are a number of preferences that have an affect on Komodo's indentation behaviour. These preferences can be changed on a global, project and file level (3 different places), with the per-file preferences having the highest priority, global preferences the lowest priority.

The most important setting is:

  • Editor > Indentation > Allow file contents to override Tab and Indentation settings
    With this enabled, when Komodo first opens the file, Komodo will determine the indentation from the existing file contents - which will then override any other indentation setting you have set in your preferences. Note that Komodo will remember these determined indentation settings after you open/close a file (so it doesn't have to determine it again next time), so changing the global/project indentation settings may not affect these determined/remembered indentation settings, in such a case you'll need to edit the per-file indentation preferences.

When Komodo is not determining the indentation from the file contents (i.e. preference above is disabled), or when creating new files, Komodo will then use the following preferences to set indentation:

  • Editor > Indentation > Prefer Tab characters over spaces
    When performing indentation (i.e. tab, auto-indentation), Komodo will use this setting to determine if it uses a real tab character, or a number of space characters (indent width is affected by settings below).
  • Editor > Indentation > Number of spaces per indent
    When "Pref tab over spaces" is disabled, this sets the number of spaces inserted for each Komodo indentation operation. When "Pref tab over spaces" (above) is enabled and this value is less than the tab width (below), you'll get indentation that uses a mix of tab and space characters.
  • Editor > Indentation > Width of each Tab character
    This is the width used when displaying a raw tab "\t" character (i.e. number of columns).

dougplant | Sat, 2017-04-29 22:02

Sometimes a file open in the editor will become confused as to what the desired indentation is. No amount of setting the indentation to the desired depth (local, file-type, nor global) will fix it. But I just found that if I set it to something different, then set it back to the desired width it resumes normal operations, aside from some manual clean-up.