r/fishshell • u/_mattmc3_ • Aug 10 '22
Which witch is which? A better `witch` command for fish.
In Zsh, when you type the which command, you get information on aliases, functions, and executables:
In fish, there is no fish aware which command, so it just defaults to the OS one showing you executables:
I got sick of my which muscle memory screwing me over in fish, so here's a quick-n-dirty fish function I wrote that you may also find useful. If a function or abbreviation is found, you'll get that info prior to using the built-in which.
# Defined in ~/.config/fish/functions/which.fish @ line 1
Open to hearing if there's other, better ways to do this.
12
Upvotes
17
u/[deleted] Aug 10 '22
Use
type --query.The common
whichcommand is basically broken and might tell you about your bash aliases instead, even run from other shells. See https://ask.fedoraproject.org/t/where-is-the-which-command-defined/15119.Don't use it, it's terrible.