Skip to content

Commit 5d6798d

Browse files
committed
No need to trim trailing space from VIRTUAL_ENV_PROMPT
This was fixed in uv 0.7.6. See https://github.com/astral-sh/uv/releases/tag/0.7.6 and astral-sh/uv#13501
1 parent 83d26c4 commit 5d6798d

File tree

1 file changed

+26
-32
lines changed

1 file changed

+26
-32
lines changed

agnoster.zsh-theme

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,67 @@
22
#
33
# A Zim version of Agnoster, a Powerline-inspired theme for Zsh.
44
#
5-
# This theme requires a [patched Powerline
6-
# font](https://github.com/powerline/fonts). In addition, it looks better with
7-
# the [Solarized theme](https://github.com/altercation/solarized/).
8-
#
9-
# Based on the [original theme](https://github.com/agnoster/agnoster-zsh-theme),
10-
# on the [Oh My Zsh version of
11-
# Agnoster](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/agnoster.zsh-theme),
12-
# and on the [Powerlevel9k theme](https://github.com/bhilburn/powerlevel9k).
13-
#
14-
# Uses the 'git-info' Zim module.
15-
#
165

17-
prompt_agnoster_main() {
6+
_prompt_agnoster_main() {
187
# This runs in a subshell
198
RETVAL=${?}
20-
CURRENT_BG=''
9+
CURRENT_BG=
2110

22-
prompt_agnoster_status
23-
prompt_agnoster_pwd
24-
prompt_agnoster_git
25-
prompt_agnoster_end
11+
_prompt_agnoster_status
12+
_prompt_agnoster_pwd
13+
_prompt_agnoster_git
14+
_prompt_agnoster_end
2615
}
2716

28-
prompt_agnoster_segment() {
17+
_prompt_agnoster_segment() {
2918
print -n "%K{${1}}"
3019
if [[ -n ${CURRENT_BG} ]] print -n "%F{${CURRENT_BG}}"
31-
print -n "${2}"
20+
print -n ${2}
3221
CURRENT_BG=${1}
3322
}
3423

35-
prompt_agnoster_standout_segment() {
24+
_prompt_agnoster_standout_segment() {
3625
print -n "%S%F{${1}}"
3726
if [[ -n ${CURRENT_BG} ]] print -n "%K{${CURRENT_BG}}%k"
3827
print -n "${2}%s"
3928
CURRENT_BG=${1}
4029
}
4130

42-
prompt_agnoster_end() {
31+
_prompt_agnoster_end() {
4332
print -n "%k%F{${CURRENT_BG}}%f "
4433
}
4534

46-
prompt_agnoster_status() {
47-
local segment=''
48-
if (( RETVAL )) segment+=" %F{red}${RETVAL}"
35+
_prompt_agnoster_status() {
36+
local segment=
37+
if (( RETVAL )) segment+=' %F{red}'${RETVAL}
4938
if (( EUID == 0 )) segment+=' %F{yellow}⚡'
50-
if (( $(jobs -l | wc -l) )) segment+=' %F{cyan}⚙'
39+
if (( ${#jobstates} )) segment+=' %F{cyan}⚙'
5140
if [[ -n ${VIRTUAL_ENV} ]] segment+=" %F{cyan}${VIRTUAL_ENV:t}"
5241
if [[ -n ${SSH_TTY} ]] segment+=" %F{%(!.yellow.default)}%n@%m"
5342
if [[ -n ${segment} ]]; then
54-
prompt_agnoster_segment black "${segment} "
43+
_prompt_agnoster_segment black ${segment}' '
5544
fi
5645
}
5746

58-
prompt_agnoster_pwd() {
59-
prompt_agnoster_standout_segment blue ' %~ '
47+
_prompt_agnoster_pwd() {
48+
local current_dir
49+
prompt-pwd current_dir
50+
_prompt_agnoster_standout_segment blue ' '${current_dir}' '
6051
}
6152

62-
prompt_agnoster_git() {
53+
_prompt_agnoster_git() {
6354
if [[ -n ${git_info} ]]; then
64-
prompt_agnoster_standout_segment ${git_info[color]} " ${(e)git_info[prompt]} "
55+
_prompt_agnoster_standout_segment ${git_info[color]} ' '${(e)git_info[prompt]}' '
6556
fi
6657
}
6758

68-
VIRTUAL_ENV_DISABLE_PROMPT=1
59+
typeset -g VIRTUAL_ENV_DISABLE_PROMPT=1
6960

7061
setopt nopromptbang prompt{cr,percent,sp,subst}
7162

63+
zstyle ':zim:prompt-pwd:fish-style' dir-length 1
64+
65+
typeset -gA git_info
7266
if (( ${+functions[git-info]} )); then
7367
zstyle ':zim:git-info:branch' format ' %b'
7468
zstyle ':zim:git-info:commit' format '➦ %c'
@@ -87,5 +81,5 @@ if (( ${+functions[git-info]} )); then
8781
autoload -Uz add-zsh-hook && add-zsh-hook precmd git-info
8882
fi
8983

90-
PS1='$(prompt_agnoster_main)'
84+
PS1='$(_prompt_agnoster_main)'
9185
unset RPS1

0 commit comments

Comments
 (0)