浏览代码

af-magic: account for active conda envs in dash line

See https://github.com/ohmyzsh/ohmyzsh/issues/8081#issuecomment-632182715
Marc Cornellà 4 年之前
父节点
当前提交
b721053c87
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      themes/af-magic.zsh-theme

+ 8 - 3
themes/af-magic.zsh-theme

@@ -10,9 +10,14 @@ typeset +H my_orange="$FG[214]"
 
 # separator dashes size
 function afmagic_dashes {
-	[[ -n "${VIRTUAL_ENV-}" && -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" && "$PS1" = \(* ]] \
-		&& echo $(( COLUMNS - ${#VIRTUAL_ENV} - 3 )) \
-		|| echo $COLUMNS
+	local PYTHON_ENV="$VIRTUAL_ENV"
+	[[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV"
+
+	if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then
+		echo $(( COLUMNS - ${#PYTHON_ENV} - 3 ))
+	else
+		echo $COLUMNS
+	fi
 }
 
 # primary prompt