Created
October 1, 2020 12:34
-
-
Save folke/cded312c972ff3164dd405aad423b00f to your computer and use it in GitHub Desktop.
Using `apropos` on macos rebuilds the whatis database every time. Fish shell uses apropos for command completion.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fixes extremely slow apropos command on macos | |
# Using `apropos` on macos rebuilds the whatis database every time. | |
# Fish shell uses apropos for command completion. | |
# Simply add the file below to `~/.config/fish/conf.d` to fix the issue | |
set db ~/.whatis.db | |
function apropos_update | |
echo "Updating apropos / whatis database at $db" | |
man --path | tr ":" " " | xargs /usr/libexec/makewhatis -o $db | |
end | |
function apropos | |
[ -f $db ] || apropos_update | |
/usr/bin/grep -i "$argv" $db | |
end | |
function whatis | |
[ -f $db ] || apropos_update | |
/usr/bin/grep -i "\b$argv\b" $db | |
end |
@montaro a better fix has been merged into the fish code base, but hasn't been released yet.
For now, you can copy the following files into your .config/fish/functions
directory:
Thanks again @folke you saved me from migrating to Zsh :)
Yeah, same. Thanks @folke!
Thanks !
👍 ta!
Works! Thank you @folke!
@rodrigobdz this has been merged a while back and has since been released, so you should no longer need this if you're using the latest version
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a million!