Skip to content

Instantly share code, notes, and snippets.

@hiphopsmurf
Forked from ptim/SaveAs-UTF8.py
Created November 5, 2017 00:18
Show Gist options
  • Select an option

  • Save hiphopsmurf/260099e046404b55cb01f0038f5ff771 to your computer and use it in GitHub Desktop.

Select an option

Save hiphopsmurf/260099e046404b55cb01f0038f5ff771 to your computer and use it in GitHub Desktop.
ST3 super simple plugin: Save the current file with encoding UTF8, then close.
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