Skip to content

Instantly share code, notes, and snippets.

@kylefox kylefox/.profile.sh
Last active Oct 17, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.