From 6f2507352487bab31d3c817d67f0bc4f9d793e28 Mon Sep 17 00:00:00 2001 From: "Adam A.G. Shamblin" Date: Mon, 9 Jun 2014 10:21:25 -0600 Subject: [PATCH] Update bash profile to show git branch at prompt. --- dotbash_profile | 19 +++++++++++++++---- dotvimrc | 6 +++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/dotbash_profile b/dotbash_profile index 5cb46f1..43fa9cd 100644 --- a/dotbash_profile +++ b/dotbash_profile @@ -1,6 +1,9 @@ export CLICOLOR=1 -export PATH=~/bin:/usr/local/bin:$PATH export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH" +export GRADLE_HOME=$HOME/bin/gradle +export ANDROID_PATH=/Applications/Android\ Studio.app/sdk/platform-tools:/Applications/Android\ Studio.app/sdk/tools +export POSTGRES_PATH=/Applications/Postgres.app/Contents/Versions/9.3/bin +export PATH=~/bin:/usr/local/bin:$PATH:$GRADLE_HOME/bin:$ANDROID_PATH:$POSTGRES_PATH YELLOW=$(tput setaf 136); ORANGE=$(tput setaf 166); @@ -8,10 +11,19 @@ GREEN=$(tput setaf 64); BASE2=$(tput setaf 254); RESET=$(tput sgr0); +if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then + . /usr/local/git/contrib/completion/git-completion.bash +fi + # Change the prompt character when encountering git repositories function prompt_char { - git branch >/dev/null 2>/dev/null && echo '⤧ ' && return - echo '$' + if ! git rev-parse --git-dir > /dev/null 2>&1; then + echo '$' + return 0 + fi + + git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') + echo "($git_branch) $" } # Automatically activate virtualenv when encountered, @@ -28,7 +40,6 @@ function activate_env { unset HAS_DEACTIVATE } export PROMPT_COMMAND=activate_env - export PS1='\[$ORANGE\]\u\[$RESET\] @ \[$YELLOW\]\h\[$RESET\] in \[$GREEN\]\w\[$RESET\]\n\[$BASE2\]$(prompt_char)\[$RESET\] ' diff --git a/dotvimrc b/dotvimrc index e8dc175..a1d6824 100644 --- a/dotvimrc +++ b/dotvimrc @@ -12,17 +12,21 @@ set softtabstop=4 set tabstop=4 set shiftwidth=4 set noerrorbells +set visualbell set vb set colorcolumn=80 set hlsearch +set mouse=a +set ttymouse=xterm2 + filetype plugin indent on autocmd FileType make setlocal noexpandtab au BufNewFile,BufRead *.json set filetype=javascript au BufNewFile,BufRead /usr/local/nginx/conf/* set filetype=nginx -au BufNewFile,BufRead *.md setlocal textwidth=80 +au BufNewFile,BufRead *.md,*.txt setlocal textwidth=80 au BufWritePost *.py call Flake8() au BufWritePost *.js :JSHint -- 2.39.5