Fix rbenv gems helper
Fixes gem versions with words (beta, pre) in the version or with
multiple installed versions not being highlighted, and compatibility
with GNU sed (related to robbyrussell/oh-my-zsh#1579).
Diff
1diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
2index d855c244552ebd6e2b418108c0d3cce1f8fa7202..fb9df4bdd89fa7db15bbe21d23ef4a5097f07652 100644
3--- a/plugins/rbenv/rbenv.plugin.zsh
4+++ b/plugins/rbenv/rbenv.plugin.zsh
5@@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
6 7 function gems {
8 local rbenv_path=$(rbenv prefix)
9- gem list $@ | sed \
10- -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
11- -Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
12- -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
13- -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
14+ gem list $@ | sed -E \
15+ -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
16+ -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
17+ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
18+ -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
19 }
2021 function rbenv_prompt_info() {