X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/5b9a654a39e6b0e14c5b0bd61227931213f4fd3f..6d54344e74d961369b15acb46cc95ae8da282c79:/base/.zshrc diff --git a/base/.zshrc b/base/.zshrc index 0da8429..9ce0d1e 100644 --- a/base/.zshrc +++ b/base/.zshrc @@ -4,24 +4,46 @@ setopt NO_BEEP NO_CLOBBER setopt AUTO_CD CDABLE_VARS ## completion setopt GLOB_COMPLETE -## line +## globbing setopt EXTENDED_GLOB GLOB_DOTS MARK_DIRS NOMATCH NUMERIC_GLOB_SORT -## prompt -setopt PROMPT_SUBST ## jobs -setopt AUTO_CONTINUE +setopt AUTO_CONTINUE LONG_LIST_JOBS ## history setopt 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 +144,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 +158,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 +185,7 @@ if [[ "$(basename "$PAGER")" = "less" ]] { } else { ps="$ps | \"${PAGER:-more}\"" } -alias pa="$ps" +alias pa=$ps alias spa="sudo $ps" unset ps @@ -172,6 +194,7 @@ unset ps function up { cd $(printf '../%.0s' {1..${1:-1}}) } +alias u=up ## zoxide [[ -v commands[zoxide] ]] && eval "$(zoxide init zsh)" @@ -184,6 +207,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 +231,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 +314,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