|
|
|
|
|
by thor_molecules
470 days ago
|
|
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. |
|