sponsor Vim development Vim logo Vim Book Ad

vim-jsbeautify : Simple javascript formater base on js-beautify

 script karma  Rating 20/9, Downloaded by 1516  Comments, bugs, improvements  Vim wiki

created by
Maksim Ryzhikov
script type

LINK ON GITHUB: https://github.com/maksimr/vim-jsbeautify

## About

Vim plugin based on js-beautify

For more info, online demo and tests see [http://jsbeautifier.org/](online javascript beautifier)


### With Pathogen

cd ~/.vim/bundle
git clone https://github.com/maksimr/vim-jsbeautify.git
cd vim-jsbeautify && git submodule foreach git pull

### With Vundle
Add this to .vimrc:


  Bundle 'maksimr/vim-jsbeautify'

  " and go to plugin direcotory and run git submodule foreach git pull

or (recomended)


  Bundle 'maksimr/vim-jsbeautify'
  Bundle 'einars/js-beautify'

  " set path to js-beautify file
  let g:jsbeautify_file = fnameescape(fnamemodify(expand("<sfile>"), ":h")."/bundle/js-beautify/beautify.js")



Configuration jsbeautify


  let g:jsbeautify = {"indent_size": 4, "indent_char": "\t"}


Run on v8


  " by default
  let g:jsbeautify_engine = "node"

  " If you bin name for node is nodejs
  let g:jsbeautify_engine = "nodejs"

  let g:jsbeautify_engine = "v8"

  " or if you have other alias
  let g:jsbeautify_engine = "v8-alias"




  map <c-f> :call JsBeautify()<cr>


Function JsBeautify takes two parameters. First `start line` second `end line`,
by default `start line` equal '0' and `end line` equal '$'

(version: 0.1)
install details

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-jsbeautify.zip 0.1.1 2012-04-20 7.3 Maksim Ryzhikov Fix shell escape
vim-jsbeautify.zip 0.1 2012-04-14 7.3 Maksim Ryzhikov Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.