Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 218 lines (179 sloc) 5.739 kb
f3b43562 »
2011-08-31 cleaned up bashrc
1 # -*- mode: sh -*-
042276e5 »
2012-04-04 added better detection of color prompt
2 # ~/.bashrc: executed by bash(1) for non-login shells.
3 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
4 # for examples
649ea741 »
2011-02-08 added bash config
5
6 # If not running interactively, don't do anything
7 [ -z "$PS1" ] && return
8
3c80644d »
2011-09-28 fixed some errors with bashrc
9 # Debian doesn't seem to have a TMPDIR variable any more :(
10 [ -z "$TMPDIR" ] && TMPDIR=/tmp/
11
649ea741 »
2011-02-08 added bash config
12 # don't put duplicate lines in the history. See bash(1) for more options
13 # don't overwrite GNU Midnight Commander's setting of `ignorespace'.
5c5c56ff »
2011-02-09 updated bashrc with latests debian skel
14 export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
649ea741 »
2011-02-08 added bash config
15 # ... or force ignoredups and ignorespace
5c5c56ff »
2011-02-09 updated bashrc with latests debian skel
16 export HISTCONTROL=ignoreboth
649ea741 »
2011-02-08 added bash config
17
18 # append to the history file, don't overwrite it
19 shopt -s histappend
20
21 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
da84d9d3 »
2011-06-08 added colour interactive and ui to git config
22 HISTSIZE=1000
23 HISTFILESIZE=2000
649ea741 »
2011-02-08 added bash config
24
25 # check the window size after each command and, if necessary,
26 # update the values of LINES and COLUMNS.
27 shopt -s checkwinsize
28
29 # make less more friendly for non-text input files, see lesspipe(1)
30 #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
31
f3b43562 »
2011-08-31 cleaned up bashrc
32 # Detect OSX
3c80644d »
2011-09-28 fixed some errors with bashrc
33 DARWIN=0
01567fbd »
2011-08-29 added color ls for darwin
34 if [ $(uname) == "Darwin" ]; then
35 DARWIN=1;
36 fi
37
649ea741 »
2011-02-08 added bash config
38 # set variable identifying the chroot you work in (used in the prompt below)
39 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
40 debian_chroot=$(cat /etc/debian_chroot)
41 fi
42
43 case "$TERM" in
fab3fc1f »
2012-04-11 simpler color prompt decision
44 dumb) ;;
649ea741 »
2011-02-08 added bash config
45 xterm-color) color_prompt=yes;;
fab3fc1f »
2012-04-11 simpler color prompt decision
46 xterm) color_prompt=yes;;
649ea741 »
2011-02-08 added bash config
47 esac
48
49 # uncomment for a colored prompt, if the terminal has the capability; turned
50 # off by default to not distract the user: the focus in a terminal window
51 # should be on the output of commands, not on the prompt
042276e5 »
2012-04-04 added better detection of color prompt
52 # force_color_prompt=yes
649ea741 »
2011-02-08 added bash config
53
0404f891 »
2011-04-21 added git prompt to show current branch
54 # git prompt
55 function parse_git_branch {
56 ref=$(git symbolic-ref HEAD 2> /dev/null) || return
57 echo " ("${ref#refs/heads/}")"
58 }
59
60
649ea741 »
2011-02-08 added bash config
61 if [ -n "$force_color_prompt" ]; then
62 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
63 # We have color support; assume it's compliant with Ecma-48
64 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
65 # a case would tend to support setf rather than setaf.)
66 color_prompt=yes
649ea741 »
2011-02-08 added bash config
67 else
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
68 color_prompt=
649ea741 »
2011-02-08 added bash config
69 fi
70 fi
71
72 if [ "$color_prompt" = yes ]; then
f3b43562 »
2011-08-31 cleaned up bashrc
73 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(parse_git_branch)\$ '
649ea741 »
2011-02-08 added bash config
74 else
75 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
76 fi
77 unset color_prompt force_color_prompt
78
79 # If this is an xterm set the title to user@host:dir
80 case "$TERM" in
f3b43562 »
2011-08-31 cleaned up bashrc
81 xterm*|rxvt*)
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
82 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
83 ;;
f3b43562 »
2011-08-31 cleaned up bashrc
84 *)
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
85 ;;
649ea741 »
2011-02-08 added bash config
86 esac
87
88 # enable color support of ls and also add handy aliases
89 if [ -x /usr/bin/dircolors ]; then
90 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
91 alias ls='ls --color=auto'
92
93 alias grep='grep --color=auto'
94 alias fgrep='fgrep --color=auto'
95 alias egrep='egrep --color=auto'
96 fi
97
01567fbd »
2011-08-29 added color ls for darwin
98 if [ $DARWIN -eq 1 ]; then
99 alias ls='ls -G'
f3b43562 »
2011-08-31 cleaned up bashrc
100
101 alias grep='grep --color=auto'
102 alias fgrep='fgrep --color=auto'
103 alias egrep='egrep --color=auto'
01567fbd »
2011-08-29 added color ls for darwin
104 fi
649ea741 »
2011-02-08 added bash config
105 # some more ls aliases
da84d9d3 »
2011-06-08 added colour interactive and ui to git config
106 alias ll='ls -alF'
649ea741 »
2011-02-08 added bash config
107 alias la='ls -A'
108 alias l='ls -CF'
109
da84d9d3 »
2011-06-08 added colour interactive and ui to git config
110 # Add an "alert" alias for long running commands. Use like so:
111 # sleep 10; alert
112 alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
113
649ea741 »
2011-02-08 added bash config
114 # Alias definitions.
115 # You may want to put all your additions into a separate file like
116 # ~/.bash_aliases, instead of adding them here directly.
117 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
118
119 if [ -f ~/.bash_aliases ]; then
120 . ~/.bash_aliases
121 fi
122
123 # enable programmable completion features (you don't need to enable
124 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
125 # sources /etc/bash.bashrc).
126 if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
127 . /etc/bash_completion
128 fi
da84d9d3 »
2011-06-08 added colour interactive and ui to git config
129
130 g () {
131 grep -G -w --color=always --include="*.py" --include="*.xhtml" --include="*.tac" --include="*.po" -R "$@" ~/code/df
132 }
133
134
4d28663f »
2011-08-31 new emacs launch function
135 # EMACS launcher
136 e () {
137 if [ $DARWIN -eq 1 ]; then
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
138 EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
4d28663f »
2011-08-31 new emacs launch function
139 else
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
140 EMACS=emacs
4d28663f »
2011-08-31 new emacs launch function
141 fi
142 EMACSCLIENT=emacsclient
143
144 tempuid=`id -u`
145 EMACSSERVER=$TMPDIR/emacs$tempuid/server
146
147 if [ -f $HOME/.emacsconfig ]; then
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
148 . $HOME/.emacsconfig
4d28663f »
2011-08-31 new emacs launch function
149 fi
150
151 if [ -z "$DISPLAY" ]; then
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
152 exec $EMACS -n "$@"
4d28663f »
2011-08-31 new emacs launch function
153 else
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
154 if [ $DARWIN -eq 1 ]; then
155 if [ -e "$EMACSSERVER" ]; then
156 exec $EMACSCLIENT -n "$@" &
157 else
158 exec $EMACS --eval "(server-start)" "$@" &
159 fi
160 else
161 if [ -e "$EMACSSERVER" ]; then
162 $EMACSCLIENT -n "$@"
163 else
164 exec $EMACS --eval "(server-start)" "$@" &
165 fi
166 fi
4d28663f »
2011-08-31 new emacs launch function
167 fi
168 }
169
afa119a8 »
2012-02-08 added sudo emacs edit alias
170 # edit file with root privs
171 function E() {
172 emacsclient -n -a emacs "/sudo:root@localhost:$PWD/$1"
173 }
174
f5360502 »
2011-09-04 added new mutt launcher
175 # Mutt launcher
176 m () {
177 offlineimap -1 -u quiet > /dev/null &
178 OPID=$!
179 mutt
180 kill $OPID
181 ps $OPID > /dev/null
182 while [ $? -eq 0 ]; do
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
183 kill $OPID
184 sleep 3;
185 ps $OPID > /dev/null
f5360502 »
2011-09-04 added new mutt launcher
186 done
187 offlineimap -o -u basic
188 }
da84d9d3 »
2011-06-08 added colour interactive and ui to git config
189
ec8a4dc9 »
2012-03-01 added emacs as default git commit editor
190 case "$TERM" in
4c2fc12e »
2012-05-04 Fixed bashrc GIT_EDITOR variable when using color xterm
191 xterm*)
e2e2d1e5 »
2012-07-17 Added bazaar config.
192 export GIT_EDITOR="emacsclient"
193 export BZR_EDITOR="emacsclient"
194 ;;
ec8a4dc9 »
2012-03-01 added emacs as default git commit editor
195 *)
e2e2d1e5 »
2012-07-17 Added bazaar config.
196 export GIT_EDITOR="emacs"
197 export BZR_EDITOR="emacs"
198 ;;
ec8a4dc9 »
2012-03-01 added emacs as default git commit editor
199 esac
200
88fe9f01 »
2011-11-21 added apache mode and removed rainbow mode
201 #export PYTHONDONTWRITEBYTECODE=true
f3b43562 »
2011-08-31 cleaned up bashrc
202
b374c650 »
2012-04-02 added highlight symbol mode to lisp like modes
203 export PDSH_RCMD_TYPE="ssh"
204 export PDSH_GENDERS_FILE=`readlink -f ~/.genders`
205
d374efef »
2012-08-12 Added default debian build target.
206 # git-buildpackage default target.
7b3a8108 »
2012-08-14 Cleaned up formatting of bashrc.
207 export DIST=unstable
d374efef »
2012-08-12 Added default debian build target.
208 export ARCH=amd64
209
da84d9d3 »
2011-06-08 added colour interactive and ui to git config
210 # set PATH so it includes user's private bin if it exists
211 if [ -d "$HOME/bin" ] ; then
212 PATH="$HOME/bin:$PATH"
213 fi
214
88fe9f01 »
2011-11-21 added apache mode and removed rainbow mode
215 if [ -f "$HOME/.bashrc.local" ]; then
216 . "$HOME/.bashrc.local"
217 fi
Something went wrong with that request. Please try again.