improve shell config

This commit is contained in:
eneller
2023-03-01 09:28:19 +01:00
parent 8efa82da1d
commit 701377dad1
4 changed files with 36 additions and 37 deletions

View File

@@ -1,5 +1,3 @@
#OPTIONS SECTION
#unsetopt beep # try disabling annoying beep sounds
@@ -107,7 +105,8 @@ source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zs
#ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=009
#ZSH_HIGHLIGHT_STYLES[assign]=none
[[ ! -f "$ZDOTDIR/p10k.zsh" ]] || source "$ZDOTDIR/p10k.zsh" # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f "$ZDOTDIR/p10k.zsh" ]] || source "$ZDOTDIR/p10k.zsh" # To customize prompt, run `p10k configure` or edit ~/.config/zsh/p10k.zsh
#eval "$(starship init zsh)" # starship.rs prompt to replace p10k
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh # load fish-completion, needs to be sourced after syntax highlighting
@@ -134,7 +133,30 @@ source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh # l
#elif [[ -f /etc/DIR_COLORS ]] ; then
# eval $(dircolors -b /etc/DIR_COLORS)
#fi
#
function command_not_found_handler {
local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
printf 'zsh: command not found: %s\n' "$1"
local entries=(
${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"}
)
if (( ${#entries[@]} ))
then
printf "${bright}$1${reset} may be found in the following packages:\n"
local pkg
for entry in "${entries[@]}"
do
# (repo package version file)
local fields=(
${(0)entry}
)
if [[ "$pkg" != "${fields[2]}" ]]
then
printf "${purple}%s/${bright}%s ${green}%s${reset}\n" "${fields[1]}" "${fields[2]}" "${fields[3]}"
fi
printf ' /%s\n' "${fields[4]}"
pkg="${fields[2]}"
done
fi
return 127
}