Syntax style file mapping

Opening files, 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. File 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 file extension level or the filename level, user custom styles are preferred than the bundled styles. And yet, if there are multiple corresponding styles, the first found style will be applied automatically.

File Mapping Conflicts

There is no conflicts among the bundled syntax styles. However, if user added their custom styles or modified the bundled styles, file mapping can conflict. You can see whether the mapping conflict exists from the “Show File Mapping Conflict” menu item in the Format pane in the Preferences. 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