Skip to content

Instantly share code, notes, and snippets.

@dm1try
Created January 9, 2016 03:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dm1try/c061f5ff7a6ff4d78cae to your computer and use it in GitHub Desktop.
Save dm1try/c061f5ff7a6ff4d78cae to your computer and use it in GitHub Desktop.
custom theme for my oh-my-zsh. It displays `elixir`/`ruby` version in the prompt(dependent on current dir); requirements `rvm` for `ruby`, `kiex` for `elixir`
function elixir_version() {
if [ -f "$PWD/mix.exs" ]; then
echo "$ELIXIR_VERSION "
fi
}
function ruby_version() {
if [ -f "$PWD/Gemfile" ]; then
echo "${RUBY_VERSION#*-} "
fi
}
RUBY_PROMPT_="%{$FG[33]%}%{$FG[203]%}\$(ruby_version)%{$FG[33]%}%{$reset_color%}"
ELIXIR_PROMPT_="%{$FG[33]%}%{$FG[105]%}\$(elixir_version)%{$FG[33]%}%{$reset_color%}"
HOST_PROMPT_="%{$FG[123]%}%c "
GIT_PROMPT="\$(git_prompt_info) "
PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$ELIXIR_PROMPT_$GIT_PROMPT"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$FG[202]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$FG[196]%}*"
ZSH_THEME_GIT_PROMPT_CLEAN=""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment