I’ve had it out there for a while, but I thought I’d point out that I’ve ported my universal “help” command to Fish.
halp removes the hassle of figuring out whether a command’s help comes from
CMD -h, or
type CMD. Just run
halp CMD (where CMD is the command you want help on) and it will figure out the rest.
To install the function, just save the halp.fish file to
~/.config/fish/functions. Once there, you can just type
halp CMD to get an appropriate help screen, whether it has a man page, a help page, command line help, or is an alias or function. By default it’s set up to use Dash for Fish native commands (rather than opening your browser), but you can edit the function to change that (see the comments). That requires that you’ve installed the Fish docset (Dash Preferences->Downloads->User Contributed). My local version of the function also replaces the
man $cmd line with
open "dash://man%3A$cmd" to open man pages in Dash (requires the manpage docset). Edit as needed to make it work for you.
As an aside, if you regularly edit Fish functions, it can be handy to use your favorite text editor rather than Vim or the internal editor. I have a function called
funcsubl that wraps the
funced command with
subl -w and autosaves after closing the window. You can modify this to work with any editor, you just need a “wait” flag (like
subl -w). Here’s my version.
Check out all my public Fish functions in the GitHub repo.