1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 12:48:01 +00:00

Fix os-info and update prompt

This commit is contained in:
Daniel Carrillo 2019-06-21 18:42:37 +02:00
parent 9f86f48ae6
commit e6e5e4d68f
2 changed files with 7 additions and 4 deletions

View File

@ -12,11 +12,11 @@ local tenant_formatted
unset os_info unset os_info
typeset -gA os_info typeset -gA os_info
[[ -n "${OS_PROJECT_NAME+1}" ]] && tenant="[${OS_PROJECT_NAME}]" [[ -n "${OS_PROJECT_NAME+1}" ]] && tenant="${OS_PROJECT_NAME}"
if [[ "$tenant" != (none|) ]]; then if [[ "$tenant" != (none|) ]]; then
zstyle -s ':prezto:module:openstack:info:tenant' format 'tenant_format' zstyle -s ':prezto:module:openstack:info:tenant' format 'tenant_format'
zformat -f tenant_formatted "$tenant_format" "s:$tenant" zformat -f tenant_formatted "$tenant_format" "v:$tenant"
os_info[tenant]="$tenant_formatted" os_info[tenant]="$tenant_formatted"
fi fi

View File

@ -151,6 +151,9 @@ function prompt_sorin_setup {
# Set python-info parameters. # Set python-info parameters.
zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3}(%v)%F{7} ' zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3}(%v)%F{7} '
# Set os-info parameters
zstyle ':prezto:module:openstack:info:tenant' format '%f%F{3}[%v]%F{7}'
# Set up non-zero return value display # Set up non-zero return value display
local show_return="✘ " local show_return="✘ "
# Default is to show the return value # Default is to show the return value
@ -165,8 +168,8 @@ function prompt_sorin_setup {
_prompt_sorin_pwd='' _prompt_sorin_pwd=''
# Define prompts. # Define prompts.
PROMPT='${os_info:+${os_info[tenant]} }${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} ' PROMPT='${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} '
RPROMPT='$python_info[virtualenv]${editor_info[overwrite]}%(?:: %F{1}' RPROMPT='${os_info:+${os_info[tenant]} }$python_info[virtualenv]${editor_info[overwrite]}%(?:: %F{1}'
RPROMPT+=${show_return} RPROMPT+=${show_return}
RPROMPT+='%f)${VIM:+" %B%F{6}V%f%b"}${_prompt_sorin_git}' RPROMPT+='%f)${VIM:+" %B%F{6}V%f%b"}${_prompt_sorin_git}'
SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? ' SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? '