From 5877c2d475ba1bdcb8e73363d9e7ee5aa69a3faa Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 25 Aug 2024 01:02:35 +0100 Subject: [PATCH] Abbreviations are better than aliases --- source/_notes/13.md | 2 +- source/_notes/14.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 source/_notes/14.md diff --git a/source/_notes/13.md b/source/_notes/13.md index 71d676f..9a699ef 100644 --- a/source/_notes/13.md +++ b/source/_notes/13.md @@ -1,7 +1,7 @@ --- title: 'TODO: Try zellij as a potential tmux alternative' date: 2024-08-23 16:52:06 -tags: [Linux, Shell, Zellij, tmux] +tags: [Linux, Shell, Zellij, tmux, Command-Line] --- - diff --git a/source/_notes/14.md b/source/_notes/14.md new file mode 100644 index 0000000..ad8dad4 --- /dev/null +++ b/source/_notes/14.md @@ -0,0 +1,29 @@ +--- +title: "Abbreviations are better than aliases" +date: 2024-08-25 01:02:35 +tags: [Shell, zsh, Linux] +--- + +Aliases are a way to shorten long or complicated commands or to easily add additional arguments when running commands. + +Common aliases are `gs` for `git status`, `a` for `artisan` and `dr` for `drush`. + +I've been experimenting with Zellij today 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 these aliases means it's easier and quicker for me to run these commands. + +The issue with aliases, I think, is that you can forget that the underlying commands are if you only type `gs` or `zl`. + +It's also not easy when giving demos, pair programming for others to see and understand the commands that are being run. + +Instead of aliases, I mostly use abbreviations that expand automatically after pressing the space key. + +That way, I and others get to see and understand the commands being run. + +Note: I originally saw this done by [Sebastian Daschner](https://blog.sebastian-daschner.com/entries/zsh-aliases) and I originally used his ZSH expansion code, but now use [zsh-abbr](https://zsh-abbr.olets.dev). There are settings for this in Nix/Home Manager. + +## Links + +- +- +-