bastos (owner)

Revisions

gist: 88202 Download_button fork
public
Public Clone URL: git://gist.github.com/88202.git
Embed All Files: show embed
Bash #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# do not make noise
set bell-style none
 
export PATH=~/.gem/ruby/1.8/bin/:$PATH
 
# Mysql
alias mysqlstart='sudo /opt/local/bin/mysqld_safe5 &'
alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'
 
# http://pastebin.com/f7a69dcd7
function tvim() {
gvim --servername `gvim --serverlist | head -1` --remote-tab "$@";
}
 
# always use utf-8
export LC_CTYPE=en_US.UTF-8
 
# editors
export SVN_EDITOR='mate -w'
export EDITOR='mate -w'
 
#### JAVA
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
 
#### History stuff
export HISTCONTROL=erasedups # don't store duplicates
export HISTSIZE=10000 # more history pls
shopt -s histappend # make sure history is saved when session ends
 
#### Aliases
 
# for editing / reloading profile
alias eprof="mate ~/.bash_profile"
alias reload="source ~/.bash_profile"
 
# remove all .svn directories from where we are
alias svnclean="find . -iname '.svn' | xargs rm -rf"
 
# source control
alias gac="git add . && git commit -a -m"
alias sup="svn up"
 
# lazy rails / merb commands
alias ss="./script/server"
alias sc="./script/console"
alias mig="rake db:migrate"
alias mat="merb -a thin"
 
# misc
alias m="mate ."
alias c="clear"
alias h="history"
alias hgrep="history | grep"
alias flushdns="dscacheutil -flushcache"
alias ll="ls -al"
 
#### set tab title to working directory
function set_window_and_tab_title
{
    local title="$1"
    if [[ -z "$title" ]]; then
title="root"
    fi
 
local tmpdir=~/Library/Caches/${FUNCNAME}_temp
    local cmdfile="$tmpdir/$title"
 
    # Set window title
    echo -n -e "\e]0;${title}\a"
 
    # Set tab title
    if [[ -n ${CURRENT_TAB_TITLE_PID:+1} ]]; then
kill $CURRENT_TAB_TITLE_PID
    fi
mkdir -p $tmpdir
    ln /bin/sleep "$cmdfile"
    "$cmdfile" 10 &
    CURRENT_TAB_TITLE_PID=$(jobs -x echo %+)
    disown %+
    kill -STOP $CURRENT_TAB_TITLE_PID
    command rm -f "$cmdfile"
}
 
PROMPT_COMMAND='set_window_and_tab_title "${PWD##*/}"'
 
 
#### put git branch & status in prompt
 
        RED="\[\033[0;31m\]"
     YELLOW="\[\033[0;33m\]"
    GREEN="\[\033[0;32m\]"
       BLUE="\[\033[0;34m\]"
  LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
      WHITE="\[\033[1;37m\]"
 LIGHT_GRAY="\[\033[0;37m\]"
 COLOR_NONE="\[\e[0m\]"
       GRAY="\[\033[1;30m\]"
 
function parse_git_dirty {
  [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (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="${GREEN}\w${YELLOW}$(parse_git_branch)${COLOR_NONE}$ "