id: | b2503a89-1dca-4960-b1d2-baf1ef62a44d |
tags: | shell,customization |
Sometime last year I read a blog post (sorry, I don't remember the exact link) about a simple but effective technique to organize personal scripts: put a comma in front of their name. I was intrigued and immediately switched all of my scripts to follow this pattern to put it to trial. Since then, I am happy to say that I have not once considered reverting this change.
♯Table of Contents
♯Proposal
Many of us keep a number of scripts (or other homebrew applications) in our
~/bin
directory to assist with various common
tasks. I have a powerful find/replace script, various screenshot commands, a
journal management script, a script to publish my website, a script to refresh
the current list of known MIME types, and more.
The proposal is that for some script foo
,
just call it ,foo
instead!
Let's consider an example of what that might look like (reduced example):
➜ ls ~/bin
,j ,replace-all ,ss-region ,ss-window
janet odin terraform plantuml
We can immediately tell that the scripts I wrote start with a comma, and the other executables in that path do not.
♯Why Bother?
Yay for commas? Why should anyone care? I don't have the original blog post that I referenced, but I can convey what I have enjoyed about this approach - it boils down to one major thing:
Trivial Discoverability
Discoverability can have a massive impact on workflow. The comma gives me something that is unique where it matters:
- When I press tab to show available commands.
- When I list the contents of my bin directory.
- When I reverse search command history.
- When I want to run a command using rofi.
If I don't exactly remember a name but I'm pretty sure I wrote something, I can
just type ,<TAB>
and get a complete
list of every script/executable that I have. This easy pattern extends to manual
review where I can trivially, visually parse results.
It Costs Nothing
Nothing about how I work broke - it just got easier. The time "cost" to update names to start with a comma was actually beneficial regardless as I was long overdue for reviewing my current set of scripts.
♯Conclusion
Try the comma and you may enjoy it. Or don't. This isn't some revolutionary technique that will skyrocket your productivity, but it's nice and I like it.