function __fish_print_installed_packages # apt-cache is much, much faster than rpm, and can do this in real # time. We use it if available. switch (commandline -tc) case '-**' return end #Get the word 'Package' in the current language set -l package (_ Package) if type -f dpkg >/dev/null # Apply the following filters to output of apt-cache: # 1) Remove package names with parentesis in them, since these seem to not correspond to actual packages as reported by rpm # 2) Remove package names that are .so files, since these seem to not correspond to actual packages as reported by rpm # 3) Remove path information such as /usr/bin/, as rpm packages do not have paths dpkg --get-selections |grep (commandline -tc) | grep "\binstall" | awk '{print $1}' |sed -e 's/\/.*\///'|sed -e 's/$/'\t$package'/' return end end