Skip to content

Instantly share code, notes, and snippets.

@nic0-lab
Last active June 23, 2018 15:47
Show Gist options
  • Save nic0-lab/3089292db0a970ab3f55e56da6f1ff66 to your computer and use it in GitHub Desktop.
Save nic0-lab/3089292db0a970ab3f55e56da6f1ff66 to your computer and use it in GitHub Desktop.
Vim Tips
" Supprimer tous les ^M (carriage return) en fin de ligne
:%s/\r\(\n\)/\1/g
" 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment