Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kylefox
Last active October 17, 2017 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefox/4dbb3c79e37c6b5756f6f6ea6bd4e327 to your computer and use it in GitHub Desktop.
Save kylefox/4dbb3c79e37c6b5756f6f6ea6bd4e327 to your computer and use it in GitHub Desktop.
Dracula terminal prompt. Screenshot: http://drops.kylefox.ca/F18fuY
####################################################################################
# Dracula themed prompt
# https://github.com/dracula/terminal.app/issues/2#issuecomment-254878940
# Colors
black="\[$(tput setaf 0)\]"
red="\[$(tput setaf 1)\]"
green="\[$(tput setaf 2)\]"
yellow="\[$(tput setaf 3)\]"
blue="\[$(tput setaf 4)\]"
magenta="\[$(tput setaf 5)\]"
cyan="\[$(tput setaf 6)\]"
white="\[$(tput setaf 7)\]"
# Title bar - "user@host: ~"
title="\u@\h: \w"
titlebar="\[\033]0;"$title"\007\]"
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/$(parse_git_dirty)\1$(parse_git_dirty)/"
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "$(tput setaf 3)\▴$(tput setaf 6)"
}
# Clear attributes
clear_attributes="\[$(tput sgr0)\] "
# Custom bash prompt - "➜ ~ (master) "
export PS1="${titlebar}${green}➜ ${blue}\W ${cyan}\$(parse_git_branch)${clear_attributes}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment