From 9af324fe3a4bb941225765230d619e426cb935cf Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 11 Apr 2014 03:29:57 -0400 Subject: [PATCH] Add rbenv/pyenv local version to prompt --- zsh/prompt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zsh/prompt b/zsh/prompt index 2c0a27d6..fe585ba9 100644 --- a/zsh/prompt +++ b/zsh/prompt @@ -38,6 +38,18 @@ function _prompt_vimode { fi } +function _prompt_rbenv { + local ruby_version + ruby_version="$(rbenv local 2>/dev/null)" + [ "$?" -eq 0 ] && echo -n " %{$fx[bold]%}%{$fg[red]%}:$ruby_version" +} + +function _prompt_pyenv { + local py_version + py_version="$(pyenv local 2>/dev/null)" + [ "$?" -eq 0 ] && echo -n " %{$fx[bold]%}%{$fg[yellow]%}:$py_version" +} + # prompts function _lprompt { # Start each prompt with a newline @@ -65,6 +77,10 @@ function _rprompt { # Show the branch/status if in a git repo echo -n '$(_prompt_git)' + # Display the local version of rb/pyenv + command_exists rbenv && echo -n '$(_prompt_rbenv)' + command_exists pyenv && echo -n '$(_prompt_pyenv)' + # Reset formatting for command output echo -n "%{$reset_color%}" }