Skip to content

azhinu/grammar-mode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grammar-mode package

This is an Atom editor package to let the author of a source file add a comment to force the file to use a certain grammar (aka "mode" in EMACS) and show the appropriate syntax highlighting. This is needed on files with no extensions or files that start with one language but then are mostly another language (like react view files).

Installation

Enter the terminal command apm install grammar-mode or use the + Install button in the settings tab (ctrl-,) and search for grammar-mode.

Usage

Add a string with this format anywhere in the file, usually in a comment. EXTENSION should be a typical source file extension for the type of file that uses the grammar you want your file to use. The period at the beginning is optional and nothing is case-sensitive.

syntax=EXTENSION

Examples ...
  #syntax=coffee
  // syntax=js

or

syntax=grammar.name

Examples ...
  #syntax=source.yaml
  // syntax=source.

Checking manually

Normally the grammar-ext comment is detected and the syntax highlighting set when the file is loaded. If you add a comment and want to see the results immediately then you need to issue a command to check all the loaded files. This is done with the grammar-mode:check-all command which is bound by default to ctrl-shift-alt-M.

License

Grammar-mode is copyright Mark Hahn with the MIT license.

About

Atom editor package: Set grammar for file by adding mode comment, like EMACS

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 100.0%