Added vagrant/puppet config (created with https://puphpet.com)
[memberdb.git] / files / dot / .bash_aliases
1 if [ -f /etc/bash_completion ]; then
2     source /etc/bash_completion
3 fi
4
5 __has_parent_dir () {
6     # Utility function so we can test for things like .git/.hg without firing up a
7     # separate process
8     test -d "$1" && return 0;
9
10     current="."
11     while [ ! "$current" -ef "$current/.." ]; do
12         if [ -d "$current/$1" ]; then
13             return 0;
14         fi
15         current="$current/..";
16     done
17
18     return 1;
19 }
20
21 __vcs_name() {
22     if [ -d .svn ]; then
23         echo "-[svn]";
24     elif __has_parent_dir ".git"; then
25         echo "-[$(__git_ps1 'git %s')]";
26     elif __has_parent_dir ".hg"; then
27         echo "-[hg $(hg branch)]"
28     fi
29 }
30
31 black=$(tput -Txterm setaf 0)
32 red=$(tput -Txterm setaf 1)
33 green=$(tput -Txterm setaf 2)
34 yellow=$(tput -Txterm setaf 3)
35 dk_blue=$(tput -Txterm setaf 4)
36 pink=$(tput -Txterm setaf 5)
37 lt_blue=$(tput -Txterm setaf 6)
38
39 bold=$(tput -Txterm bold)
40 reset=$(tput -Txterm sgr0)
41
42 # Nicely formatted terminal prompt
43 export PS1='\n\[$bold\]\[$black\][\[$dk_blue\]\@\[$black\]]-[\[$green\]\u\[$yellow\]@\[$green\]\h\[$black\]]-[\[$pink\]\w\[$black\]]\[\033[0;33m\]$(__vcs_name) \[\033[00m\]\[$reset\]\n\[$reset\]\$ '
44
45 alias ls='ls -F --color=always'
46 alias dir='dir -F --color=always'
47 alias ll='ls -l'
48 alias cp='cp -iv'
49 alias rm='rm -i'
50 alias mv='mv -iv'
51 alias grep='grep --color=auto -in'
52 alias ..='cd ..'