ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Simple​Syntax

by Nils Kvist ALL

Comment syntax for config files

Labels configfile, syntax

Details

  • 2017.12.131
  • github.​com
  • github.​com
  • 6 years ago
  • 2 minutes ago
  • 6 years ago

Installs

  • Total 605
  • Win 342
  • Mac 85
  • Linux 178
May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29
Windows 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

SimpleSyntax

This Sublime Text 3 package contains 4 simple syntax files. They only highlight and enable comments and is intended for use with configuration files.

Symbols

Another feature of SimpleSyntax is the possibility to add symbols/sections in your file. This is done by creating a comment where the first three characters are >> followed by an optional string. Then you can use Sublime Text's built in function to goto symbol (default keybinding is: ctrl+r).

Enabling the syntax

It is up to the user to enable the syntax, since many config files have the same name, but might have different comment types it is hard to do this by filename. Personally i use the package, ApplySyntax with the following preferences:

If installed manually:

"syntaxes": 
[
  {
    "syntax": "ssSemi/ssSemi",
    "rules": [{"contains": "syntax:ssSemi"} ]
  },
  {
    "syntax": "ssExcla/ssExcla",
    "rules": [{"contains": "syntax:ssExcla"} ]
  },
  {
    "syntax": "ssHash/ssHash",
    "rules": [{"contains": "syntax:ssHash"} ]
  },
  {
    "syntax": "ssDslash/ssDslash",
    "rules": [{"contains": "syntax:ssDslash"} ]
  }
]

If installed through package control:

"syntaxes": 
[
  {
    "syntax": "SimpleSyntax/ssSemi",
    "rules": [{"contains": "syntax:ssSemi"} ]
  },
  {
    "syntax": "SimpleSyntax/ssExcla",
    "rules": [{"contains": "syntax:ssExcla"} ]
  },
  {
    "syntax": "SimpleSyntax/ssHash",
    "rules": [{"contains": "syntax:ssHash"} ]
  },
  {
    "syntax": "SimpleSyntax/ssDslash",
    "rules": [{"contains": "syntax:ssDslash"} ]
  }
]

And a comment in the settings file that look something like this:
# syntax:ssHash

License

MIT License