I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose \"Open all with current extension as...\" then ch
It looks likes there's a brand new package has been released for this. https://atom.io/packages/language-ejs.
This is now in Atom core, you don't need that file-types package any more.
Where I work, we use .phl for a certain kind of PHP file. To tell Atom about this, edit config.cson
like so:
core:
customFileTypes:
"text.html.php": [
"phl"
]
themes: [
// snip
You can find this file at ~/.atom/config.cson
, or from the Settings window click the "Open Config Folder" button.
It's easy to get wrong, as evidenced by the many errors people made on the GitHub issue for the feature.
As Dave Andersen mentions in a buried comment, it is now possible to do this without any extra packages and it's documented here.
Edit: since the time I wrote this answer, this functionality has been added to Atom core, see this answer for details.
(https://atom.io/packages/file-types)
It does exactly what the title question asks for: you can define new file extensions for existing languages with a simple edit of the config.cson
file.
For example if you want to open all .jsx
files with javascript syntax, you need to add this to your config.cson
"*":
core:
customFileTypes:
"source.js": [
"jsx"
]
This maps all .jsx files to open with js syntax.
For individual files you can use the Grammar Selector; Ctrl+Shift+L to set which language you're using on that file. Not the same as auto-detect but useful for those times when you're using a file that you don't want to set a default for.