From 36e1e0b68cf9b3d096a86492f7f82fd13adcf632 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 20 Apr 2017 16:08:51 +1200 Subject: Add zshrc --- zshrc | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 zshrc 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' -- cgit v1.1