X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/e3a45d88013669e35ae1fa5078764ee779ef1426..57948260356dcd40d259650121b2b5e1e4d1da6d:/base/.zshrc diff --git a/base/.zshrc b/base/.zshrc index 0da8429..4ee5000 100644 --- a/base/.zshrc +++ b/base/.zshrc @@ -1,27 +1,45 @@ ### options -setopt NO_BEEP NO_CLOBBER -## cd -setopt AUTO_CD CDABLE_VARS -## completion -setopt GLOB_COMPLETE -## line -setopt EXTENDED_GLOB GLOB_DOTS MARK_DIRS NOMATCH NUMERIC_GLOB_SORT -## prompt -setopt PROMPT_SUBST -## jobs -setopt AUTO_CONTINUE -## history -setopt NO_HIST_SAVE_BY_COPY HIST_IGNORE_DUPS SHARE_HISTORY HIST_REDUCE_BLANKS +setopt NO_BEEP NO_CLOBBER \ + AUTO_CD CDABLE_VARS \ + EXTENDED_GLOB GLOB_DOTS GLOB_STAR_SHORT MARK_DIRS NUMERIC_GLOB_SORT \ + CORRECT_ALL INTERACTIVE_COMMENTS \ + GLOB_COMPLETE \ + AUTO_CONTINUE LONG_LIST_JOBS \ + NO_HIST_SAVE_BY_COPY HIST_IGNORE_DUPS SHARE_HISTORY HIST_REDUCE_BLANKS + +### imports +autoload -Uz zmv +autoload -Uz zmathfunc && zmathfunc + +### exports +## common +export EDITOR=vim +export PAGER=less +## grep +# XXX: deprecated in GNU +export GREP_OPTIONS=--color=auto +## histfile +export HISTFILE=~/.histfile +export HISTSIZE=1000 +export SAVEHIST=1000 +## python +export PYTHONSTARTUP=~/.pythonrc +## wayland/sway +# XXX: only do this if we're actually in wayland, but without a start script +export XDG_SESSION_TYPE=wayland +export QT_QPA_PLATFORM=wayland-egl +export QT_WAYLAND_DISABLE_WINDOWDECORATION=-1 +export SDL_VIDEODRIVER=wayland +export TERMINAL=footclient ### keys -# TODO: investigate "^[[200~" bracketed-paste bindkey -v KEYTIMEOUT=10 ## populate key array if (( $#terminfo == 0 )) { # terminfo is not set or empty function find_keymap { - for f in ${ZDOTDIR:-$HOME}/.zkbd/${TERM}{-${DISPLAY:-${VENDOR}-${OSTYPE}},} + for f in ${ZDOTDIR:-$HOME}/.zkbd/$TERM{-${DISPLAY:-$VENDOR-$OSTYPE},} [[ -f $f ]] && keymap=$f && break } find_keymap @@ -122,8 +140,8 @@ if [[ "$OSTYPE" =~ '^(free|net)bsd' ]] { } else { alias ll='ls -lAFh' } -alias p="${PAGER:-more}" # TODO: make sure more is there or use alternate -alias e="${EDITOR:-vi}" # TODO: make sure vi is there or use alternate +alias p=${PAGER:-more} # TODO: make sure more is there or use alternate +alias e=${EDITOR:-vi} # TODO: make sure vi is there or use alternate alias se=sudoedit # be paranoid alias cp='cp -ip' @@ -136,11 +154,11 @@ if [[ "$OSTYPE" =~ '^freebsd' ]] { alias rm='rm -i' } ## py venv -alias va="source bin/activate" -alias vd="deactivate" +alias va='source bin/activate' +alias vd=deactivate ## ps source ~/bin/.check-busybox -if which pstree >/dev/null 2>&1 && ! check-busybox pstree; then +if [[ -v commands[pstree] ]] && ! check-busybox pstree; then # use pstree, but NOT busybox pstree because it kinda sucks ps="pstree -wg3" elif [[ "$OSTYPE" =~ '^freebsd' ]]; then @@ -163,7 +181,7 @@ if [[ "$(basename "$PAGER")" = "less" ]] { } else { ps="$ps | \"${PAGER:-more}\"" } -alias pa="$ps" +alias pa=$ps alias spa="sudo $ps" unset ps @@ -172,6 +190,7 @@ unset ps function up { cd $(printf '../%.0s' {1..${1:-1}}) } +alias u=up ## zoxide [[ -v commands[zoxide] ]] && eval "$(zoxide init zsh)" @@ -184,6 +203,11 @@ function sev_preexec { # save last exec time for bell # XXX: does not run for blank cmdline _sev_exectime=$SECONDS + # update gpg forward, to always have unique filename and avoid clashes + if [[ -v _GNUPG_SOCK_DEST_EXT ]] { + export _GNUPG_SOCK_DEST_EXT=$(date +%s).$RANDOM + export _GNUPG_SOCK_DEST=$_GNUPG_SOCK_DEST_BASE.$_GNUPG_SOCK_DEST_EXT + } } add-zsh-hook preexec sev_preexec function sev_precmd { @@ -203,7 +227,7 @@ function sev_chpwd { add-zsh-hook chpwd sev_chpwd ### system-specific configs and aliases -case "$OSTYPE"; in +case $OSTYPE; in freebsd*) # colors export CLICOLOR= @@ -286,4 +310,4 @@ prompt arrows ### load site-specific if [[ -f ~/.zshrc.local ]] { source ~/.zshrc.local } -# vim: set et sts=4 sw=4 ts=8 tw=79 : +# vim: et sts=4 sw=4 ts=8 tw=79