mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Create cupcake_theme.zsh-theme
Add custom Zsh theme with personalized prompt - Created a new custom theme file: my_awesome_theme.zsh-theme - Customized main prompt to include: - User, host, and directory icons - Git branch information - Virtual environment indicator - Defined a continuation prompt - Updated .zshrc to use the custom theme
This commit is contained in:
parent
08869ead02
commit
c076f898dc
1 changed files with 44 additions and 0 deletions
44
cupcake_theme.zsh-theme
Normal file
44
cupcake_theme.zsh-theme
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Set main prompt
|
||||
function main_prompt() {
|
||||
local icon_user="🥷"
|
||||
local icon_host="💻"
|
||||
local icon_directory="📁"
|
||||
local icon_branch="🕉️"
|
||||
local icon_end="└❯"
|
||||
local virtualenv_char="ⓔ"
|
||||
|
||||
# Check if inside a virtual environment
|
||||
local virtualenv_prompt=""
|
||||
if [[ -n $VIRTUAL_ENV ]]; then
|
||||
virtualenv_prompt="%{$fg_bold[blue]%}${virtualenv_char}%{$reset_color%} "
|
||||
fi
|
||||
|
||||
# Git branch information
|
||||
local git_prompt=""
|
||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
local branch=$(git symbolic-ref --short HEAD 2>/dev/null)
|
||||
if [ -n "$branch" ]; then
|
||||
git_prompt=" on ${icon_branch} ${branch}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set main prompt
|
||||
PS1="%{$fg_bold[green]%}┌ ${icon_user} %n @ ${icon_host} %M %{$fg_bold[cyan]%}${icon_directory} %~${virtualenv_prompt}${git_prompt}%{$reset_color%} %{%} %{$fg_bold[green]%}%{$reset_color%}%n${icon_end} "
|
||||
}
|
||||
|
||||
# Set continuation prompt
|
||||
function continuation_prompt() {
|
||||
PS2="${icon_end} "
|
||||
}
|
||||
|
||||
# Call main_prompt function before each command
|
||||
precmd_functions+=('main_prompt')
|
||||
|
||||
# Set continuation prompt function
|
||||
_omb_theme_PROMPT_COMMAND() {
|
||||
main_prompt
|
||||
continuation_prompt
|
||||
}
|
||||
|
||||
# Call _omb_theme_PROMPT_COMMAND function before each command
|
||||
precmd_functions+=('_omb_theme_PROMPT_COMMAND')
|
||||
Loading…
Add table
Add a link
Reference in a new issue