Created
March 12, 2014 11:59
-
-
Save ptim/9505499 to your computer and use it in GitHub Desktop.
ST3 super simple plugin: Save the current file with encoding UTF8, then close.
This file contains hidden or 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, sublime_plugin | |
''' | |
A response to: http://stackoverflow.com/questions/19831757/how-to-create-macro-in-sublime-text-3-with-saveas-and-close-file-command | |
Save the current file with encoding UTF8, then close. | |
To trigger the command with 'Command Option Shift 8', | |
add the following to your Sublime Text > Preferences > Keybindings - User | |
[ | |
{ "keys": ["super+option+shift+8"], "command": "save_as_utf8"} | |
] | |
''' | |
class SaveAsUtf8Command(sublime_plugin.WindowCommand): | |
def run(self): | |
self.window.run_command("save", {"encoding": "utf-8" }) | |
self.window.run_command("close") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It doesn't work as a macro; maybe these commands are out of scope for a macro (eg a window command not a view command?).
Looks like it might work, but produces:
in the console