From 7196b63ee457c2fecb55cf9b0f5862fe075ff3fc Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 25 Aug 2024 21:48:41 +0100 Subject: [PATCH] Add daily email for 2024-08-24 Abbreviations are better than aliases --- source/_daily_emails/2024-08-24.md | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 source/_daily_emails/2024-08-24.md diff --git a/source/_daily_emails/2024-08-24.md b/source/_daily_emails/2024-08-24.md new file mode 100644 index 00000000..1d65305d --- /dev/null +++ b/source/_daily_emails/2024-08-24.md @@ -0,0 +1,31 @@ +--- +title: Abbreviations are better than aliases +date: 2024-08-24 +permalink: daily/2024/08/24/abbreviations-are-better-than-aliases +tags: + - software-development + - shell + - zsh + - linux +cta: ~ +snippet: | + Why I prefer abbreviations over aliases in my zsh configuration. +--- + +Shell aliases are a useful way to shorten long or complicated commands or to easily add additional arguments when running commands. + +Common aliases are I see are `gs` for `git status`, `a` for `artisan` and `dr` for `drush`. + +I've been experimenting with Zellij for the last day or so, and have written aliases like `zl` for `zellij list-sessions`, but have also added extra arguments such as `zellij list-sessions | sort | grep -v EXITED` to sort the sessions and filter any exited sessions. + +Running aliases makes it easier and quicker for me to run these commands, and less likely for me to make errors and type incorrectly. + +The issue with aliases is that you can forget that the underlying commands are if you only type and see `gs` or `zl`. + +It's also not easy when giving demos or pair or mob programming for others to see and understand the commands that are being run. + +Instead of aliases, I mostly use abbreviations with zsh-abbr that expand automatically after pressing the space key. + +That way, I and others get to see and understand the commands being run. + +I still have some aliases that don't expand but now I use abbreviations as my default approach.