Created
October 4, 2016 20:52
-
-
Save bcleenders/7e731a0d0e1d7477dfacbe8992d8e3ba to your computer and use it in GitHub Desktop.
.bash_profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I like tunning the colors of the prompt in the first place: | |
export CLICOLOR='true' | |
export LSCOLORS="gxfxcxdxbxCgCdabagacad" | |
export EDITOR=vi | |
# Git branch in good-looking prompt. | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
# Prompt with Git branch | |
# Explanation of the weird lines: \u Username, \h Host, \w Path, tput setaf is the color definition | |
# export PS1='\[$(tput setaf 7)\]\u@\[$(tput setaf 2)\]\h:\[$(tput setaf 4)\]\w$(tput setaf 1)\]$(parse_git_branch)\[$(tput sgr0)\] $ ' | |
export PS1="\\[$(tput setaf 7)\\]\\u@\\[$(tput setaf 2)\\]\h:\\[$(tput setaf 4)\\]\\w$(tput setaf 1)\\]\$(type -t parse_git_branch >/dev/null && parse_git_branch)\\[$(tput sgr0)\\]$ " | |
# Avoid errors with inheritance of PS1 to other logins | |
# export -n PS1 | |
# Bonus track: SSH autocompleting hostnames, write ssh and press tab | |
complete -W "$(while read line; do echo ${line%%[, ]*}; done < ~/.ssh/known_hosts)" ssh | |
# Git autocompletion | |
# Requires that you execute the following commented line: | |
# curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash | |
test -f ~/.git-completion.bash && . $_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment