Re:Why “alias” is my last resort for aliases
by thor_molecules on Wednesday March 05, 2025 @09:51AM
(#43267244)
I reach for the ~/bin/thing approach when I want the utility to be useable from vim.
For example, if I define an alias thing, vim won't know about it.
But as a executable on my $PATH, I can do any of the following:
:%!thing
:'<'>!thing
:.!thing
A good example is on my work machine, I can't install jq because reasons. However I do have python, so I have a simple executable called fmtjson that looks like this:
#!/bin/sh
python -m json.tool --indent 2
When I want to format some json from vim, I just run:
:%!fmtjson
Easy to remember, easy to type. Plus I can use it in pipes on the cli.
For example, if I define an alias thing, vim won't know about it.
But as a executable on my $PATH, I can do any of the following:
A good example is on my work machine, I can't install jq because reasons. However I do have python, so I have a simple executable called fmtjson that looks like this: When I want to format some json from vim, I just run: Easy to remember, easy to type. Plus I can use it in pipes on the cli.