readd dupfind and indent

This commit is contained in:
2020-09-22 18:48:34 +02:00
parent 339a920bb8
commit ea5f4c84ea

View File

@@ -22,37 +22,37 @@ bindkey -e
bindkey "^r" history-incremental-search-backward bindkey "^r" history-incremental-search-backward
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init() { function zle-line-init() {
echoti smkx echoti smkx
} }
function zle-line-finish() { function zle-line-finish() {
echoti rmkx echoti rmkx
} }
zle -N zle-line-init zle -N zle-line-init
zle -N zle-line-finish zle -N zle-line-finish
fi fi
if [[ "${terminfo[khome]}" != "" ]]; then if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line bindkey "${terminfo[khome]}" beginning-of-line
fi fi
if [[ "${terminfo[kend]}" != "" ]]; then if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line bindkey "${terminfo[kend]}" end-of-line
fi fi
if [[ "${terminfo[kcbt]}" != "" ]]; then if [[ "${terminfo[kcbt]}" != "" ]]; then
bindkey "${terminfo[kcbt]}" reverse-menu-complete bindkey "${terminfo[kcbt]}" reverse-menu-complete
fi fi
if [[ "${terminfo[kdch1]}" != "" ]]; then if [[ "${terminfo[kdch1]}" != "" ]]; then
bindkey "${terminfo[kdch1]}" delete-char bindkey "${terminfo[kdch1]}" delete-char
else else
# fallbacks # fallbacks
bindkey "^[[3~" delete-char bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char bindkey "\e[3~" delete-char
fi fi
zstyle ':completion:*:commands' rehash 1 zstyle ':completion:*:commands' rehash 1
@@ -65,16 +65,22 @@ zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats "[%{$fg_bold[cyan]%}%b%{$reset_color%}]" zstyle ':vcs_info:*' formats "[%{$fg_bold[cyan]%}%b%{$reset_color%}]"
zstyle ':vcs_info:*' actionformats "[%{$fg_bold[cyan]%}%b%{$reset_color%}|%a]" zstyle ':vcs_info:*' actionformats "[%{$fg_bold[cyan]%}%b%{$reset_color%}|%a]"
PROMPT="(%M) %~ %{$fg[red]%}%(#~#~$)%{$reset_color%} " if [[ -f /run/.containerenv && -f /run/.toolboxenv ]]; then
TOOLBOX="%{$fg_bold[magenta]%}⬢%{$reset_color%} "
else
TOOLBOX=""
fi
PROMPT="${TOOLBOX}(%M) %~ %{$fg[red]%}%(#~#~$)%{$reset_color%} "
RPROMPT="\$vcs_info_msg_0_" RPROMPT="\$vcs_info_msg_0_"
precmd () { precmd () {
print -Pn "\e]0;(%M) %~\a" print -Pn "\e]0;(%M) %~\a"
vcs_info vcs_info
} }
preexec () { preexec () {
print -Pn "\e]0;(%M) $1\a" print -Pn "\e]0;(%M) $1\a"
} }
alias :q="exit" alias :q="exit"
@@ -82,11 +88,27 @@ alias ..="cd .."
[[ -x /usr/bin/xdg-open ]] && alias open="xdg-open" [[ -x /usr/bin/xdg-open ]] && alias open="xdg-open"
wttr() { wttr() {
curl wttr.in/$1 curl wttr.in/$1
} }
sshn() { sshn() {
ssh -N -L ${1}:localhost:${2} $3 ssh -N -L ${1}:localhost:${2} $3
}
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
} }
[[ -x /usr/bin/dircolors ]] && eval "$(dircolors)" [[ -x /usr/bin/dircolors ]] && eval "$(dircolors)"