Files
dotfiles/.zsh/theme/prompts/main.zsh
2024-10-30 12:37:58 +01:00

42 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Neue Funktionen für die Versionsinformationen
function get_node_version() {
if [[ -f package.json ]]; then
if [[ -f pnpm-lock.yaml ]]; then
echo "%F{magenta}pnpm $(pnpm --version)%f "
elif [[ -f package-lock.json ]]; then
echo "%F{red}npm $(npm --version)%f "
fi
fi
}
function get_deno_version() {
if [[ -f deno.json || -f deno.jsonc ]]; then
echo "%F{green}deno $(deno --version | head -n1 | cut -d' ' -f2)%f "
fi
}
# Aktualisierte Prompt-Funktion
function set_prompt() {
if [[ -n "$SSH_CONNECTION" ]]; then
local user_host="%B%F{yellow}server%f%b"
else
local user_host="%B%F{green}local%f%b"
fi
local user_symbol='%(!.#.$)'
local current_dir="%B%F{blue}%~%f%b "
local conda_info=$(conda_prompt_info)
local vcs_info="$(git_prompt_info)"
local ruby_info=$(ruby_prompt_info)
local venv_info=$(virtualenv_prompt_info)
local kube_info=$(get_kubectl_context)
local node_info=$(get_node_version)
local deno_info=$(get_deno_version)
PS1="${conda_info}${user_host}${current_dir}${node_info}${deno_info}${ruby_info}${vcs_info}${venv_info}${kube_info}
△ %B${user_symbol}%b "
RPROMPT="%B${return_code}%b"
}
precmd_functions+=(set_prompt)