ST2 and ST3: github.com/facelessuser/SerializedDataConverter
This will be the successor of PlistJsonConverter. SerializedDataConverter will convert plists, yaml and json to each other.
I have added a built-in yaml highlighter because sublime’s yaml highlighter isn’t even that usable. You can override the one I provided with Sublime’s, or you can override with others such as AAAPackageDev’s yaml. I personally am not using AAAPackageDev at this time its rules were a bit too sublime settings specific with keys and some other minor things. With that said, mine has flaws as well. I am working on yet another yaml highlighter to replace the current one which uses a different approach, to hopefully improve highlighting overall with yaml, and I also plan to look into AAAPackageDev’s version as well to see if its flaws can be improved and even replace mine. Overall, I feel that PackageDev’s and mine will allow you to edit languages and Sublime settings much better than Sublime’s built-in one. If you want to use them to edit general yaml files outside of sublime settings, you can evaluate which one works better for you, or use something else entirely.
Example PHP conversion:
[pre=#151515] beginCaptures:
‘1’:
name: storage.modifier.php
‘2’:
name: storage.type.function.php
‘3’:
name: storage.modifier.reference.php
‘4’:
name: support.function.magic.php
‘5’:
name: entity.name.function.php
‘6’:
name: punctuation.definition.parameters.begin.php
contentName: meta.function.arguments.php
end: ())
endCaptures:
‘1’:
name: punctuation.definition.parameters.end.php
name: meta.function.php
patterns:
- include: ‘#function-arguments’
- include: ‘#invoke-call’
- begin: |-
(?xi)\s*(?=
[a-z_0-9$\]+(:
(?:
([a-z_][a-z_0-9])\s(
|
(($+)[a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}])
|
([a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}])
)?
)
end: |-
(?x)(:
(?:
([A-Za-z_][A-Za-z_0-9])\s(
|
(($+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}])
|
([a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}])
)?
endCaptures:[/pre]
I also added a little extra feature as well. When working with sublime settings, you can use !!regex (which is mapped to !!str for conversion), and it will highlight your data with regex highlighting. This way it isn’t too sublime-specific, but you can still use it to edit tmLanguage files.
[pre=#151515] ###################
# Lines
###################
# Scan the line for key value pairs
single-line:
begin: !!regex |-
(?x)^\ ](?:
(?:(-?])(?:\ \r\n]+))?
(?:
(\w(?:.?^\ ])?|<<)(?:\ \r\n](:)(?:\ \r\n]+|(?=$))) |
(’]((?:(?:\.)|(?:^’\]|’{2}))?)’])(:)(?:\ \r\n]+|(?=$))|
("]((?:(?:\.)|(?:^"\]|\"))*?)"])(:)(?:\ \r\n]+|(?=$))
)
)
beginCaptures:
‘1’: {name: keyword.operator.list.yaml-simple}
‘2’: {name: meta.tag.yaml-simple}
‘3’: {name: keyword.operator.key-separator.yaml-simple}
‘4’: {name: meta.tag.yaml-simple}
‘5’: {name: string.yaml-simple}
‘6’: {name: keyword.operator.key-separator.yaml-simple}
‘7’: {name: meta.tag.yaml-simple}
‘8’: {name: string.yaml-simple}
‘9’: {name: keyword.operator.key-separator.yaml-simple}
end: !!regex $
patterns:
- include: ‘#cast-values’
- include: ‘#values’
cast-values:
patterns:
- captures:
'1': {name: support.type.yaml-simple}
'2': {name: keyword.operator.multi-line.yaml-simple}
'3': {name: comment.yaml-simple}
match: !!regex (?:(!!\w//]+) ]+)?(|>]-+\d\r\n]*) \r\n]*(#.*)?$
- begin: !!regex (!!regex) ]+
beginCaptures:
'1': {name: support.type.yaml-simple}
end: !!regex (?=$)
patterns:
- include: '#sublime-regex'
- begin: !!regex (!!\w//]+) ]+
end: !!regex (?=$)
patterns:
- include: '#values'[/pre]
Details are subject to change before release.
Anyways, if you wanted to play existing languages in yaml, this plugin will convert them over for you and provide a language file to edit it in. Then you can save it back to tmLanguage etc.