Komodo indentation settings

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

How does Komodo determine indentation settings?

Answer: 

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).