---------------------------------------- | |
Making VF-1 Sexy | |
August 06th, 2019 | |
---------------------------------------- | |
VF-1 is fast, but it's also pretty basic. It doesn't (yet) do | |
pretty colors by types or anything sweet like that. Many of you | |
are probably fine with that. "Colors are useless" people... I | |
hear you, but I don't agree. | |
In fact, even if the colors aren't structured, I still want them! | |
I've been piping my VF-1 output through lolcat for a few months. | |
It's brilliant, but was incomplete. | |
Not to mention any names, but some of you don't wrap your text. I | |
try not to be picky about whether wrapping happens at 80cols or at | |
67cols, but when a gopher doesn't wrap at all it makes it very | |
hard to read. I'll be honest, I usually just skim those posts as a | |
result. | |
"Why," I ask myself, "don't they just run it through fold(1)?" | |
"Duh," I answer myself, "they don't want to or don't care." | |
"But self, it would make my reading more convenient!" | |
"Come'on, tomasino. What part of _don't care_ did you not get?" | |
"I suppose you have a point. You're pretty smart." | |
"Damn right..." | |
"So..." | |
"Oh crap--" | |
"Why don't you solve it on the client end?" | |
And I sigh and say, "Of course. VF-1 lets me lolcat. Why not fold | |
as well? It should be simple." | |
If you don't care about lolcat and only want to fold output | |
automatically in VF-1, here's what you do. Add the following line | |
to your ~/.vf1rc: | |
$ cat ~/.vf1rc | |
handler text/plain fold -sw 80 %s | |
If you want to lolcat it too, like me, then you need to do a | |
little bit more. I'm not sure what method VF-1 uses internally to | |
parse the handlers, but it chokes hard on pipes. So, I wrote a very, | |
very basic shell script to do it for me. | |
$ cat ~/bin/goph | |
#!/bin/sh | |
FIN=${1:-"/dev/stdin"} | |
fold -sw 80 "$FIN" | lolcat -f | |
Put that in your PATH and now you can pipe anything you want to | |
'goph' and have it be pretty. It'll also take a file input. Then, | |
in your ~/.vf1rc, you can add: | |
$ cat ~/.vf1rc | |
handler text/plain goph %s | |
Let there be color, and pretty wrapping. Enjoy. |