From 34be1b458acb29d22ccc909f8b00882e6f967c59 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 8 Sep 2020 15:30:16 +0200 Subject: [PATCH] Add fish_command_not_found handler for pacman Since version 5 (IIRC), pacman has a file database. This is useful for people who don't have pkgfile, but we still prefer that because it's much faster - pacman takes a full *second* on my system. --- share/functions/fish_command_not_found.fish | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/functions/fish_command_not_found.fish b/share/functions/fish_command_not_found.fish index 041a87fcd..a3fe32ae3 100644 --- a/share/functions/fish_command_not_found.fish +++ b/share/functions/fish_command_not_found.fish @@ -57,5 +57,14 @@ else if type -p -q pkgfile __fish_default_command_not_found_handler $argv[1] end end +else if type -q pacman + function fish_command_not_found + set -l paths $argv[1] + # If we've not been given an absolute path, try $PATH as the starting point, + # otherwise pacman will try *every path*, and e.g. bash-completion + # isn't helpful. + string match -q '/*' -- $argv[1]; or set paths $PATH/$argv[1] + pacman -F $paths + end end # Use standard fish command not found handler otherwise