summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-04-20 16:08:51 +1200
committerDavid Phillips <david@sighup.nz>2017-04-20 16:08:51 +1200
commit36e1e0b68cf9b3d096a86492f7f82fd13adcf632 (patch)
treef3ad48d90a1eacdd4c3c47b8fef97f6e41ba2ea6
parenteecbee6d5d7b4213aae6fe62962ef71181717447 (diff)
downloaddotfiles-36e1e0b68cf9b3d096a86492f7f82fd13adcf632.tar.xz
Add zshrc
-rw-r--r--zshrc71
1 files changed, 71 insertions, 0 deletions
diff --git a/zshrc b/zshrc
new file mode 100644
index 0000000..3756c7b
--- /dev/null
+++ b/zshrc
@@ -0,0 +1,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'