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
  • 7 years ago
  • 17 minutes ago
  • 7 years ago

Installs

  • Total 617
  • Win 349
  • Mac 89
  • Linux 179
Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25
Windows 0 1 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 0 0 0 0 0 1 0 0 0 0 0 0 0 0 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 0 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 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

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