Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

136 lines
3.2 KiB

# My zsh config file. One day, I will actually learn about zsh instead
# of just haphazardly tossing crap at it.
# Common path, aliases etc. for both shells I actually use:
source ~/.sh_common
autoload -U add-zsh-hook
autoload -Uz compinit
export HISTFILE=~/.histfile
export HISTSIZE=15000
export SAVEHIST=9999999
setopt menu_complete
setopt prompt_subst
setopt inc_append_history
setopt hist_ignore_space
setopt hist_ignore_dups
setopt autocd
setopt extendedglob
setopt autopushd pushdminus
setopt printexitvalue
unsetopt beep
bindkey -e
zstyle :compinstall filename '/home/brennen/.zshrc'
compinit
# https://wiki.archlinux.org/index.php/Zsh#History_search
# Search up/down for matching thing on arrows - you can still use ctrl-n /
# ctrl-p to move up and down in the overall command history:
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-beginning-search
# prompt configuration {{{
# Grab some colors:
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
PR_NO_COLOR="%{$terminfo[sgr0]%}"
# Next, do per-host color and sigils.
#
# Great for sigils:
# https://en.wikipedia.org/wiki/Unicode_Geometric_Shapes
PR_SIGIL=\$
PR_PATH_COLOR=$PR_BLUE;
PR_TIME_COLOR=$PR_LIGHT_BLUE
case "$HOST" in
'catastrophe')
PR_HOST_COLOR=$PR_LIGHT_BLUE;
;;
'desiderata')
PR_HOST_COLOR=$PR_LIGHT_BLUE;
PR_SIGIL=
;;
'escalation')
PR_HOST_COLOR=$PR_LIGHT_GREEN;
PR_SIGIL=
;;
'errata')
PR_HOST_COLOR=$PR_LIGHT_BLUE;
PR_SIGIL=
;;
'externality')
PR_HOST_COLOR=$PR_LIGHT_GREEN;
PR_SIGIL=
;;
'exuberance')
PR_HOST_COLOR=$PR_LIGHT_GREEN;
# see bin/fragment-bullet:
PR_SIGIL=
;;
'fragility')
PR_HOST_COLOR=$PR_WHITE;
PR_SIGIL=
;;
'inertia')
PR_HOST_COLOR=$PR_LIGHT_CYAN;
PR_SIGIL=
;;
'novena-edward-norway')
PR_HOST_COLOR=$PR_LIGHT_BLUE;
PR_SIGIL=
;;
'pisces')
PR_HOST_COLOR=$PR_GREEN;
;;
'raspberrypi')
PR_HOST_COLOR=$PR_MAGENTA;
;;
'kropotkin')
PR_HOST_COLOR=$PR_BLUE;
;;
*)
PR_HOST_COLOR=$PR_BLUE;
;;
esac
# Reset the prompt on every command to get that parse_git_branch
# function to run. Might be a better way to do this, but whatever:
function precmd {
export PS1="$PR_HOST_COLOR%n@%m $PR_TIME_COLOR%* $PR_PATH_COLOR%d $(parse_git_branch)$PR_NO_COLOR$PR_SIGIL "
}
# Set up the prompt:
export PS1="$PR_HOST_COLOR%n@%m $PR_TIME_COLOR%* $PR_PATH_COLOR%d $(parse_git_branch)$PR_NO_COLOR$PR_SIGIL "
# }}}
# Record directory history:
function chpwd {
echo $(pwd) >> ~/.directory_history
}
function bpb_preexec {
# http://zsh.sourceforge.net/Doc/Release/Functions.html
# Log the current command:
commandlog add "$@"
}
add-zsh-hook preexec bpb_preexec
# fzf fuzzyfinder for use with Alt-c, Ctrl-r, Ctrl-t:
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh