mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-21 01:02:08 +08:00
feat(jonathan): add virtualenv support (#12705)
Co-authored-by: paul <paul@MAINPC>
This commit is contained in:
parent
0987eee190
commit
ba1732833b
@ -7,14 +7,15 @@ function theme_precmd {
|
|||||||
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
||||||
local rubypromptsize=${#${(%)$(ruby_prompt_info)}}
|
local rubypromptsize=${#${(%)$(ruby_prompt_info)}}
|
||||||
local pwdsize=${#${(%):-%~}}
|
local pwdsize=${#${(%):-%~}}
|
||||||
|
local venvpromptsize=$((${#$(virtualenv_prompt_info)}))
|
||||||
|
|
||||||
# Truncate the path if it's too long.
|
# Truncate the path if it's too long.
|
||||||
if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then
|
if (( promptsize + rubypromptsize + pwdsize + venvpromptsize > TERMWIDTH )); then
|
||||||
(( PR_PWDLEN = TERMWIDTH - promptsize ))
|
(( PR_PWDLEN = TERMWIDTH - promptsize ))
|
||||||
elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
|
elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
|
||||||
PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}"
|
PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize + venvpromptsize ) ))::${PR_HBAR}:)}"
|
||||||
else
|
else
|
||||||
PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}"
|
PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize + venvpromptsize ) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ fi
|
|||||||
PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\
|
PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\
|
||||||
${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\
|
${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\
|
||||||
${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\
|
${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\
|
||||||
${PR_GREY})$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\
|
${PR_GREY})$(virtualenv_prompt_info)$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\
|
||||||
${PR_CYAN}%(!.%SROOT%s.%n)${PR_GREY}@${PR_GREEN}%m:%l\
|
${PR_CYAN}%(!.%SROOT%s.%n)${PR_GREY}@${PR_GREEN}%m:%l\
|
||||||
${PR_GREY})${PR_CYAN}${PR_HBAR}${PR_URCORNER}\
|
${PR_GREY})${PR_CYAN}${PR_HBAR}${PR_URCORNER}\
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user