jsfmt
jsfmt plugin for Sublime Text
Details
Installs
- Total 18K
- Win 10K
- Mac 7K
- Linux 2K
Dec 26 | Dec 25 | Dec 24 | Dec 23 | Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
Readme
- Source
- raw.githubusercontent.com
jsfmt for Sublime Text 2/3
If you want your javascript automatically formatted to abide a particular style, then jsfmt is for you. No need to read warnings and fix things yourself. Just keep it all auto. Boom boom jsfmt is pretty tight. And yeah, if you want it in Sublime Text this is your homeboy.
Enable autoformat
then save the file and it gets formatted.
Installation
Via package control
Open your command palette -> Package Control: Install Package -> jsfmt
Manual
## go to your ST packages folder. maybe something like …
cd ~/Library/"Application Support/Sublime Text 2"/Packages
# clone this repo
git clone https://github.com/ionutvmi/sublime-jsfmt jsfmt
On windows open cmd and:
cd %APPDATA%\"Sublime Text 3"\Packages
git clone https://github.com/ionutvmi/sublime-jsfmt jsfmt
Plugins included
Settings
{
// autoformat on save
"autoformat": false,
// array of extensions for autoformat
"extensions": ["js", "sublime-settings"],
// options for jsfmt
"options": {
"preset": "jquery",
"indent": {
"value": " "
},
// plugins included
"plugins": [
// "esformatter-quotes",
// "esformatter-semicolons",
// "esformatter-braces",
// "esformatter-dot-notation"
]
},
"options-JSON": {
"plugins": [
"esformatter-quotes"
],
"quotes": {
"type": "double"
}
},
"alert-errors": true,
// path to nodejs
"node-path": "node",
// if true it will format the whole file even if you have a selection active
"ignore-selection": false
}
Commands
Command palette:
- JSFMT: Format the current file
- JSFMT: Toggle autoformat
- JSFMT: Settings - Default
- JSFMT: Settings - User
Menu:
Preferences -> Package Settings -> Sublime JSFMT
Keyboard shortcut
If you want to trigger the formatting on a keyboard shortcut you will need to:
- Go to Preferences -> Key Bindings - User
- Insert the configuration to call the format_javascript
command
{ "keys": ["ctrl+q"], "command": "format_javascript" },
Formatting rules
You can set global rules via a .jsfmtrc
. Be crazy and establish one for all your
projects in ~/.jsfmtrc
. (like in dotfiles)
Otherwise you're probably pretty levelheaded and will probably provide one in your project root. It'll be read and applied.
Rules you can intuit from these esformatter preset files.
There's a .jsfmtrc-sample
in this repo. It's a good start. Rename it and toss it
somewhere. Try it out.
Installing plugins
If you want to use a plugin that is not installed by default you will need to follow the next steps:
- Go to the packages folder (Preferences -> Browse Packages)
- cd into the jsfmt folder.
- Install the plugins you need.
- Go to your jsfmt settings file and add the name of the plugin in the plugins array.
Compatibility
Should work in both ST2 and ST3.
Contributing
If you find any bugs feel free to report them here
Pull requests are also encouraged.