How can I configure GitHub's Atom to make it automatically set a particular syntax highlighting to filenames based on name and/or extensions?
Specifically I want it to automatically set Ruby syntax highlightning to Cocoapods' Podfile
s.
How can I configure GitHub's Atom to make it automatically set a particular syntax highlighting to filenames based on name and/or extensions?
Specifically I want it to automatically set Ruby syntax highlightning to Cocoapods' Podfile
s.
To add to Maurice Kelly's answer (my reputation is too low to comment) This is now documented at:
https://github.com/atom/flight-manual.atom.io/blob/681c7fe6e69f1f64396ecadfde1323a01e7f5b96/book/02-using-atom/sections/06-customizing.asc
As of this writing, there is no way to do this short of submitting a PR to the language-ruby package or creating your own fork of the language-ruby package.
There is a bug tracking this issue here: https://github.com/atom/atom/issues/1718
Anyone arriving here looking to add support for template files in php e.g. .tpl, the folloing works in atom 1.10.2. I do not have previous versions so I can't say about earlier versions.
Add this in your config (config.cson) after core:. I added it after
audioBeep: false
line.Documentation made me go around in circles. Several articles wrongly mention
source.php
where as it should betext.html.php
Just getting started with atom coming from npp++ basically as I have struggled with snippet support there and hope atom can do a good job.
As of Atom 1.0.8 this is now possible without the
file-types
package, using a core feature. To achieve this, open theconfig.cson
file, and add a section like the following:"*": # Other config core: customFileTypes: "source.ruby": [ "Podfile" ]
There is guidance on finding the language scope name here: https://flight-manual.atom.io/using-atom/sections/basic-customization/#finding-a-languages-scope-name
This is now possible with thefile-types
third-party package. I used the following syntax:"*": # Other config "file-types": "^Podfile$": "source.ruby"
This should be placed in the
config.cson
file.Here's an excerpt from the readme:
file-types package
Specify additional file types for languages.
Extension Matchers
Drop the dot before the extension to use extension matchers.
For example, you can associate
.ex_em_el
withtext.xml
in yourconfig.cson
as follows:'file-types': 'ex_em_el': 'text.xml'
RegExp Matchers
You can match with regular expressions, too. Most JavaScript regular expressions should work; but, the system looks for a dot (
.
), a caret (^
) at the start, or a dollar ($
) to identify RegExp matchers.For example, you can associate
/.*_steps\.rb$/
withsource.cucumber.steps
in yourconfig.cson
as follows:'file-types': '_steps\\.rb$': 'source.cucumber.steps'
NOTE: Extension Matchers take priority over RegExp Matchers.