Map files to syntax styles in CotEditor

When opening a file, CotEditor detects the document type and applies the corresponding syntax style automatically.

The File Mapping definitions in each syntax style are used for this detection.

Priority order of file mapping

CotEditor detects the corresponding syntax style in the following order:

  1. Filename extension
  2. Filename
  3. Shebang in the first line of the document
  4. XML declaration
  5. None

When there are multiple syntax styles in the same level like the filename extension level or the filename level, custom styles are prioritized over the bundled styles. And yet, if there are multiple corresponding styles, the first found style will be applied automatically.

File mapping conflicts

There are no conflicts among the bundled syntax styles. However, if you added custom styles or modified the bundled styles, the file mapping can conflict. You can see the existence of mapping conflicts from the Show File Mapping Conflict command in the Format pane in the Settings. If the menu item is gray-out, it means: there is no conflict.

You can just leave the file mapping conflicts as long as you can open files with your expected syntax style. There is no side issue.

See also