Browse Source

first commit

tags/1.0.0
budRich 2 years ago
commit
18d6102d07
15 changed files with 468 additions and 0 deletions
  1. +20
    -0
      DslashComments.tmPreferences
  2. +20
    -0
      ExclaComments.tmPreferences
  3. +22
    -0
      HashComments.tmPreferences
  4. +21
    -0
      LICENSE
  5. +40
    -0
      README.md
  6. +20
    -0
      SemiComments.tmPreferences
  7. +1
    -0
      messages.json
  8. +61
    -0
      ssDslash.sublime-syntax
  9. +20
    -0
      ssDslashsymbols.tmPreferences
  10. +61
    -0
      ssExcla.sublime-syntax
  11. +20
    -0
      ssExclasymbols.tmPreferences
  12. +61
    -0
      ssHash.sublime-syntax
  13. +20
    -0
      ssHashsymbols.tmPreferences
  14. +61
    -0
      ssSemi.sublime-syntax
  15. +20
    -0
      ssSemisymbols.tmPreferences

+ 20
- 0
DslashComments.tmPreferences View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.ssDslash</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>// </string>
</dict>
</array>
</dict>
</dict>
</plist>

+ 20
- 0
ExclaComments.tmPreferences View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.ssExcla</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>! </string>
</dict>
</array>
</dict>
</dict>
</plist>

+ 22
- 0
HashComments.tmPreferences View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.ssHash</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string># </string>
</dict>
</array>
</dict>
</dict>
</plist>



+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Nils Kvist

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

+ 40
- 0
README.md View File

@@ -0,0 +1,40 @@
# 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](http://facelessuser.github.io/ApplySyntax/) with the following preferences:

``` json
"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"} ]
}
]
```

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

## License

MIT License

+ 20
- 0
SemiComments.tmPreferences View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.ssSemi</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>; </string>
</dict>
</array>
</dict>
</dict>
</plist>

+ 1
- 0
messages.json View File

@@ -0,0 +1 @@
{"install": "README.md"}

+ 61
- 0
ssDslash.sublime-syntax View File

@@ -0,0 +1,61 @@
%YAML 1.2
---
name: ssDslash
fileTypes: []
scope: source.ssDslash

contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
prototype:
- include: comments

main:
- include: numbers
- include: strings
# - include: budsym

numbers:
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.ssDslash

strings:
- match: '"'
scope: punctuation.definition.string.begin.ssDslash
push: inside_string

inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.ssDslash
- match: '\.'
scope: constant.character.escape.ssDslash
- match: '"'
scope: punctuation.definition.string.end.ssDslash
pop: true

comments:
# Comments begin with a '//' and finish at the end of the line.
- match: '//'
scope: punctuation.definition.comment.ssDslash
push:
- include: budsym
- meta_scope: comment.line.double-slash.ssDslash
- match: $\n?
pop: true

budsym-terminator:
- match: '[ ]*(!*)[ ]*($\n?)'
captures:
1: punctuation.definition.heading.end.markdown
2: meta.whitespace.newline.markdown
pop: true
budsym:
- meta_include_prototype: false
- match: ' >>'
# - match: '(>{1,6})(?!>)\s*(?=\S)'
captures:
1: punctuation.definition.heading.begin.markdown
push:
- meta_scope: markup.heading.markdown
- meta_content_scope: entity.name.section.markdown
- include: budsym-terminator

+ 20
- 0
ssDslashsymbols.tmPreferences View File

@@ -0,0 +1,20 @@

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List</string>
<key>scope</key>
<string>source.ssDslash markup.heading - meta.whitespace.newline.ssDslash</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<integer>1</integer>
<key>symbolIndexTransformation</key>
<string>
s/\s*\/\/+\s*$//g;
</string>
</dict>
</dict>
</plist>

+ 61
- 0
ssExcla.sublime-syntax View File

@@ -0,0 +1,61 @@
%YAML 1.2
---
name: ssExcla
fileTypes: []
scope: source.ssExcla

contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
prototype:
- include: comments

main:
- include: numbers
- include: strings
# - include: budsym

numbers:
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.ssExcla

strings:
- match: '"'
scope: punctuation.definition.string.begin.ssExcla
push: inside_string

inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.ssExcla
- match: '\.'
scope: constant.character.escape.ssExcla
- match: '"'
scope: punctuation.definition.string.end.ssExcla
pop: true

comments:
# Comments begin with a '//' and finish at the end of the line.
- match: '!'
scope: punctuation.definition.comment.ssExcla
push:
- include: budsym
- meta_scope: comment.line.double-slash.ssExcla
- match: $\n?
pop: true

budsym-terminator:
- match: '[ ]*(!*)[ ]*($\n?)'
captures:
1: punctuation.definition.heading.end.markdown
2: meta.whitespace.newline.markdown
pop: true
budsym:
- meta_include_prototype: false
- match: ' >>'
# - match: '(>{1,6})(?!>)\s*(?=\S)'
captures:
1: punctuation.definition.heading.begin.markdown
push:
- meta_scope: markup.heading.markdown
- meta_content_scope: entity.name.section.markdown
- include: budsym-terminator

+ 20
- 0
ssExclasymbols.tmPreferences View File

@@ -0,0 +1,20 @@

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List</string>
<key>scope</key>
<string>source.ssExcla markup.heading - meta.whitespace.newline.ssExcla</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<integer>1</integer>
<key>symbolIndexTransformation</key>
<string>
s/\s*!+\s*$//g;
</string>
</dict>
</dict>
</plist>

+ 61
- 0
ssHash.sublime-syntax View File

@@ -0,0 +1,61 @@
%YAML 1.2
---
name: ssHash
fileTypes: []
scope: source.ssHash

contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
prototype:
- include: comments

main:
- include: numbers
- include: strings
# - include: budsym

numbers:
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.ssHash

strings:
- match: '"'
scope: punctuation.definition.string.begin.ssHash
push: inside_string

inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.ssHash
- match: '\.'
scope: constant.character.escape.ssHash
- match: '"'
scope: punctuation.definition.string.end.ssHash
pop: true

comments:
# Comments begin with a '//' and finish at the end of the line.
- match: '#'
scope: punctuation.definition.comment.ssHash
push:
- include: budsym
- meta_scope: comment.line.double-slash.ssHash
- match: $\n?
pop: true

budsym-terminator:
- match: '[ ]*(#*)[ ]*($\n?)'
captures:
1: punctuation.definition.heading.end.markdown
2: meta.whitespace.newline.markdown
pop: true
budsym:
- meta_include_prototype: false
- match: ' >>'
# - match: '(>{1,6})(?!>)\s*(?=\S)'
captures:
1: punctuation.definition.heading.begin.markdown
push:
- meta_scope: markup.heading.markdown
- meta_content_scope: entity.name.section.markdown
- include: budsym-terminator

+ 20
- 0
ssHashsymbols.tmPreferences View File

@@ -0,0 +1,20 @@

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List</string>
<key>scope</key>
<string>source.ssHash markup.heading - meta.whitespace.newline.ssHash</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<integer>1</integer>
<key>symbolIndexTransformation</key>
<string>
s/\s*#+\s*$//g;
</string>
</dict>
</dict>
</plist>

+ 61
- 0
ssSemi.sublime-syntax View File

@@ -0,0 +1,61 @@
%YAML 1.2
---
name: ssSemi
fileTypes: []
scope: source.ssSemi

contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
prototype:
- include: comments

main:
- include: numbers
- include: strings
# - include: budsym

numbers:
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.ssSemi

strings:
- match: '"'
scope: punctuation.definition.string.begin.ssSemi
push: inside_string

inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.ssSemi
- match: '\.'
scope: constant.character.escape.ssSemi
- match: '"'
scope: punctuation.definition.string.end.ssSemi
pop: true

comments:
# Comments begin with a '//' and finish at the end of the line.
- match: ';'
scope: punctuation.definition.comment.ssSemi
push:
- include: budsym
- meta_scope: comment.line.double-slash.ssSemi
- match: $\n?
pop: true

budsym-terminator:
- match: '[ ]*(;*)[ ]*($\n?)'
captures:
1: punctuation.definition.heading.end.markdown
2: meta.whitespace.newline.markdown
pop: true
budsym:
- meta_include_prototype: false
- match: ' >>'
# - match: '(>{1,6})(?!>)\s*(?=\S)'
captures:
1: punctuation.definition.heading.begin.markdown
push:
- meta_scope: markup.heading.markdown
- meta_content_scope: entity.name.section.markdown
- include: budsym-terminator

+ 20
- 0
ssSemisymbols.tmPreferences View File

@@ -0,0 +1,20 @@

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List</string>
<key>scope</key>
<string>source.ssSemi markup.heading - meta.whitespace.newline.ssSemi</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<integer>1</integer>
<key>symbolIndexTransformation</key>
<string>
s/\s*\;+\s*$//g;
</string>
</dict>
</dict>
</plist>

Loading…
Cancel
Save