summaryrefslogtreecommitdiff
path: root/.bashrc
blob: 445cc5d56e131791b491ea372af4cd044402830f (plain)
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
# --- preferences

# load standard environment variables
. $HOME/.shenv

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"

# if this is an xterm set the title to user@host:dir
case "$TERM" in
    xterm*|rxvt*)
        PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
        ;;
    *)
        ;;
esac

# enable power-completion (shouldn't be necessary)
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

shopt -s globstar

# --- colours originally from gentoo's default bashrc

use_color=false
safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs}    ]] \
    && type -P dircolors >/dev/null \
    && match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then
    # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
    if type -P dircolors >/dev/null ; then
        if [[ -f ~/.dir_colors ]] ; then
            eval $(dircolors -b ~/.dir_colors)
        elif [[ -f /etc/DIR_COLORS ]] ; then
            eval $(dircolors -b /etc/DIR_COLORS)
        fi
    fi

    PS1='\[\033[00;33m\]\h \[\033[00;32m\]\w \[\033[00;34m\]\$\[\033[00m\] '

    alias ls='ls --color=auto'
    alias grep='grep --colour=auto'
else
    PS1='\h \w \$ '
fi
unset use_color safe_term match_lhs

# --- aliases

alias g='git'
alias ga='git annex'
alias workgit='cd ~/doc && git add . && git commit -a -m "work commit" --edit && git push origin master && cd ~/src/dotfiles && git push origin master'
alias mg=$EDITOR
alias fmr='MR_FAST=true mr'