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".
This commit is contained in:
parent
f2a826e963
commit
426f15e20d
2 changed files with 5 additions and 1 deletions
|
@ -74,6 +74,8 @@ Functions
|
|||
|
||||
Theming
|
||||
-------
|
||||
- `python_info[virtualenv]` exposes virtualenv name
|
||||
- `python_info[version]` exposes virtualenv python version (eg. py-3.4.1, py-2.7.6)
|
||||
|
||||
To display the name of the current virtual enviroment in a prompt, define the
|
||||
following style in the `prompt_name_setup` function.
|
||||
|
@ -82,7 +84,7 @@ following style in the `prompt_name_setup` function.
|
|||
zstyle ':prezto:module:python:info:virtualenv' format 'virtualenv:%v'
|
||||
|
||||
Then add `$python_info[virtualenv]` to `$PROMPT` or `$RPROMPT` and call
|
||||
`python-info` in the `prompt_name_preexec` hook function.
|
||||
`python-info` in the `prompt_name_precmd` hook function.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
|
|
@ -18,4 +18,6 @@ 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
|
||||
|
|
Loading…
Add table
Reference in a new issue