mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
feat(pyenv): add prefix and suffix for pyenv_prompt_info
Added two new environment variables `ZSH_THEME_PYENV_PREFIX` and `ZSH_THEME_PYENV_SUFFIX` to allow customisation of the prefix and suffix displayed around the Python version in the prompt.
This commit is contained in:
parent
61bacd95b2
commit
0cfe7f081f
2 changed files with 8 additions and 2 deletions
|
|
@ -26,6 +26,12 @@ eval "$(pyenv init --path)"
|
|||
- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
|
||||
when it finds it.
|
||||
|
||||
- `ZSH_THEME_PYENV_PREFIX`: the prefix to display before the Python version in
|
||||
the prompt.
|
||||
|
||||
- `ZSH_THEME_PYENV_SUFFIX`: the prefix to display after the Python version in
|
||||
the prompt.
|
||||
|
||||
## Functions
|
||||
|
||||
- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
|
||||
|
|
|
|||
|
|
@ -88,13 +88,13 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
|
|||
|
||||
function pyenv_prompt_info() {
|
||||
local version="$(pyenv version-name)"
|
||||
echo "${version:gs/%/%%}"
|
||||
echo "${ZSH_THEME_PYENV_PREFIX=}${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
|
||||
}
|
||||
else
|
||||
# Fall back to system python
|
||||
function pyenv_prompt_info() {
|
||||
local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
|
||||
echo "system: ${version:gs/%/%%}"
|
||||
echo "${ZSH_THEME_PYENV_PREFIX=}system: ${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
|
||||
}
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue