Skip to content

Instantly share code, notes, and snippets.

@voyeg3r
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voyeg3r/9646346 to your computer and use it in GitHub Desktop.
Save voyeg3r/9646346 to your computer and use it in GitHub Desktop.
#!/bin/env bash
# source: DEV WITH PASSION --> http://va.mu/eVRT
# purpose: indet files with vim
cd diretorio/com/arquivos/a/serem/indentados
find -type f | egrep ".html$|.php$|.inc$|.tpl$" > lista_arquivos
for arquivo in $( < lista_arquivos );
do
echo "$(date +'%d/%m/%Y %H:%M:%S') - iniciando indentação de '$arquivo'" >> log_indentacao
vim -c ":normal gg=G" -c :w! -c :q! ---- $arquivo &&
echo "$(date +'%d/%m/%Y %H:%M:%S') - finalizando indentação de '$arquivo'" >> log_indentacao ||
echo "$(date +'%d/%m/%Y %H:%M:%S') - falhou indentação de '$arquivo'" >> log_indentacao
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment