DEV Community

Cover image for Colorize Your MacOS Terminal with the Dracula Theme
Shuhua Liu
Shuhua Liu

Posted on

Colorize Your MacOS Terminal with the Dracula Theme

Liquid syntax error: Unknown tag 'endraw'

Top comments (1)

Collapse
 
tajuton profile image
Tajuton Hemmo • Edited

Great tutorial!

I had some problems with my Z shell (zsh). The git branch name wasn't updated when changing the directory, so I modified the original code in .zshrc a bit. I had to add setopt prompt_subst and use single quotes to make it work.

# get current branch
function parse_git_branch() {
    BRANCH=$(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
    if [ -n "${BRANCH}" ]; then
        echo "(${BRANCH}) "
    else
        echo ""
    fi
}

setopt prompt_subst
PROMPT='%F{green}➤➤%f '                  # start prompt
PROMPT+='%F{blue}%1d%f '                # current directory
PROMPT+='%F{cyan}$(parse_git_branch)%f' # current branch
PROMPT+='%F{green}$%f '                 # end prompt

export PROMPT
Enter fullscreen mode Exit fullscreen mode