Last active
August 29, 2015 14:07
-
-
Save leandrowd/c40d0c63ab4ebc597e95 to your computer and use it in GitHub Desktop.
bash files
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
alias ..="cd .." | |
alias ..2="cd ../.." | |
alias ..3="cd ../../.." | |
alias ..4="cd ../../../.." | |
alias ..5="cd ../../../../.." | |
alias hothouse='cd ~/Documents/dev/hothouse' | |
alias serv-this='python -m SimpleHTTPServer 8000' | |
alias log-nice="git log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)'" | |
alias log-graph='git log --pretty=oneline --decorate --graph' | |
#alias subl='~/./../../Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' | |
alias svn-infinity='svn up --set-depth infinity' | |
alias svn-immediate='svn up --set-depth immediates' | |
alias vimhosts='sudo vim /private/etc/hosts' | |
alias edit-aliases='subl ~/.bash_aliases' | |
alias reload-bash='source ~/.bashrc' | |
alias git-clean-list='git clean -fdxn' | |
alias git-clean-confirm='git clean -xdf' | |
alias git-conflicts="grep -lr '<<<<<<<' ." | |
alias git-conflicts-theirs="grep -lr '<<<<<<<' . | xargs git checkout --theirs" | |
alias git-conflicts-ours="grep -lr '<<<<<<<' . | xargs git checkout --ours" |
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
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt” | |
# Shamelessly copied from https://github.com/gf3/dotfiles | |
# Screenshot: http://i.imgur.com/s0Blh.png | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi | |
if tput setaf 1 &> /dev/null; then | |
tput sgr0 | |
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then | |
MAGENTA=$(tput setaf 9) | |
ORANGE=$(tput setaf 172) | |
GREEN=$(tput setaf 190) | |
PURPLE=$(tput setaf 141) | |
WHITE=$(tput setaf 0) | |
else | |
MAGENTA=$(tput setaf 5) | |
ORANGE=$(tput setaf 4) | |
GREEN=$(tput setaf 2) | |
PURPLE=$(tput setaf 1) | |
WHITE=$(tput setaf 7) | |
fi | |
BOLD=$(tput bold) | |
RESET=$(tput sgr0) | |
else | |
MAGENTA="\033[1;31m" | |
ORANGE="\033[1;33m" | |
GREEN="\033[1;32m" | |
PURPLE="\033[1;35m" | |
WHITE="\033[1;37m" | |
BOLD="" | |
RESET="\033[m" | |
fi | |
export MAGENTA | |
export ORANGE | |
export GREEN | |
export PURPLE | |
export WHITE | |
export BOLD | |
export RESET | |
function parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != *"working directory clean"* ]] && echo "*" | |
} | |
function parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" | |
} | |
export PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]" | |
export PS2="\[$ORANGE\]→ \[$RESET\]" | |
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
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
if [ -f `brew --prefix`/etc/bash_completion ]; then | |
. `brew --prefix`/etc/bash_completion | |
fi | |
export GREP_OPTIONS="--color=auto" | |
export GREP_COLOR="4;33" | |
export CLICOLOR="auto" | |
export HISTCONTROL=ignoredups # don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoreboth # ... and ignore same sucessive entries. | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# make less more friendly for non-text input files, see lesspipe(1) | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
# prompt examples: | |
# [3 jobs master virtualenv] ~/code/myproject/foo | |
# [1 job my-branch virtualenv] ~/code/bar/ | |
# [virtualenv] ~/code/ | |
# ~ | |
# Very, very fast, only requiring a couple of fork()s (and no forking at all to determine the current git branch) | |
if [[ "$USER" == "root" ]] | |
then | |
export PS1="\e[1;31m\]\u \[\e[1;33m\]\w\[\e[0m\] "; | |
else | |
export PS1="\[\e[1;33m\]\w\[\e[0m\] "; | |
fi | |
# 100% pure Bash (no forking) function to determine the name of the current git branch | |
gitbranch() { | |
export GITBRANCH="" | |
local repo="${_GITBRANCH_LAST_REPO-}" | |
local gitdir="" | |
[[ ! -z "$repo" ]] && gitdir="$repo/.git" | |
# If we don't have a last seen git repo, or we are in a different directory | |
if [[ -z "$repo" || "$PWD" != "$repo"* || ! -e "$gitdir" ]]; then | |
local cur="$PWD" | |
while [[ ! -z "$cur" ]]; do | |
if [[ -e "$cur/.git" ]]; then | |
repo="$cur" | |
gitdir="$cur/.git" | |
break | |
fi | |
cur="${cur%/*}" | |
done | |
fi | |
if [[ -z "$gitdir" ]]; then | |
unset _GITBRANCH_LAST_REPO | |
return 0 | |
fi | |
export _GITBRANCH_LAST_REPO="${repo}" | |
local head="" | |
local branch="" | |
read head < "$gitdir/HEAD" | |
case "$head" in | |
ref:*) | |
branch="${head##*/}" | |
;; | |
"") | |
branch="" | |
;; | |
*) | |
branch="d:${head:0:7}" | |
;; | |
esac | |
if [[ -z "$branch" ]]; then | |
return 0 | |
fi | |
export GITBRANCH="$branch" | |
} | |
PS1_green='\[\e[32m\]' | |
PS1_blue='\[\e[34m\]' | |
PS1_reset='\[\e[0m\]' | |
_mk_prompt() { | |
# Change the window title of X terminals | |
case $TERM in | |
xterm*|rxvt*|Eterm) | |
echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007" | |
;; | |
screen) | |
echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\" | |
;; | |
esac | |
# Un-screw virtualenv stuff | |
if [[ ! -z "${_OLD_VIRTUAL_PS1-}" ]]; then | |
export PS1="$_OLD_VIRTUAL_PS1" | |
unset _OLD_VIRTUAL_PS1 | |
fi | |
if [[ -z "${_MK_PROMPT_ORIG_PS1-}" ]]; then | |
export _MK_PROMPT_ORIG_PS1="$PS1" | |
fi | |
local suffix=() | |
local jobcount="$(jobs -p | wc -l)" | |
if [[ "$jobcount" -gt 0 ]]; then | |
local job="${jobcount##* } job" | |
[[ "$jobcount" -gt 1 ]] && job="${job}s" | |
suffix+=("$job") | |
fi | |
gitbranch | |
if [[ ! -z "$GITBRANCH" ]]; then | |
suffix+=("${PS1_green}$GITBRANCH${PS1_reset}") | |
fi | |
local virtualenv="${VIRTUAL_ENV##*/}" | |
if [[ ! -z "$virtualenv" ]]; then | |
suffix+=("${PS1_blue}$virtualenv${PS1_reset}") | |
fi | |
PS1="$_MK_PROMPT_ORIG_PS1" | |
if [[ ! -z "$suffix" ]]; then | |
PS1="$PS1 [${suffix[@]}] " | |
fi | |
export PS1 | |
} | |
export PROMPT_COMMAND=_mk_prompt | |
PATH=${PATH}:/Library/Python/2.7/ | |
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting | |
### Added by the Heroku Toolbelt | |
export PATH="/usr/local/heroku/bin:$PATH" |
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
[user] | |
name = Leandro Lemos | |
email = [email protected] | |
[alias] | |
co=checkout | |
br=branch | |
ci=commit | |
st=status | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
who = shortlog -s -- | |
fl = log -p | |
lgs = log --oneline --decorate | |
sb = status -sb | |
dw = diff --word-diff | |
undo = reset --soft HEAD~1 | |
[core] | |
editor = vim | |
excludesfile = /Users/leandrowd/.gitignore_global | |
pager = less -r | |
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
preloadindex = true | |
fscache = true | |
longpaths = true | |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
interactive = auto | |
[color "branch"] | |
current = yellow bold | |
local = yellow | |
remote = red | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
whitespace = red reverse | |
[color "status"] | |
header = normal bold | |
added = green bold | |
changed = red bold | |
untracked = yellow bold | |
[push] | |
default = matching | |
[branch] | |
autosetuprebase = always | |
[help] | |
autocorrect = 1 | |
[difftool "sourcetree"] | |
cmd = opendiff \"$LOCAL\" \"$REMOTE\" | |
path = | |
[filter "media"] | |
clean = git-media-clean %f | |
smudge = git-media-smudge %f | |
[gc] | |
auto = 256 | |
[merge] | |
renamelimit = 8192 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment