From c076f898dca57acf5d7df5f4bbce21a1153c501b Mon Sep 17 00:00:00 2001 From: SATHISH P <141696697+sathish46-lab@users.noreply.github.com> Date: Thu, 4 Jul 2024 23:05:30 +0530 Subject: [PATCH] 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 --- cupcake_theme.zsh-theme | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cupcake_theme.zsh-theme diff --git a/cupcake_theme.zsh-theme b/cupcake_theme.zsh-theme new file mode 100644 index 000000000..f6eb1aafe --- /dev/null +++ b/cupcake_theme.zsh-theme @@ -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')