Last Updated: August 01, 2023
·
4.251K
· tapanpandita

Vim function to unminify javascript

" Simple re-format for minified Javascript
command! UnMinify call UnMinify()
function! UnMinify()
    %s/{\ze[^\r\n]/{\r/g
    %s/){/) {/g
    %s/};\?\ze[^\r\n]/\0\r/g
    %s/;\ze[^\r\n]/;\r/g
    %s/[^\s]\zs[=&|]\+\ze[^\s]/ \0 /g
    normal ggVG=
endfunction

Add to your vimrc!

1 Response
Add your response

wow!!! works great!

over 1 year ago ·