Last Updated: March 07, 2016
·
2.462K
· thomaspeklak

Invoke js-beautify in Vim

1) Install js-beautify

npm install -g js-beautify

2) Map js-beautify to ,ff (if your leader is ,):

nnoremap <leader>ff :%!js-beautify -j -q -B -f -<CR>

3) Customize the options the way you want

js-beautify -h #will give you all options

There is no need for a vim plugin to do this for you and this way you can easily customize it the way you want.