Created
April 6, 2016 00:29
-
-
Save sdague/420057b0524d71b9f5e7ba90b020970b to your computer and use it in GitHub Desktop.
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
# -*- shell-script -*- | |
# .bashrc | |
export TERM=xterm-256color | |
# this creates a unified history across all bash instances on your | |
# system. It takes a little getting used to, but is pretty incredible | |
# in combination with ctrl-R to reverse search history. | |
shopt -s histappend | |
export PROMPT_COMMAND="history -a; history -n; $PROMPT_COMMAND" | |
# This is a utility function to give you git branch in the prompt | |
# if you are in a git directory | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
alias ls='ls -F --color' | |
alias drush='sudo -u www-data drush' | |
source /usr/share/autojump/autojump.sh | |
function E() { | |
emacsclient -c -a emacs "/sudo:root@localhost:$1" | |
} | |
export PROMPT_DIRTRIM=3 | |
RED="\[$(tput setaf 1)\]" | |
BLUE="\[$(tput setaf 111)\]" | |
YELLOW="\[$(tput setaf 214)\]" | |
RESET="\[$(tput sgr0)\]" | |
# setup variables for prompt color codes. Makes it much easier to | |
# read the prompt code below | |
function proml { | |
# These variables are used for prompt and title | |
MYUSER="" | |
XMYUSER="" | |
# if I'm not sdague on a system, make it explicit | |
# what my username is. | |
if [[ `whoami` != 'sdague' ]]; then | |
MYUSER='\u@' | |
fi | |
# if this terminal "is" an xterm (or compatible) build | |
# a titlebar variable which is the same as the prompt more or less | |
case $TERM in | |
xterm*) | |
TITLEBAR="\[\033]0;$MYUSER\h:\w\007\]" | |
;; | |
*) | |
TITLEBAR="" | |
;; | |
esac | |
# PS1 - normal prompt | |
# set title bar | |
# set prompt to yellow user@host : red directory (green git branch) > | |
PS1="${TITLEBAR}\ | |
$YELLOW$MYUSER\h$RED:\w$BLUE\$(parse_git_branch)\ | |
$RED> $RESET" | |
PS2='> ' | |
PS4='+ ' | |
} | |
proml | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# the variable is not defined, and after the /etc/inputrc | |
# include the ~/.inputrc | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
# because I'm not sure all platforms do this | |
export PAGER=less | |
# allow core files, I do development, and I want to see them | |
ulimit -c unlimited | |
# yes, I'm one of those guys | |
export EDITOR="jmacs" | |
PATH="/usr/lib/ccache:$PATH:~/bin" | |
# these variables must be exported | |
export PATH PS1 | |
if [[ -e ~/.vault_pass.txt ]]; then | |
export ANSIBLE_VAULT_PASSWORD_FILE=~/.vault_pass.txt | |
fi | |
export HISTIGNORE="&:ls:exit" | |
# Neat tricks from nibalizer | |
alias yamlcheck='python -c "import sys, yaml as y; y.safe_load(open(sys.argv[1]))"' | |
alias jsoncheck='jq "." >/dev/null <' | |
# Get to the root of the current git tree | |
function cdr { | |
local temp_pwd=`pwd` | |
while ! [ -d .git ]; do | |
cd .. | |
done | |
OLDPWD=$temp_pwd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment