I have this bit of JavaScript...
15 $(\'.ajax_edit_address\').each(function() {
16 $(this).ajaxForm({
17 target: $(this).parents(\'table.addre
Another alternative that do not need to configure anything inside vim is to run the format command manually at save like:
:w !js-beautify --stdin >%
After saving in this way the vim editor will ask you to reload the current file content:
W12: Warning: File "src/static/js/main.js" has changed and the buffer was changed in Vim as well
See ":help W12" for more info.
[O]K, (L)oad File:
This works like the :w sudo tee % command used to save a file that you modified without privilege.
The command uses the standard input(STDIN) and write it to a variable file descriptor % used as source of current file.
PS: of course you need to install the js-beautify.
pip install jsbeautifier