From 2a387f8a1bd042460dd5c698532d6a364342b5d3 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 23 Oct 2021 10:20:59 +0200 Subject: [PATCH] slim down zshrc --- zsh/.zshrc | 73 +++++++++--------------------------------------------- 1 file changed, 12 insertions(+), 61 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 351cab0..631d822 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -19,41 +19,24 @@ setopt histignorealldups setopt histignorespace bindkey -e -bindkey "^r" history-incremental-search-backward if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then function zle-line-init() { echoti smkx } -function zle-line-finish() { - echoti rmkx -} + function zle-line-finish() { + echoti rmkx + } -zle -N zle-line-init -zle -N zle-line-finish + zle -N zle-line-init + zle -N zle-line-finish fi -if [[ "${terminfo[khome]}" != "" ]]; then - bindkey "${terminfo[khome]}" beginning-of-line -fi - -if [[ "${terminfo[kend]}" != "" ]]; then - bindkey "${terminfo[kend]}" end-of-line -fi - -if [[ "${terminfo[kcbt]}" != "" ]]; then - bindkey "${terminfo[kcbt]}" reverse-menu-complete -fi - -if [[ "${terminfo[kdch1]}" != "" ]]; then - bindkey "${terminfo[kdch1]}" delete-char -else - # fallbacks - bindkey "^[[3~" delete-char - bindkey "^[3;5~" delete-char - bindkey "\e[3~" delete-char -fi +[[ -n "${terminfo[khome]}" ]] && bindkey "${terminfo[khome]}" beginning-of-line +[[ -n "${terminfo[kend]}" ]] && bindkey "${terminfo[kend]}" end-of-line +[[ -n "${terminfo[kcbt]}" ]] && bindkey "${terminfo[kcbt]}" reverse-menu-complete +[[ -n "${terminfo[kdch1]}" ]] && bindkey "${terminfo[kdch1]}" delete-char zstyle ':completion:*:commands' rehash 1 zstyle ':completion:*' completer _oldlist _expand _complete _files _ignored @@ -89,42 +72,10 @@ preexec () { print -Pn "\e]0;(%M) $1\a" } -alias :q="exit" -alias ..="cd .." -[[ -x /usr/bin/xdg-open ]] && alias open="xdg-open" - sshl() { ssh -N -L ${1}:localhost:${2} $3 } -#toolbox() { -# if [[ $@ =~ (enter) && ! $@ =~ (-r|--release|-d|--distro) ]]; then -# -# CONTAINER=$(sed -E -e 's/enter|--container|-c|toolbox|\t|\n|\s//g' <<< $@) -# -# if [[ ! -z ${CONTAINER} && ${CONTAINER} =~ "^[a-zA-Z0-9-]{1,15}$" ]]; then -# command toolbox --container ${CONTAINER} run sudo hostname ${CONTAINER} -# command toolbox enter ${CONTAINER} -# else -# command toolbox enter -# fi -# else -# command toolbox $@ -# fi -#} - -dupfind() { - if [ $# -lt 1 ]; then - echo "Usage: $0 THREAD_COUNT [directory] ..." > /dev/stderr - fi - - if ! [[ "$1" =~ ^[0-9]+$ ]]; then - echo "THREAD_COUNT needs to be an integer." > /dev/stderr - else - if [ $# -lt 2 ]; then - find . ! -empty -type f -print0 | xargs -0 -n1 -P${1} md5sum | sort | uniq -w32 -dD - else - find ${@:2:128} ! -empty -type f -print0 | xargs -0 -n1 -P${1} md5sum | sort | uniq -w32 -dD - fi - fi -} +alias :q="exit" +alias ..="cd .." +[[ -x /usr/bin/xdg-open ]] && alias open="xdg-open"