Beautify your javascript,html,css source code inside Vim
JavaScript VimL
Pull request Compare This branch is 1 commit ahead, 13 commits behind michalliu:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Beautify your source code in Vim

It support javascript,css,html which is powered by js-beautify and JSON powered by jsonlint

More language support is well welcomed, your can develop it by pure javascript, see Customization for more info.


This plugin requires jsruntime.vim and jsoncodecs.vim to be installed first

then copy plugin/sourcebeautify to vimfiles/plugin

Sourcebeautify support json file, but vim can't detect json type automaticly. You can add following code to your vimrc. I suggest to install json.vim

au BufRead,BufNewFile *.json setf json



Your <Leader> key is often \


  1. jsbeautify options

    Take a look at, this file contains following code


    %s refers to the codes before beautify, the other part is pure javascript, for example


    javascript beautifier options, html beautifier options, css beautifier options, jsonlint options

  2. add more language support

    If you wants this plugin to support cpp file, you should create beautify-cpp.js and

    These two files should be written by pure javascript, then modify sourcebeautify.vim add declaration and alias

    " sourcetype that support by this plugin
    let s:beautifiers.supportedSourceType={
    " sourcetype name alias
    let s:beautifiers.supportedSourceTypeAlias={


Einar Lielmanis - author of js-beautify provide beautifier of javascript,html,css file

Zach Carter - author of jsonlint provide error checker and beautifier of JSON file