commit 3c28af30c3594fc38291424ce9a049648aa8bbb6 Author: relikd Date: Wed Aug 1 23:54:14 2012 +0200 Initial diff --git a/Default.sublime-commands b/Default.sublime-commands new file mode 100644 index 0000000..1a93d79 --- /dev/null +++ b/Default.sublime-commands @@ -0,0 +1,6 @@ +[ + { + "caption": "Plist Binary: Toggle XML & Binary", + "command": "toggle_binary" + } +] diff --git a/Default.sublime-keymap b/Default.sublime-keymap new file mode 100644 index 0000000..d9fcc5c --- /dev/null +++ b/Default.sublime-keymap @@ -0,0 +1,6 @@ +[ + { + "keys": ["super+alt+ctrl+p"], + "command": "toggle_binary" + } +] \ No newline at end of file diff --git a/Main.sublime-menu b/Main.sublime-menu new file mode 100644 index 0000000..b01f220 --- /dev/null +++ b/Main.sublime-menu @@ -0,0 +1,32 @@ +[ + { + "caption": "Preferences", + "mnemonic": "n", + "id": "preferences", + "children": + [ + { + "caption": "Package Settings", + "mnemonic": "P", + "id": "package-settings", + "children": + [ + { + "caption": "Plist Binary", + "children": + [ + { + "caption": "Key Bindings – Default", + "command": "open_file", + "args": { + "file": "${packages}/Plist Binary/Default.sublime-keymap", + } + }, + { "caption": "-" } + ] + } + ] + } + ] + } +] diff --git a/Plist Binary.py b/Plist Binary.py new file mode 100644 index 0000000..ba3b587 --- /dev/null +++ b/Plist Binary.py @@ -0,0 +1,23 @@ +import sublime, sublime_plugin +import os + +class ToggleBinaryCommand(sublime_plugin.TextCommand): + def run_(self, args): + + fname = self.view.file_name() + if os.path.splitext(fname)[1].lower() != ".plist": + sublime.error_message("%s: Not a *.plist file!" % PACKAGE_NAME) + return + + if self.view.is_dirty(): + sublime.error_message("%s: Can't encode an unsaved file!" % PACKAGE_NAME) + return + + if self.view.substr(sublime.Region(0, 5)) == "