summaryrefslogtreecommitdiff
path: root/bashrc
blob: 41752762129a2216d5ef84495a08d1dc088c2997 (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
68
69
70
71
72
73
# ---------------------------------------------------------------------------- #
# ----- More STATIC part ----------------------------------------------------- #
# ---------------------------------------------------------------------------- #

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# bash(1) for info and more options
HISTCONTROL=ignoreboth                  # duplicated lines sequentially & starting with space
HISTSIZE=10000                          # number of commands remembered
HISTFILESIZE=20000                      # number of lines in history_file (truncate above)
HISTTIMEFORMAT="[%a] %d-%b %H:%M | "    # format for history command

# check options: http://www.ss64.com/bash/shopt.html
shopt -s histappend     # append to the history file, don't overwrite it
shopt -s checkwinsize   # check window size and update $LINES and $COLUMNS.

# see lesspipe(1)
[ -x /usr/bin/lesspipe.sh ] && eval "$(SHELL=/bin/sh lesspipe.sh)"

# all alias in ~/.bash_aliases
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

# ---------------------------------------------------------------------------- #
# ----- New stuff usually goes here :-) -------------------------------------- #
# ---------------------------------------------------------------------------- #
function get_git_branch()
{
    branch=`git branch -a 2> /dev/null | grep \* | cut -d' ' -f 2`
    eval "$1='$branch'"
}

PATH=$HOME/.local/bin:$PATH
PATH=$PATH:$HOME/scripts
EDITOR=vim
BROWSER=firefox
#LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:*.deb=90'

PROMPT_COMMAND='
get_git_branch branch
if [ "$branch" ]
then
    branch="($branch) "
fi
default="\[$txtwht\] \W \[$txtylw\]$branch"
if [ `whoami` == "root" ]; then
        PS1="\[$bldred\](\h)$default\[$bldred\]# \[$txtwht\]"
else
    if [ $UNDER_JHBUILD ]; then
        PS1="\[$bldpur\](jhbuild)$default\[$bldgrn\]$ \[$txtwht\]"
    else
        PS1="\[$bldgrn\](\h)$default\[$bldgrn\]$ \[$txtwht\]"
    fi
fi
unset branch
unset default
'
# vim:ts=4:sw=4