Skip to content

Instantly share code, notes, and snippets.

@AndrewMontagne
Last active June 27, 2019 10:54
Show Gist options
  • Save AndrewMontagne/822c76e4c5c068a9c53788cdcbcabc98 to your computer and use it in GitHub Desktop.
Save AndrewMontagne/822c76e4c5c068a9c53788cdcbcabc98 to your computer and use it in GitHub Desktop.
terminal stuff
#!/bin/bash
BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
if [ -z "$(git status -s)" ]; then
echo -ne " \001\033[48;5;2m"
elif [ "$(git ls-files --exclude-standard --others)" ]; then
echo -ne " \001\033[48;5;1m"
else
echo -ne " \001\033[48;5;3m"
fi
echo -e "\033[38;5;0m\002 ${BRANCH}"
fi
set autoindent
set tabsize 4
set nohelp
set const
set mouse
if test -n "$ZSH_VERSION"; then
setopt PROMPT_SUBST
export PROMPT='%F{015}%T%f %K{004}%F{000} %3~$(~/.git-branch.sh) %k%f '
fpath=(~/.zsh $fpath)
TMOUT=10
TRAPALRM() {
zle reset-prompt
}
else
export PS1='\[\033]0;\w $ bash\007\033[38;5;15m\]\A \[\033[38;5;0m\033[48;5;4m\] \w$(~/.git-branch.sh) \[$(tput sgr0)\] '
source git-completion.bash
fi
trap 'echo -ne "\001\033]0;$(dirs +0) $ $BASH_COMMAND\007\002"' DEBUG
alias ll="ls -lahG"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment