prezto/modules/python/functions/python-info
mayuroks 426f15e20d python_info[version] will show python version in the format "py-3.4.1" (without the quotes.)
Also changed prompt_name_preexec to prompt_name_precmd. prompt_name_precmd is executed before the prompt is loaded.
This makes loading the prompt with python info sort of "proactive".
2015-08-29 08:13:28 +05:30

23 lines
622 B
Text

#
# Exposes information about the Python environment via the $python_info
# associative array.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
local virtualenv_format
local virtualenv_formatted
# Clean up previous $python_info.
unset python_info
typeset -gA python_info
# Format virtualenv.
if [[ -n "$VIRTUAL_ENV" ]]; then
zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format'
zformat -f virtualenv_formatted "$virtualenv_format" "v:${VIRTUAL_ENV:t}"
python_info[virtualenv]="$virtualenv_formatted"
PY_VERSION=`python -V 2>&1`
python_info[version]="py-"$PY_VERSION[(w)2]
fi