2020-01-01 23:28:45 +00:00
|
|
|
# useful functions
|
|
|
|
autoload -Uz zmv zcalc zargs url-quote-magic bracketed-paste-magic
|
|
|
|
zle -N self-insert url-quote-magic
|
|
|
|
zle -N bracketed-paste bracketed-paste-magic
|
|
|
|
|
2019-12-16 03:54:11 +00:00
|
|
|
# tilde directories
|
2019-12-15 04:37:46 +00:00
|
|
|
hash -d \
|
|
|
|
nixos=/etc/nixos \
|
|
|
|
dl=~/Downloads \
|
|
|
|
git=~/git
|
|
|
|
|
|
|
|
hash -d \
|
|
|
|
github=~git/github.com \
|
|
|
|
gitlab=~git/gitlab.com
|
|
|
|
|
|
|
|
|
2019-12-16 05:46:11 +00:00
|
|
|
# key binds
|
|
|
|
bindkey -v '^?' backward-delete-char
|
2019-12-15 04:37:46 +00:00
|
|
|
bindkey '^[OA' history-substring-search-up
|
|
|
|
bindkey '^[OB' history-substring-search-down
|
|
|
|
bindkey -M vicmd 'k' history-substring-search-up
|
|
|
|
bindkey -M vicmd 'j' history-substring-search-down
|
|
|
|
|
|
|
|
# if in tmux launch skim in tmux pane
|
|
|
|
[[ ${+TMUX} == 1 ]] \
|
|
|
|
&& SKIM_TMUX=1
|
|
|
|
|
|
|
|
#load compinit
|
|
|
|
autoload -Uz compinit
|
2019-12-16 03:54:11 +00:00
|
|
|
|
2020-01-07 05:35:33 +00:00
|
|
|
if [[ -f ~/.zcompdump ]]; then
|
|
|
|
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump \
|
|
|
|
|| stat -f '%Sm' -t '%j' ~/.zcompdump)
|
|
|
|
|
|
|
|
# save time if completion cache has been update recently
|
|
|
|
if [ $(date +'%j') != $updated_at ]; then
|
|
|
|
compinit -u
|
|
|
|
else
|
|
|
|
compinit -C
|
|
|
|
fi
|
2019-12-15 04:37:46 +00:00
|
|
|
else
|
2019-12-16 03:54:11 +00:00
|
|
|
compinit -C
|
2019-12-15 04:37:46 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Case insens only when no case match; after all completions loaded
|
|
|
|
zstyle ':completion:*' matcher-list \
|
2019-12-16 03:54:11 +00:00
|
|
|
"" 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
2019-12-15 04:37:46 +00:00
|
|
|
|
|
|
|
# Auto rehash for new binaries
|
|
|
|
zstyle ':completion:*' rehash true
|
|
|
|
|
|
|
|
|
2019-12-16 03:54:11 +00:00
|
|
|
# remove duplicates from paths
|
|
|
|
typeset -U path
|
|
|
|
typeset -U fpath
|
|
|
|
|
2019-12-15 04:37:46 +00:00
|
|
|
# keep shell state frozen
|
|
|
|
ttyctl -f
|