mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
create jijeesh Theme
This commit is contained in:
parent
862bfc81d2
commit
565d9ec283
1 changed files with 27 additions and 15 deletions
|
|
@ -8,52 +8,64 @@
|
||||||
# In order for this theme to render correctly, you will need a
|
# In order for this theme to render correctly, you will need a
|
||||||
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
|
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
|
||||||
|
|
||||||
|
# Return code indicator
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
# Function to determine system emoji
|
||||||
function toon {
|
function toon {
|
||||||
local os_type="$(uname -s)"
|
case "$(uname -s)" in
|
||||||
case "${os_type}" in
|
|
||||||
"Darwin") echo -n "🍎" ;; # macOS
|
"Darwin") echo -n "🍎" ;; # macOS
|
||||||
"Linux") echo -n "🐧" ;; # Linux (Ubuntu)
|
"Linux") echo -n "🐧" ;; # Linux (Ubuntu)
|
||||||
*) echo -n "♔" ;; # Default emoji for unknown OS
|
*) echo -n "♔" ;; # Default emoji for unknown OS
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to display Kubernetes symbol
|
||||||
function k8sSymbol {
|
function k8sSymbol {
|
||||||
echo -n " ☸ "
|
echo -n " ☸ "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to display Git symbol
|
||||||
function gitSymbol {
|
function gitSymbol {
|
||||||
echo -n " \uE0A0 "
|
echo -n " \uE0A0 "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to get Kubernetes prompt info
|
||||||
function kubect_prompt_info() {
|
function kubect_prompt_info() {
|
||||||
local kubectl_prompt="$(kubectl config current-context)"
|
local kubectl_prompt="$(kubectl config current-context)"
|
||||||
local kgnc_prompt="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
local kgnc_prompt="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
||||||
# prompt_segment blue yellow
|
|
||||||
echo -n "${ZSH_THEME_KUBECTL_PROMPT_PREFIX}${kgnc_prompt}${ZSH_THEME_KUBECTL_PROMPT_SUFFIX}"
|
echo -n "${ZSH_THEME_KUBECTL_PROMPT_PREFIX}${kgnc_prompt}${ZSH_THEME_KUBECTL_PROMPT_SUFFIX}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# User and host prompt
|
||||||
if [[ $UID -eq 0 ]]; then
|
if [[ $UID -eq 0 ]]; then
|
||||||
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
|
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
|
||||||
local user_symbol='#'
|
local user_symbol='#'
|
||||||
else
|
else
|
||||||
local user_host='%{$terminfo[bold]$fg[green]%}%n %{$reset_color%}'
|
local user_host='%{$terminfo[bold]$fg[green]%}%n %{$reset_color%}'
|
||||||
local user_symbol='$'
|
local user_symbol='$'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Kubernetes symbol display if ~/.kube directory exists
|
||||||
if [ -d ~/.kube ]; then
|
if [ -d ~/.kube ]; then
|
||||||
local k8s_symbol='%{$fg_bold[blue]%}$(k8sSymbol) $(kubect_prompt_info) %{$reset_color%}'
|
local k8s_symbol='%{$fg_bold[blue]%}$(k8sSymbol) $(kubect_prompt_info) %{$reset_color%}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Current directory prompt
|
||||||
local current_dir='%{$fg_bold[red]%}$(toon)% %{$terminfo[bold]$fg_bold[yellow]%}%~ %{$reset_color%}'
|
local current_dir='%{$fg_bold[red]%}$(toon)% %{$terminfo[bold]$fg_bold[yellow]%}%~ %{$reset_color%}'
|
||||||
|
|
||||||
|
# Git branch prompt
|
||||||
local git_branch='$(git_prompt_info)'
|
local git_branch='$(git_prompt_info)'
|
||||||
|
|
||||||
|
# Main prompt setup
|
||||||
|
|
||||||
PROMPT="╭─${user_host}${k8s_symbol}${git_branch}
|
PROMPT="╭─${user_host}${k8s_symbol}${git_branch}
|
||||||
${current_dir}
|
${current_dir}
|
||||||
╰─%B${user_symbol}%b "
|
╰─%B${user_symbol}%b "
|
||||||
RPROMPT="%B${return_code}%b"
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[red]%}$(gitSymbol)%{$reset_color%}%{$fg_bold[red]%} "
|
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
|
|
||||||
|
|
||||||
|
|
||||||
|
# Right prompt setup
|
||||||
|
RPROMPT="%B${return_code}%b"
|
||||||
|
|
||||||
|
# Git prompt configuration
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[red]%}$(gitSymbol)%{$reset_color%}%{$fg_bold[red]%} "
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue