mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 13:58:00 +00:00
python-info: provide python version info for theming
Closes #1173 Closes #958
This commit is contained in:
parent
e2785cc246
commit
b407ba0c3a
@ -135,6 +135,10 @@ following style in the `prompt_name_setup` function.
|
|||||||
Then add `$python_info[virtualenv]` to `$PROMPT` or `$RPROMPT` and call
|
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_preexec` hook function.
|
||||||
|
|
||||||
|
Similarly, you can use `:prezto:module:python:info:version:format` with `%v` for
|
||||||
|
the version and add `$python_info[version]` to your prompt for the current
|
||||||
|
python version/
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
local virtualenv_format
|
local virtualenv_format
|
||||||
local virtualenv_formatted
|
local virtualenv_formatted
|
||||||
|
local version_format
|
||||||
|
local version_formatted
|
||||||
|
|
||||||
# Clean up previous $python_info.
|
# Clean up previous $python_info.
|
||||||
unset python_info
|
unset python_info
|
||||||
@ -30,4 +32,10 @@ if [[ -n "$CONDA_DEFAULT_ENV" ]]; then
|
|||||||
python_info[virtualenv]="$virtualenv_formatted"
|
python_info[virtualenv]="$virtualenv_formatted"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
zstyle -s ':prezto:module:python:info:version' format 'version_format'
|
||||||
|
if [[ -n "$version_format" ]]; then
|
||||||
|
zformat -f version_formatted "$version_format" "v:${$(python3 --version)#Python }"
|
||||||
|
python_info[version]="$version_formatted"
|
||||||
|
fi
|
||||||
|
|
||||||
# }
|
# }
|
||||||
|
Loading…
Reference in New Issue
Block a user