Move the keyboard to the floor
If you use EndeavourOS, know that you shouldn't ask for support on the Arch forums, its a policy they have.
The upside of not changing the I/O is accessory compatibility.
I've written multiple Zsh plugins, so I've gotten familiar with a lot of Zsh's features. I've probably read every line in man zshexpn twice by now having referenced it so much.
Zsh expansions can look gnarly because parameter expansion forms can be nested. Where Bash has to do:
tmp=${foo%$suffix}
len=${#tmp}
Zsh can do it in one:
len=${#${foo%$suffix}}
Once you add PE forms which don't exist in Bash, parameter expansion flags, array subscript flags, globbing qualifiers and modifiers, you can get something which looks absolutely unreadable.
Nice work! I've definitely had some fun with convert recently, as you might tell from the community banner.
spoiler
It is an image showing the script I used to create it 😛.
I used to write Bash more than anything, but now the things I write are either simple enough to keep POSIX or complex enough that I miss the extra niceties Zsh provides.
I have never gotten into Pokemon save for the Mystery Dungeon series, but I find it really engaging. Things I like:
- instead of move selection gated by limiting to 4 moves and limiting PP, there's AP. You gain 2 AP per turn, and can spend more of it to do more powerful moves.
- Instead of types doing double/half damage, types give buffs/debuffs which are apropos to that type interaction. (Water "extinguishes" fire, lowering attack)
- All buffs/debuffs are on a turn timer (attack is lowered for 3 turns)
- Buffs/debuffs transfer when you switch beasts
- Stacking the same effect adds turns to the timer rather then strengthening the effect.
- All timers are visible onscreen under the HP bar
- Before you confirm an attack, the effect icons show under the highlighted enemy.
Lunistice, Waveland, Cassette Beasts, and Dungeons of Aether.
I got all the enjoyment I can out of Dungeons, so I'm probably going to swap back to Into the Breach for my puzzle fix. Cassette Beasts is finished, unless I want to finish the postgame or hunt bootlegs.
Nice! This one was probably the most likely to be found, I actually got this trick from somewhere else online before I understood what it was doing. If you're curious, I've got a few other lines of nested Zsh expansions I picked out but didn't post.
reply=( ${(M)dirs:#*/$~pattern}(Noe['REPLY=${(l[3][0])#REPLY:t}'][1]) )
Literal explanation
$~patterninterpret globbing characters (like*,?, or[a-z]) in the parameter$pattern,${(M)dirs:#*/$~pattern}filter the array$dirsto those matching*/$~pattern.${...}(...)everything in(...)are globbing qualifiers(N)enablenullglob(oe[...])sort by the result of the shell snippet, where $REPLY is used as input and output${...REPLY:t}remove all leading path components from $REPLY${...#REPLY:t}substitute the length of that string${(l[3][0])#REPLY:t}left-pad with zeroes to a length of 3reply=( ... )save as$reply
Full context
This line is in a function which dynamically expands ~[g:abc] to one of my git repos, choosing the shortest directory matching path/to/abc*, or if no match is found, the shortest matching *abc*. So between /long/path/to/abcdef and /short/abcdefg, it would choose the first one (provided both of those were in the search paths I configured).
I found it soon after my comment, thanks though!
Just make sure you read the news (restart sshd)