summaryrefslogtreecommitdiff
path: root/bashrc
blob: da805404063669dfbb1f041306974ea63007fa2c (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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/bash

# Reset
Color_Off='\e[0m'
Colour_Off=${Color_Off}

# Regular Colors
Black='\e[0;30m'
Red='\e[0;31m'
Green='\e[0;32m'
Yellow='\e[0;33m'
Blue='\e[0;34m'
Purple='\e[0;35m'
Cyan='\e[0;36m'
White='\e[0;37m'

# Bold
BBlack='\e[1;30m'
BRed='\e[1;31m'
BGreen='\e[1;32m'
BYellow='\e[1;33m'
BBlue='\e[1;34m'
BPurple='\e[1;35m'
BCyan='\e[1;36m'
BWhite='\e[1;37m'

# Underline
UBlack='\e[4;30m'
URed='\e[4;31m'
UGreen='\e[4;32m'
UYellow='\e[4;33m'
UBlue='\e[4;34m'
UPurple='\e[4;35m'
UCyan='\e[4;36m'
UWhite='\e[4;37m'

# Background
On_Black='\e[40m'
On_Red='\e[41m'
On_Green='\e[42m'
On_Yellow='\e[43m'
On_Blue='\e[44m'
On_Purple='\e[45m'
On_Cyan='\e[46m'
On_White='\e[47m'

export HISTSIZE=10000
export HISTTIMEFORMAT="%y-%m-%d %T "

source /usr/share/git/completion/git-prompt.sh

# Force false terminal to get colour with (eg) ls within dvtm
if [ "$TERM" == "dvtm-256color" ]; then 
	TERM=rxvt-256color
fi
if [ "$TERM" == "st-256color" ]; then
	# Quick fix for ctrl+arrow key in st
	echo $(tput smkx) > /dev/tty
fi

man() {
        env LESS_TERMCAP_mb=$'\E[01;31m' \
        LESS_TERMCAP_md=$'\E[01;38;5;74m' \
        LESS_TERMCAP_me=$'\E[0m' \
        LESS_TERMCAP_se=$'\E[0m' \
        LESS_TERMCAP_so=$'\E[38;5;246m' \
        LESS_TERMCAP_ue=$'\E[0m' \
        LESS_TERMCAP_us=$'\E[04;38;5;146m' \
        man "$@"
}

ccc () {
	bc -l <<< "$@"
}

###############
PS1="${BYellow}\
┌[${BGreen}\u${BYellow}@${BBlue}\h${BYellow}][${BPurple}\W${BYellow}"'$(__git_ps1 " (%s)")'"] ${BBlack}<\d \t>${BYellow}\n\
└╼ \[${Colour_Off}\]"
###############
export GPG_TTY=$(tty)
export EDITOR=/usr/bin/vim

if [ $(which clang 2>/dev/null) ]; then
	export CC=clang
	export CXX=clang
elif [[ $(which tcc 2>/dev/null) && !$(which gcc 2>/dev/null) ]]; then
	export CC=tcc
fi

alias sudo="sudo "
alias monut=mount
alias pamcan=pacman
#alias scron="sudo EDITOR=nano crontab -e"
alias ls="/bin/ls --color=auto"
alias fimp="gimp"
alias sl=ls
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias xpdf="xpdf -cont"
alias feh="feh --magick-timeout=0"
alias xclip="xclip -selection c"
alias pd=popd

cd() {
	if [ $# -eq 0 ] ; then
		d=$HOME
	else
		d=$@
	fi
	pushd "$d" >/dev/null
}

# u=rwx,g=,o=
umask 077

echo Running $(uname) $(uname -r) on $(uname -n) \($(uname -m)\)


if [ -f ~/todo ]; then
	echo To do:
	cat ~/todo
fi

if [ -f ~/.cache/weather/forecast ]; then
		echo ""
		echo Weather:
		cat ~/.cache/weather/forecast | while read -r l ; do echo " "$l ; done 
fi

[ -d ~/Maildir/new/ ] && [ "$(ls ~/Maildir/new/)" ] && echo 'New mail'