Created
July 19, 2011 13:53
-
-
Save benjaminplee/1092427 to your computer and use it in GitHub Desktop.
config files
This file contains 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
export CLICOLOR=1 | |
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx | |
alias ll="pwd; ls -lhaG" | |
alias lll="ll | less" | |
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" | |
alias scmtree="find . -print | grep -v "\.svn" | grep -v "\.git" | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" | |
alist gitbranchesbydate="for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:\"%Cgreen%ci %Cblue%cr%Creset\" $k|head -n 1`\\t$k;done|sort -r" | |
alias t="rake test" | |
alias st="git st" | |
alias ci="git ci" | |
alias ad="git add" | |
alias hist="git hist" | |
alias wdiff="git wdiff" | |
alias bra="git bra" |
This file contains 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
#!/bin/bash | |
# | |
# Set our bash prompt according to the branch/status of the current git | |
# repository. | |
# | |
# Taken from http://gist.github.com/31934 | |
RED="\[\e[0;31m\]" | |
GREEN="\[\e[0;32m\]" | |
YELLOW="\[\e[0;33m\]" | |
BLUE="\[\e[0;34m\]" | |
MAGENTA="\[\e[0;35m\]" | |
CYAN="\[\e[0;36m\]" | |
GRAY="\[\e[0;37m\]" | |
LIGHT_RED="\[\e[1;31m\]" | |
LIGHT_GREEN="\[\e[1;32m\]" | |
LIGHT_YELLOW="\[\e[1;33m\]" | |
LIGHT_BLUE="\[\e[1;34m\]" | |
LIGHT_MAGENTA="\[\e[1;35m\]" | |
LIGHT_CYAN="\[\e[1;36m\]" | |
WHITE="\[\e[1;37m\]" | |
COLOR_NONE="\[\e[0m\]" | |
function is_git_repository { | |
git branch > /dev/null 2>&1 | |
} | |
function parse_git_branch { | |
# Only display git info if we're inside a git repository. | |
is_git_repository || return 1 | |
# Capture the output of the "git status" command. | |
git_status="$(git status 2> /dev/null)" | |
git_stash="$(git stash list 2> /dev/null)" | |
# Set color based on clean/staged/dirty. | |
if [[ ${git_status} =~ "working directory clean" ]]; then | |
state="${GREEN}" | |
elif [[ ${git_status} =~ "Changes to be committed" ]]; then | |
state="${YELLOW}" | |
else | |
state="${RED}" | |
fi | |
if [[ -n ${git_stash} ]]; then | |
stash="${MAGENTA}*" | |
fi | |
# Set arrow icon based on status against remote. | |
if [[ ${git_status} =~ "# Your branch is ahead" ]]; then | |
remote="↑" | |
elif [[ ${git_status} =~ "# Your branch is behind" ]]; then | |
remote="↓" | |
elif [[ ${git_status} =~ ' have diverged' ]]; then | |
remote="↔" | |
fi | |
# Get the name of the branch. | |
branch_pattern="^# On branch ([^${IFS}]*)" | |
if [[ ${git_status} =~ ${branch_pattern} ]]; then | |
branch="(${BASH_REMATCH[1]})" | |
else | |
branch="{Detached HEAD}" | |
fi | |
# Display the prompt. | |
echo "${state}${branch}${remote}${stash}${COLOR_NONE} " | |
} | |
function prompt_symbol () { | |
# Set color of dollar prompt based on return value of previous command. | |
if test $1 -eq 0 | |
then | |
echo "\$" | |
else | |
echo "${RED}\$${COLOR_NONE}" | |
fi | |
} | |
function prompt_func () { | |
last_return_value=$? | |
PS1="\u@ ${GREEN}\w${COLOR_NONE} $(parse_git_branch)\n$(prompt_symbol $last_return_value) " | |
echo -n -e "\033]0;$USER@$HOSTNAME:$PWD\007\n" | |
} | |
PROMPT_COMMAND=prompt_func |
This file contains 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] | |
st = status | |
co = checkout | |
ci = commit | |
bra = branch -a | |
wdiff = diff --word-diff=color | |
lg = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short | |
hist = log --graph --pretty=format:'%Cred%h%Creset %Cblue%ad%Creset - %s%C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=short | |
allhist = log --graph --pretty=format:'%Cred%h%Creset %Cblue%ad%Creset - %s%C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=short --all | |
[color] | |
ui = true | |
[core] | |
autocrlf = input |
This file contains 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
" highlight search | |
set hlsearch | |
" incremental search (as you type) | |
set incsearch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment