All my Fish functions
I think I’ve wrapped up my conversion to Fish for the time being. I can honestly say that now that I’m past the tinkering phase, I’m more productive in Fish than I was in Bash. Which is no small claim, I was pretty good at Bash.
In the process of the transition I created quite a collection of functions and completion scripts, so I figured I’d make them available on the off chance that someone else is taking the same journey and/or is curious.
The full collection is up on GitHub, with descriptions of all the folders and every function. I diligently added a
--description to every function in the source, then wrote a script to list them all with their descriptions. That script is in the repo, too.
Most of these came from my Bash setup, some even saw some improvements over their predecessors. You’ll even recognize some of them from my Shell Tricks posts. There are a few highlights:
- All of the files in
functionsgo in the auto-load folder, so none of them actually have to sit in memory while you’re using the shell. Lots of functions, little consequence.
- All of the app shortcuts (Acorn, TaskPaper, Tower, etc.) have completion commands that work very nicely. These are located in the
completionsdirectory, which is also auto-loaded.
mkdircommand handles deep creation of intermediate directories (
-p) and asks if you want to
cdinto the final target after it’s run. The prompt takes a single key (y/n) and can be dismissed with return. While there are some downsides, I generally like Fish’s
- There’s a bash folder with some of my more involved bash scripts that I’ve been successfully running from Fish without issue.
- A smart
catshadow function that uses
batexcept when it’s a Markdown file, in which case it uses mdless.
cddcommand is pretty sweet for jumping deep into a directory tree with fuzzy matching (and
fzfselection when there are multiple matches)
fixtakes search and replace arguments to fix up the last command you ran.
clre-runs the last command and copies the output to the clipboard
- I ported
imgsize, my horizontal rule functions, aspell tools, and more. Plus a slew of little math utilities like
If you’re just starting to play around with Fish, this should be a great way to see what’s possible and get started with porting your own setup. If you’re a long-time Fish user, you’ll probably be able to tell me where all I went wrong (which I’m totally open to), but maybe you’ll find some inspiration, too?
Check out the full collection at github.com/ttscoff/fish_files.