Created
December 15, 2015 17:57
-
-
Save davidmles/bc748625e6e94d24a417 to your computer and use it in GitHub Desktop.
init.coffee for Atom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atom.workspace.observeTextEditors (editor) -> | |
path = editor.getPath() | |
return unless path? | |
fileTypes = | |
'.html.erb': 'text.html.ruby', | |
'.rb': 'source.ruby.rails' | |
for extension of fileTypes when \ | |
path.toLowerCase().endsWith(extension.toLowerCase()) and | |
(longestExtension ? "").length < extension.length | |
longestExtension = extension | |
return unless longestExtension? | |
g = atom.grammars.grammarForScopeName fileTypes[longestExtension] | |
return unless g? | |
editor.setGrammar g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment