This commit provides a new segment `pyenv` to show current python environment.
This prompt can be used in place of `virtualenv` segment. However, it is
targeted at users of [pyenv](https://github.com/yyuu/pyenv) and not meant to
replace the `virtualenv` segment.
The prompt works by parsing output of `pyenv version` and displaying the first
word of the output as segment text. The design (color etc.) is same as the
`virtualenv` segment including the icon. The segment would need to be
revisited if `pyenv version` changes its output format.
Tested on my personal machines (Mac OSX 10.11.4 and Ubuntu 15.04).
The segment relies on a lookaround to determine the currently
active conda environment.
If available ack is preferred, otherwise grep will be used.
Recent versions of grep offer `-P` to support perl-regex.
Older ones (e.g. those shipped on OSX) will fail.
Prior to this, the rbenv prompt only showed something if the
$RBENV_VERSION environment variable was set. This was not a complete
solution because rbenv can be configured locally, per directory, with
dotfiles. When using dotfiles, the $RBENV_VERSION variables is not set.
This fixes the issue by taking the output of the `rbenv version-name`
command which shows the real rbenv version being used based on any of
the 4 ways to change rbenv as shown here:
https://github.com/rbenv/rbenv#choosing-the-ruby-version
If the current version of Ruby being used is the same as the global
Ruby, nothing is shown.
This commit also adds documentation to the README that describes the
prompt.
Fixes issue #215
Big thanks to @dritter for guidance, @rjorgenson for great explanation.
And @bhilburn for further guidance and encouragement.
See http://i.imgur.com/2Vncypo.png for a presentation of how it looks.