Set the syntax of files in your project automatically when they are opened

atom-package, editor-plugin, syntax
apm install atom-syntax@0.3.0


Atom Syntax

Greenkeeper badge Build Status Code Quality David apm apm apm


$ apm install atom-syntax

Or, Settings → Install → Search for atom-syntax

What is atom-syntax?

atom-syntax is a plugin for the Atom editor that will automatically set the syntax for files in your project based on .atomsyntaxrc config files. Sometimes, due to plugins or non standard file naming, the syntax auto detect feature doesn't always guess the correct syntax. This plugin will help solve that annoyance with a simple json file.

Example file

This file would make all .h files in the project C syntax, except for those in the lib folder, which would be C++ 14. Any files within the test directory would be ignored

  "root": true,
  "syntaxes": {
    "lib/**/*.h": "c++14",
    "*.h": "c"
  "ignore": [


Config files can be placed anywhere in a project and those settings will apply to any files, including those in sub directories of the directory the config is placed in. Config is read all he way up to either the project root, or until a config file is found with root set to true. Syntaxes are read from top to bottom until a match is found, so it is wiser to place more specific items at the top so they are not overriden by the catch-alls. Files can be ignored by specifying a path or glob pattern within the "ignore" array.


  • root - (true|false)

Determines whether config should be read from parent directories

  • syntaxes - object

Contains the list of "glob": "syntax"

  • ignore - array

Contains the list of ignored paths or globbing patterns


Minimatch is used to match file paths against globbing patterns. Any patterns obviously only apply to siblings or children of a config file. There are 2 exceptions for globbing and these are:

  • * - All files

This glob will apply to all sibling and child files.

  • *.ext or *.{ext1,ext2} - All files matching extension

This glob will apply to all sibling and child files of the specified extension(s). If you need to apply to files specifically in the same directory as the config file you can use ./*.ext


Syntaxes are first searched first by exact name, then by exact scope name, so both c++ and source.cpp are valid. There is auto resolve functionality built in to the plugin but it hasn't yet been enabled, as more testing is required.


Ignores are only applied if a config file containing them is reached during the config reading process. So a syntax pattern in a config file closer in the directory tree will override an ignore pattern further up the directory tree.


Please read the contributing guide for more details about getting involved.


For licensing information, see UNLICENSE. Please have a look at the unlicense website if you plan to contribute.