Skip to content

Instantly share code, notes, and snippets.

@rodolfo42
Created May 27, 2014 13:52
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 rodolfo42/04136350e8fa207c0d1d to your computer and use it in GitHub Desktop.
Save rodolfo42/04136350e8fa207c0d1d to your computer and use it in GitHub Desktop.
Install "Optimize Imports and Save" macro on IntelliJ IDEA 12/13
PREF="$HOME/Library/Preferences/"
if [ -r "$PREF/IntelliJIdea13" ]; then
folder="$PREF/IntelliJIdea13"
elif [ -r "$PREF/IntelliJIdea12" ]; then
folder="$PREF/IntelliJIdea12"
else
echo "Pasta do IntelliJ nao encontrada"
exit 1
fi
echo '<?xml version="1.0" encoding="UTF-8"?>
<application>
<component name="ActionMacroManager">
<macro name="Organize Imports and Save">
<action id="OptimizeImports" />
<action id="SaveAll" />
</macro>
</component>
</application>' > $folder/options/macros.xml
if [ "$?" = 0 ]; then
echo 'Macro configurado com sucesso!'
else
echo 'Erro ao configurar macro. Tente novamente'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment