Skip to content

xer0x/jsbeautify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

jsbeautify.vim

A plugin to format your javascript souce code. It can be helpful when reformatting JSON snippets and compressed javascript.

This fork of vim-scripts/jsbeautify has a couple small changes to pass JSLint. For a handy JSLint vim-plugin checkout jslint.vim.

The original JS version can be found at: jsbeautifier.org
Plus a Node.JS version is here: js-beautify-node

usage:

  • <leader>ff
    or
  • bind the g:Jsbeautify() function to any short key you like.

changes:

  • It is filetype plugin so it only loads for javascript files. This might not be ideal if you want to reformat .json files or use the javascript.jquery filetype.
  • If you use JSLint's strict whitespace rules, then add let g:Jsbeautify_jslint_whitespace = 1 to your .vimrc to use function () instead of function()
  • To expand tabs into spaces use let g:Jsbeautify_jslint_expandtab = 1. Thanks to somethingkindawierd for this.

Thanks to aj3423 fork creating the vimscript version of this brilliant reformatter.

Packages

No packages published

Languages

  • Vim Script 100.0%