JsBeautifier command for Sublime Text 2
Python JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 4 commits ahead, 1 commit behind bjouhier:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
jsbeautifier
.gitignore
Default (Linux).sublime-keymap
Default (OSX).sublime-keymap
Default (Windows).sublime-keymap
JsBeautify.sublime-commands
JsBeautify.sublime-settings
Main.sublime-menu
Preferences.sublime-settings
js_formatter.py
readme.md

readme.md

Summary

Uses the commandline/python-module javascript formatter from http://jsbeautifier.org/ to format the selected text, or the entire file if there is no selection.

Attention: the plugin does not check to make sure the buffer has a .js file type, it just javascript formats the selection/file. Thus, use with caution if you are in an HTML file.

Install

Linux

git clone git@github.com:select/sublime-text-jsbeautifier.git ~/.config/sublime-text-2/Packages/Jsbeautify

Mac

git clone git@github.com:select/sublime-text-jsbeautifier.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Jsbeautify

Windows

git clone git@github.com:select/sublime-text-jsbeautifier.git %APPDATA%/Sublime\ Text\ 2/Packages/Jsbeautify

Key Binding

The default key binding is ctrl+shift+j

This is similar to auto pep8 ctrl+shift+8 for python

Updates

  • 3/7/2013 - Forked project, updated jsbeautifier, added sublime settings, changed keybinding
  • 8/25/2011 - Added sublime-commands file. Format: Javascript now appears in the command palette
  • 8/25/2011 - scrolls back to whatever line you were on prior to formatting the file (middle of screen) rather than leaving the view position at the top of the file after formatting.