# minimal usable .zshrc
#
# shellcheck disable=SC2034,SC2312
# keys
# del $terminfo[kdch1]
bindkey '\e[3~' delete-char
# bs $terminfo[kbs]
bindkey '^?' backward-delete-char
# ctrl <- ctrl ->
bindkey '\e[1;5D' backward-word
bindkey '\e[1;5C' forward-word
bindkey '\e[5D' backward-word
bindkey '\e[5C' forward-word
# home end
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
bindkey '\e[7~' beginning-of-line
bindkey '\e[8~' end-of-line
bindkey '\eOH' beginning-of-line
bindkey '\eOF' end-of-line
bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
# alt <- alt ->
bindkey '\e[1;3C' forward-word
bindkey '\e[1;3D' backward-word
bindkey '\e[A' up-line-or-search
bindkey '\e[B' down-line-or-search
bindkey '\eOA' up-line-or-search
bindkey '\eOB' down-line-or-search
setopt nobeep noflowcontrol nonomatch shnullcmd extendedglob \
       bashautolist noautomenu noalwayslastprompt
WORDCHARS='*?_-.[]~&;$%^+'
PS1='%B%m%(?.. %??)%(1j. %j&.)%b %2~%B%#%b '
## minimal usable history
setopt histignoredups histignorespace incappendhistory extendedhistory
SAVEHIST=1000 HISTSIZE=1000 HISTFILE=~/.sh_history
## completion
zmodload zsh/complist
autoload -Uz compinit && compinit
zstyle ':completion:*' menu select=2  # matter of taste
## minimal functions
# g REGEX [DIR] -- call grep recursively with useful defaults
g() { LC_ALL=C grep --exclude "*~" -r -P "${@:?regexp missing}"; }
# l REGEX [DIR] -- find file names, recursively
l() { find "${2:-.}" ! -type d | sed 's:^\./::' | grep -E "$1"; }
