aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-06-20 13:52:05 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-06-20 13:52:05 +0300
commit8785fa1f259d82f55e65e9256988247030de80e9 (patch)
tree5554a69540406142b8f015ab852ae8a16c543c8a /internal/p10k.zsh
parentb6ba19617c967b276f801c2163a1359303eceb3e (diff)
speed up rvm prompt
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-xinternal/p10k.zsh12
1 files changed, 5 insertions, 7 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 986df9ac..6f6020d6 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1393,13 +1393,11 @@ prompt_rspec_stats() {
################################################################
# Segment to display Ruby Version Manager information
prompt_rvm() {
- if [ $commands[rvm-prompt] ]; then
- local version_and_gemset=${$(rvm-prompt v p)/ruby-}
-
- if [[ -n "$version_and_gemset" ]]; then
- "$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${${version_and_gemset//\%/%%}//\\/\\\\}"
- fi
- fi
+ (( $+commands[rvm-prompt] )) || return
+ [[ $GEM_HOME == *rvm* && $ruby_string != $rvm_path/bin/ruby ]] || return
+ local v=${${${GEM_HOME:t}%%${rvm_gemset_separator:-@}*}#*-}
+ [[ -n $v ]] || return
+ "$1_prompt_segment" "$0" "$2" "240" "$DEFAULT_COLOR" 'RUBY_ICON' 0 '' "${${v//\%/%%}//\\/\\\\}"
}
################################################################