Skip to content

Instantly share code, notes, and snippets.

@skarrman
Last active August 16, 2021 15:46
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 skarrman/b9fb989b75f31fc0a54e7617c8636c11 to your computer and use it in GitHub Desktop.
Save skarrman/b9fb989b75f31fc0a54e7617c8636c11 to your computer and use it in GitHub Desktop.
Bash profile base config
# General alias
alias c='code .'
alias nt='open . -a Terminal'
# Increase history file size
HISTSIZE=100000
HISTFILESIZE=100000
# Sync history:
# Avoid duplicates
HISTCONTROL=ignoredups:erasedups
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# After each command, append to the history file and reread it
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# Git autocomplete - Brew package install required
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
# Git branch in prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\h:\W \u\[\033[32m\]\$(parse_git_branch)\[\033[00m\]$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment