Make the `run` command cleverer by also searching for a `.ignored/run`
file, following the convention of always ignoring a `.ignored` directory
from Git.
This allows me to have a local `run` file that doesn't need to be
committed and pushed to the repo (e.g. it's too specific to me), and
being able to keep it outside of the root of the project directory where
it could be committed accidentally.
A similar approach was done by Andreas Möller using Makefiles in this
article:
https://localheinz.com/articles/2020/05/07/using-makefiles-in-projects-where-i-can-not-use-them
With this function, the `.ignored/run` file is executed if it's found
and exits with the status code of the command.
If not, it will fall back to using `./run` as before.
I considered reversing these and checking for `./run` first as there
could be a performance benefit but, if neither file is found, I want the
error to show `./run` and not `.ignored/run` as that's the main use
case.
As described in
https://difftastic.wilfred.me.uk/git.html#difftastic-by-default, the
`--ext-diff` option needs to be used for difftastic to be used on
commands other than `git diff`, such as `git show` or `git log`.
> This only applies to git diff. For other git commands, you still need
to specify --ext-diff, or use an alias as described above.
```shell
$ git diff
$ git show HEAD --ext-diff
$ git log -p --ext-diff
```
> Conversely, if you need to copy/paste a diff in the standard diff
format, you can use git diff --no-ext-diff.
Migrate from `zsh-expand` to `zsh-abbr` as it seems more performant and
isn't giving me unwanted expansions, such as when typing `run` within
this repository and it completing to something else.
Whilst Home Manager does have `programs.zsh-attr`, there isn't an option
for setting global abbreviations that expand anywhere in the command,
which I need to replace global ZSH aliases such as `G` which expands to
`| grep`.
For now, I've installed `zsh-abbr` via zplug and am creating the
`user-abbreviations` file using Home Manager where I can use `attr -g`
for global aliases.
If or when support is added for global abbreviations in Home Manager,
I'll switch to `programs.zsh-abbr.abbreviations`.
`programs.zsh.shellAliases` is still used for aliases that shouldn't
expand, whereas everything else has been moved to abbreviations.