Skip to content

Instantly share code, notes, and snippets.

@timtyrrell
Created April 30, 2015 16:39
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timtyrrell/0640d02bd08cd54f739a to your computer and use it in GitHub Desktop.
Save timtyrrell/0640d02bd08cd54f739a to your computer and use it in GitHub Desktop.
Simple re-format for minified Javascript for VIM
" 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
@barry1955
Copy link

Fantastic!! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment