Last active
December 23, 2015 00:28
-
-
Save sligodave/6553396 to your computer and use it in GitHub Desktop.
A simple sublime text plugin to change the syntax of every opened or new file to YAML.
Drop the file "SyntaxToYAML.py" into your Sublime Text "Packages/User/" directory.
Add the keymaps to the files with the same name in your "Packages/User/" directory too. DON'T overwrite the "Default (XXX).sublime-keymap" files that are already there. Add to t…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
// Change the syntax of the current file to YAML | |
{ "keys": ["ctrl+alt+y"], "command": "change_syntax", "args": {"syntax": "Packages/YAML/YAML.tmLanguage"}} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Change the syntax of the current file to YAML | |
{ "keys": ["ctrl+super+y"], "command": "change_syntax", "args": {"syntax": "Packages/YAML/YAML.tmLanguage"}} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Change the syntax of the current file to YAML | |
{ "keys": ["ctrl+alt+y"], "command": "change_syntax", "args": {"syntax": "Packages/YAML/YAML.tmLanguage"}} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime_plugin | |
class ChangeSyntaxCommand(sublime_plugin.TextCommand): | |
def run(self, edit, syntax='Packages/Text/Plain text.tmLanguage'): | |
self.view.set_syntax_file(syntax) | |
# class ChangeSyntaxToYAMLEventListener(sublime_plugin.EventListener): | |
# def on_load(self, view): | |
# view.run_command('change_syntax', args={'syntax': 'Packages/YAML/YAML.tmLanguage'}) | |
# on_new = on_load |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment