Here is the problem. I am currently using agnoster
theme in zsh. It looks great in iTerm but looks like this in terminal.
In other words it looks really ugly. So I am interested in two kinds of solutions:
Have different zsh themes for terminal and iTerm. So I can use agnoster for iTerm and some other theme for terminal. (For example: robbyrussell
looks fine in terminal so I would like to have agnoster
for iTerm and robbyrussell
for terminal.
Make some modifications so that agnoster
looks fine in terminal.
I got it to work, apparently I was missing a whitespace in my if condition, that rendered it completely useless. Here is how it looks in my zshrc
if [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then
ZSH_THEME="robbyrussell"
else
ZSH_THEME="agnoster"
fi
Terminal and iTerm set the environmental variable TERM_PROGRAM
.
Terminal : Apple_Terminal
iTerm : iTerm
If you use PathFinder
's terminal, TERM_PROGRAM
is unset.
Open your oh-my-zsh configuration and use the following construction:
OHMYTHEMES=(
# your favourite themes
)
[ "$TERM_PROGRAM" = "iTerm" ] && OHMYTHEMES+=agnoster
ZSH_THEME=${OHMYTHEMES[(($RANDOM % ${#OHMYTHEMES} + 1))]} # chooses theme among your favourite randomly
As far as you know what is zsh
, I assume you know the least bit of shell scripting and can adjust this to your code.
Related question : Get terminal application name from shell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With