Use pkgfile command not found handler for arch
This commit is contained in:
parent
e87ef5f56d
commit
33037ba06d
2 changed files with 6 additions and 30 deletions
|
@ -73,3 +73,8 @@ fi
|
||||||
|
|
||||||
# Disable dotdrop submodule auto update
|
# Disable dotdrop submodule auto update
|
||||||
export DOTDROP_AUTOUPDATE=no
|
export DOTDROP_AUTOUPDATE=no
|
||||||
|
|
||||||
|
{%@@ if os == "arch" @@%}
|
||||||
|
# Enable pkgfile command not found handler
|
||||||
|
source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||||
|
{%@@ endif @@%}
|
||||||
|
|
|
@ -12,35 +12,7 @@ forgit_revert_commit=fgrc
|
||||||
# Modern replacement for ls
|
# Modern replacement for ls
|
||||||
alias ls='exa'
|
alias ls='exa'
|
||||||
|
|
||||||
{%@@ if os == "arch" @@%}
|
{%@@ if os == "termux" @@%}
|
||||||
# Command not found handler
|
|
||||||
# source https://wiki.archlinux.org/title/Zsh#pacman_-F_%22command_not_found%22_handler
|
|
||||||
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
|
|
||||||
}
|
|
||||||
{%@@ elif os == "termux" @@%}
|
|
||||||
function command_not_found_handler {
|
function command_not_found_handler {
|
||||||
printf 'zsh: command not found: %s\n' "$1"
|
printf 'zsh: command not found: %s\n' "$1"
|
||||||
$PREFIX/libexec/termux/command-not-found $1
|
$PREFIX/libexec/termux/command-not-found $1
|
||||||
|
@ -64,7 +36,6 @@ pr() {
|
||||||
paru -Rns $(echo $SELECTED_PKGS)
|
paru -Rns $(echo $SELECTED_PKGS)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
{%@@ endif @@%}
|
|
||||||
|
|
||||||
# find and open man pages with fzf
|
# find and open man pages with fzf
|
||||||
fman() {
|
fman() {
|
||||||
|
|
Loading…
Reference in a new issue