summaryrefslogtreecommitdiff
path: root/zshrc
blob: 3756c7b5388c7a9f96e1b8de5b27a8f8bd18431f (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
zstyle ':completion:*' completer _expand _complete _ignored

autoload -Uz compinit
compinit

HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=10000

# no beeping ಠ_ಠ
unsetopt beep

# cd -> pushd
setopt auto_pushd

# key binding based on zsh wiki
typeset -A key

key[Home]="$terminfo[khome]"
key[End]="$terminfo[kend]"
key[Insert]="$terminfo[kich1]"
key[Backspace]="$terminfo[kbs]"
key[Delete]="$terminfo[kdch1]"

# setup key accordingly
[[ -n "$key[Home]"      ]] && bindkey -- "$key[Home]"      beginning-of-line
[[ -n "$key[End]"       ]] && bindkey -- "$key[End]"       end-of-line
[[ -n "$key[Insert]"    ]] && bindkey -- "$key[Insert]"    overwrite-mode
[[ -n "$key[Backspace]" ]] && bindkey -- "$key[Backspace]" backward-delete-char
[[ -n "$key[Delete]"    ]] && bindkey -- "$key[Delete]"    delete-char

# lol zsh is so broken
bindkey -- ""	backward-word
bindkey -- ""	forward-word


# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
	function zle-line-init () {
		echoti smkx
	}
	function zle-line-finish () {
		echoti rmkx
	}
	zle -N zle-line-init
	zle -N zle-line-finish
fi

setopt PROMPT_SUBST # required for __git_ps1
PROMPT='%B%F{yellow}[%F{green}%n%F{yellow}@%F{blue}%m%F{yellow}][%F{magenta}%1~%F{yellow}$(__git_ps1 " (%s)")]%f%b %# '
RPROMPT='[%?] %w %t'

source /usr/share/git/completion/git-prompt.sh
source ~/.environment
source ~/.aliases

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'