Permalink
Browse files

initial population

  • Loading branch information...
0 parents commit bc24c445df3876c15eea2ef063e5adc58fd111ed Davis Clark committed Sep 1, 2011
Showing with 1,123 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +3 −0 Default (Linux).sublime-keymap
  3. +3 −0 Default (OSX).sublime-keymap
  4. +3 −0 Default (Windows).sublime-keymap
  5. +3 −0 JsFormat.sublime-commands
  6. +15 −0 js_formatter.py
  7. +1,094 −0 jsbeautifier.py
@@ -0,0 +1,2 @@
+
+*.pyc
@@ -0,0 +1,3 @@
+[
+ { "keys": ["ctrl+alt+f"], "command": "js_format"}
+]
@@ -0,0 +1,3 @@
+[
+ { "keys": ["ctrl+alt+f"], "command": "js_format"}
+]
@@ -0,0 +1,3 @@
+[
+ { "keys": ["ctrl+alt+f"], "command": "js_format"}
+]
@@ -0,0 +1,3 @@
+[
+ { "caption": "Format: Javascript", "command": "js_format" }
+]
@@ -0,0 +1,15 @@
+import sublime, sublime_plugin, jsbeautifier
+
+class JsFormatCommand(sublime_plugin.TextCommand):
+ def run(self, edit):
+ opts = jsbeautifier.default_options();
+ opts.indent_char = " "
+ opts.indent_size = 4
+ opts.max_preserve_newlines = 3
+ selection = self.view.sel()[0]
+ replaceRegion = selection if len(selection) > 0 else sublime.Region(0, self.view.size())
+ res = jsbeautifier.beautify(self.view.substr(replaceRegion), opts)
+ prePos = self.view.sel()[0]
+ self.view.replace(edit, replaceRegion, res)
+ self.view.show_at_center(prePos.begin())
+
Oops, something went wrong.

0 comments on commit bc24c44

Please sign in to comment.