Amuse – ZSH Theme
Amuse is a simplistic theme I built for the popular shell ZSH that I use.
Features :
- Shows git prompt with additional support for dirty (! in red) and untracked (? in green) git flags.
- Shows the system time with a neat time unicode character. Although I am sure most wouldn’t find having time on the prompt useful, I find it very useful since it helps me get a good idea on how long a command took to execute or even how long back I executed some command. Check the screenshot for reference.
- Prompt where you type the command starts after a $ on a new line giving you ample space (full width barring the $ and a space) to type your command and so the prompt (especially if it’s long, eg. if you are in some deep nested directory) does not interfere with your commands and avoids wrapping for the most part unless you are typing an excessively long command in which case you should probably use an editor (VIM) to edit it with ^X^E .
- Shows you the current ruby version in use from rvm, using the
rvm current
command in the right prompt. The ZSH right prompt is really cool and since I use rvm with several ruby versions which change with different projects .rvmrc files, the right prompt helps me to know the ruby context at all times. It shows the full ruby version along with the gemset name in use. The nice thing about the right prompt in ZSH is that it hides automatically if you happen to type a command that’s long enough to reach it :).
UPDATE: My AMUSE theme for Oh My Zsh was merged into the repository so you don’t need my fork anymore which has since been deleted.
I have pushed my theme into My Fork of Oh My Zsh of Oh My Zsh here : Amuze Zsh Theme. But I am going to paste it’s code here to showcase how small & simple the code is. I would recommend you to use the git repository to make sure you have the latest.
# vim:ft=zsh ts=2 sw=2 sts=2
rvm_current() {
rvm current 2>/dev/null
}
PROMPT='
%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
$ '
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}⭠ "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN=""
RPROMPT='%{$fg_bold[red]%}$(rvm_current)%{$reset_color%}'
Screenshot :
Hope you like it as much as I do.