Skip to content

Commit

Permalink
Add menu items for accessing/setting the plugin's options
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Porof committed Sep 8, 2013
1 parent fda15e9 commit 39676e5
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 11 deletions.
5 changes: 4 additions & 1 deletion Context.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
"command": "htmlprettify"
}, {
"caption": "Set Prettify Preferences",
"command": "htmlprettify_set_prefs"
"command": "htmlprettify_set_prettify_prefs"
}, {
"caption": "Set Plugin Options",
"command": "htmlprettify_set_plugin_options"
}, {
"caption": "Set Keyboard Shortcuts",
"command": "htmlprettify_set_keyboard_shortcuts"
}, {
Expand Down
5 changes: 4 additions & 1 deletion Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"command": "htmlprettify"
}, {
"keys": ["ctrl+alt+h", "p"],
"command": "htmlprettify_set_prefs"
"command": "htmlprettify_set_prettify_prefs"
}, {
"keys": ["ctrl+alt+h", "o"],
"command": "htmlprettify_set_plugin_options"
}, {
"keys": ["ctrl+alt+h", "k"],
"command": "htmlprettify_set_keyboard_shortcuts"
Expand Down
5 changes: 4 additions & 1 deletion Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"command": "htmlprettify"
}, {
"keys": ["super+alt+h", "p"],
"command": "htmlprettify_set_prefs"
"command": "htmlprettify_set_prettify_prefs"
}, {
"keys": ["super+alt+h", "o"],
"command": "htmlprettify_set_plugin_options"
}, {
"keys": ["super+alt+h", "k"],
"command": "htmlprettify_set_keyboard_shortcuts"
Expand Down
5 changes: 4 additions & 1 deletion Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"command": "htmlprettify"
}, {
"keys": ["ctrl+alt+h", "p"],
"command": "htmlprettify_set_prefs"
"command": "htmlprettify_set_prettify_prefs"
}, {
"keys": ["shift+alt+h", "o"],
"command": "htmlprettify_set_plugin_options"
}, {
"keys": ["ctrl+alt+h", "k"],
"command": "htmlprettify_set_keyboard_shortcuts"
Expand Down
8 changes: 6 additions & 2 deletions HTMLPrettify.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ def run(self, edit):
class PreSaveFormatListner(sublime_plugin.EventListener):
def on_pre_save(self, view):
settings = sublime.load_settings(SETTINGS_FILE)
if(settings.get("format_on_save") == True):
if settings.get("format_on_save") == True:
view.run_command("htmlprettify")

class HtmlprettifySetPrefsCommand(sublime_plugin.TextCommand):
class HtmlprettifySetPrettifyPrefsCommand(sublime_plugin.TextCommand):
def run(self, edit):
open_jsbeautify_rc(self.view.window())

class HtmlprettifySetPluginOptionsCommand(sublime_plugin.TextCommand):
def run(self, edit):
open_htmlprettify_sublime_settings(self.view.window())

class HtmlprettifySetKeyboardShortcutsCommand(sublime_plugin.TextCommand):
def run(self, edit):
open_jshint_sublime_keymap(self.view.window(), {
Expand Down
5 changes: 4 additions & 1 deletion HTMLPrettify.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"command": "htmlprettify"
}, {
"caption": "HTMLPrettify: Set Prettify Preferences",
"command": "htmlprettify_set_prefs"
"command": "htmlprettify_set_prettify_prefs"
}, {
"caption": "HTMLPrettify: Set Plugin Options",
"command": "htmlprettify_set_plugin_options"
}, {
"caption": "HTMLPrettify: Set Keyboard Shortcuts",
"command": "htmlprettify_set_keyboard_shortcuts"
Expand Down
4 changes: 2 additions & 2 deletions HTMLPrettify.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// https://github.com/victorporof/Sublime-HTMLPrettify#oh-noez-command-not-found
// http://nodejs.org/#download
"node_path": "/usr/local/bin/node",
"format_on_save": true
}
"format_on_save": false
}
10 changes: 8 additions & 2 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"command": "htmlprettify"
}, {
"caption": "Set Prettify Preferences",
"command": "htmlprettify_set_prefs"
"command": "htmlprettify_set_prettify_prefs"
}, {
"caption": "Set Plugin Options",
"command": "htmlprettify_set_plugin_options"
}, {
"caption": "Set Keyboard Shortcuts",
"command": "htmlprettify_set_keyboard_shortcuts"
Expand All @@ -28,7 +31,10 @@
"command": "htmlprettify"
}, {
"caption": "Set Prettify Preferences",
"command": "htmlprettify_set_prefs"
"command": "htmlprettify_set_prettify_prefs"
}, {
"caption": "Set Plugin Options",
"command": "htmlprettify_set_plugin_options"
}, {
"caption": "Set Keyboard Shortcuts",
"command": "htmlprettify_set_keyboard_shortcuts"
Expand Down

0 comments on commit 39676e5

Please sign in to comment.