sponsor Vim development Vim logo Vim Book Ad

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

 script karma  Rating 24/10, Downloaded by 1765  Comments, bugs, improvements  Vim wiki

created by
Maksim Ryzhikov
 
script type
utility
 
description
vim-jsbeautify.vim
============

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)

Installation
------------


### 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:

```vim

  Bundle 'maksimr/vim-jsbeautify'

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

```
or (recomended)

```vim

  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
-------------

Configuration jsbeautify

```vim
  ".vimrc

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

```

Run on v8

```vim
  ".vimrc

  " 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"

```

Usage

```vim
  ".vimrc

  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: 216.73.216.208

Questions about Vim should go to the maillist. Help Uganda.     Vim at Github