summaryrefslogtreecommitdiff
path: root/themes/bira.zsh-theme
diff options
context:
space:
mode:
authorAndrew Janke <andrew@apjanke.net>2015-11-06 17:20:11 -0500
committerMarc Cornellà <marc.cornella@live.com>2019-05-08 08:45:34 +0200
commit299cd4777a8b9da1934a1ed0c80767eea6691a70 (patch)
treeacdc36193f390e01f4144ff8feefd126b5aecd8b /themes/bira.zsh-theme
parentea3e666e04bfae31b37ef42dfe54801484341e46 (diff)
downloadzsh-299cd4777a8b9da1934a1ed0c80767eea6691a70.tar.gz
zsh-299cd4777a8b9da1934a1ed0c80767eea6691a70.tar.bz2
zsh-299cd4777a8b9da1934a1ed0c80767eea6691a70.zip
Themes: switch to using ruby_prompt_info()
Changes themes displaying RVM or other Ruby version info to use the central ruby_prompt_info function. This supports more Ruby versioning mechanisms, reduces copy-and-paste code, and avoids "zsh: no such file or directory: rvm-prompt" when run on machines that do not have RVM installed. Changes the prefix/suffix variable names to ZSH_THEME_RUBY_PROMPT_PREFIX and ZSH_THEME_RUBY_PROMPT_SUFFIX, since they apply to all Ruby versioning mechanisms, not just RVM. Allows empty ZSH_THEME_RUBY_PROMPT_PREFIX and ZSH_THEME_RUBY_PROMPT_SUFFIX.
Diffstat (limited to 'themes/bira.zsh-theme')
-rw-r--r--themes/bira.zsh-theme18
1 files changed, 7 insertions, 11 deletions
diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme
index f73492422..d00f72f5d 100644
--- a/themes/bira.zsh-theme
+++ b/themes/bira.zsh-theme
@@ -1,7 +1,6 @@
# ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
local user_symbol='#'
@@ -11,26 +10,23 @@ else
fi
local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}'
-local rvm_ruby=''
-if which rvm-prompt &> /dev/null; then
- rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)› %{$reset_color%}'
-else
- if which rbenv &> /dev/null; then
- rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%}'
- fi
-fi
local git_branch='$(git_prompt_info)'
+local rvm_ruby='$(ruby_prompt_info)'
local venv_prompt='$(virtualenv_prompt_info)'
+ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
+
PROMPT="╭─${venv_prompt}${user_host}${current_dir}${rvm_ruby}${git_branch}
╰─%B${user_symbol}%b "
-RPS1="%B${return_code}%b"
+RPROMPT="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
+ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
+
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
-
ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX