domdit.com


My Bash Theme: A Quick Snippet to Avoid Unnecessary Bloat

I recently wanted to get away from the default bash theme, so I tried looking around for themes online and it seems like SEO tends to recommend things like OhMyZsh and OhMyBash. I really liked the zork theme that OhMyBash provided, so I broke one of my rules and installed OhMyBash–which the creator claims “comes with a sh*t load of plugins to take advantage of”–despite only wanting one feature.

I ignored the plugins and ignored the unnecessary explitives in the README, and enjoyed the zork theme for a few weeks until I decided I needed to figure out how to make my own theme instead of accepting bloat for aesthetics. I looked at the zork theme source code, pared it down to just what I need, and deleted OhMyBash.

My theme looks like this:

┌─(venv)[dominic@t480][~/repos/scoundrel] (master)
└─▶ 

It includes display of branches and virtual environments and nothing extra. There are colors but I do not feel like dealing with an image for this post.

Put this in your .bashrc:

# ----- START THEME -----
RESTORE='\033[0m'
PURPLE='\033[00;35m'
LRED='\033[01;31m'
LGREEN='\033[01;32m'
LBLUE='\033[01;34m'
LCYAN='\033[01;36m'

virtual_env() {
	if [ -n "$VIRTUAL_ENV" ]; then
		echo "(${VIRTUAL_ENV##*/})"
	fi
	echo ""
}

parse_git_branch() {
	git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

export VIRTUAL_ENV_DISABLE_PROMPT=1
export PS1="${TITLEBAR}┌─${LRED}\$(virtual_env)${RESTORE}[${LCYAN}\u${RESTORE}@${LBLUE}\h${RESTORE}][\w]${PURPLE}\$(parse_git_branch)${RESTORE}\n└─▶ "
# ----- END THEME -----
Tags:

Webrings

domdit.com


My Bash Theme: A Quick Snippet to Avoid Unnecessary Bloat

I recently wanted to get away from the default bash theme, so I tried looking around for themes online and it seems like SEO tends to recommend things like OhMyZsh and OhMyBash. I really liked the zork theme that OhMyBash provided, so I broke one of my rules and installed OhMyBash–which the creator claims “comes with a sh*t load of plugins to take advantage of”–despite only wanting one feature.

I ignored the plugins and ignored the unnecessary explitives in the README, and enjoyed the zork theme for a few weeks until I decided I needed to figure out how to make my own theme instead of accepting bloat for aesthetics. I looked at the zork theme source code, pared it down to just what I need, and deleted OhMyBash.

My theme looks like this:

┌─(venv)[dominic@t480][~/repos/scoundrel] (master)
└─▶ 

It includes display of branches and virtual environments and nothing extra. There are colors but I do not feel like dealing with an image for this post.

Put this in your .bashrc:

# ----- START THEME -----
RESTORE='\033[0m'
PURPLE='\033[00;35m'
LRED='\033[01;31m'
LGREEN='\033[01;32m'
LBLUE='\033[01;34m'
LCYAN='\033[01;36m'

virtual_env() {
	if [ -n "$VIRTUAL_ENV" ]; then
		echo "(${VIRTUAL_ENV##*/})"
	fi
	echo ""
}

parse_git_branch() {
	git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

export VIRTUAL_ENV_DISABLE_PROMPT=1
export PS1="${TITLEBAR}┌─${LRED}\$(virtual_env)${RESTORE}[${LCYAN}\u${RESTORE}@${LBLUE}\h${RESTORE}][\w]${PURPLE}\$(parse_git_branch)${RESTORE}\n└─▶ "
# ----- END THEME -----
Tags: