Skip to content

Instantly share code, notes, and snippets.

@LinuxIsCool
Created September 25, 2020 06:39
Show Gist options
  • Save LinuxIsCool/4de108fe7d8d22f57003c4c742f153dd to your computer and use it in GitHub Desktop.
Save LinuxIsCool/4de108fe7d8d22f57003c4c742f153dd to your computer and use it in GitHub Desktop.
Fish recipe for interactively searching all of the commands on your path and openining the selected man page.
# Inspiration from: https://github.com/jorgebucaran/cookbook.fish#how-do-i-find-and-run-commands-in-fish
# Set $all_commands to a list of all commands available on $PATH
set -l all_commands (ls $PATH | column)
# Use `whatis` to append a one-line description of each command to a file
for p in $all_commands
whatis $p | tee -a all_command_descriptions
end
# Pipe the results into fzf, use string to grab the command name, and pass to
# man for further investigation.
man (string trim (string split '(' (cat all_command_descriptions | fzf) | head -n 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment