Skip to content

Instantly share code, notes, and snippets.

@mmacedo
Created November 9, 2012 19:13
Show Gist options
  • Save mmacedo/4047615 to your computer and use it in GitHub Desktop.
Save mmacedo/4047615 to your computer and use it in GitHub Desktop.
Preview oh-my-zsh themes
#!/usr/bin/env bash
# Backup and modify .zshrc
cp $HOME/.zshrc $HOME/.zshrc_
sed -i "s/^ZSH_THEME=/\# \0/" $HOME/.zshrc
echo >> $HOME/.zshrc
echo "echo \"\\n\\n\\033[1;31m\$ZSH_THEME\\033[0m\\n\\n\"" >> $HOME/.zshrc
# Using xterm
CMD="xterm -ls -e /usr/bin/env zsh"
# Iterate theme files in the .oh-my-zsh/themes
for theme in $( ls $HOME/.oh-my-zsh/themes | cut -d. -f1 )
do
ZSH_THEME="$theme" $CMD &
# Keep only four emulators open at a time
while [ $( echo "$(jobs)" | grep Running | wc -l ) -ge 4 ]; do sleep 1; done
done
# Wait last four to be closed
wait
# Restore .zshrc
mv $HOME/.zshrc_ $HOME/.zshrc
@Patrick-web
Copy link

Awesome script. Helped me find a theme I've been looking for for months.

@elkadimi
Copy link

Thank you very much.
This saved me the heck of a lot of time.
Thumbs up !!

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