Closed mortenscheel closed 3 years ago
That’s cool, thanks for sharing!
I’m also not an expert in those, but that’s about what I expect jq to look like and I’ve confirmed it works for my system text substitutions.
I’d be happy to include this in the README if you wanted to make a PR. Maybe down by “highlighting” and “vi”?
Instead of read
I prefer zsh’s nice syntax for creating an array from multi-line output:
typeset -a my_array=( ${(f)”$(my_cmd)”} )
will read each line of my_cmd
’s output into the array my_array
. If each item can be more than one line (might be relevant here - I haven’t tested what happens if you have a text substitution where the substitution has line breaks) instead of (f)
you can do (ps|thedelimiter|)
(can use a different character instead of pipes). Then iterate over that array. You can find some examples in zsh-abbr.zsh - for example in _abbr:import_fish()
and _ abbr:import_git_aliases()
Closed by PR #37. Thanks!
Hi, thanks for a great plugin!
Yesterday I came across this post on Reddit: Is there a way to get the macOS Text Substitutes feature working in Terminal?
It was a fun challenge, and this is what I ended up with:
I have no idea if this is just a fun gimmick, or something a lot of Mac users would like to have. I just thought I'd share it here and let you decide.
Also, I haven't really used
plutil
orjq
before, so there's probably cleaner ways of massaging the plist entries into a usable format.