mrmrs / vimgifs

http://vimgifs.com
116 stars 16 forks source link

Generative gifs, instead of screencaps #65

Open ELLIOTTCABLE opened 6 years ago

ELLIOTTCABLE commented 6 years ago

This is a super-cool project! I love the bite-sized alternatives to vimcasts; and yet still visual enough to be an improvement over the built-in documentation for visual learners. :+1:!

That said, the screencap'd .gifs of macOS Terminal.app's “basic” theme … they're kinda janky. (No judgement, you do whatever's handy to get a project like this rolling!) I'm browsing through them out in middle-of-nowhere Montana, and the ~megabyte .gifs are really taking their sweet time loading.

So, I just wanted to drop by and suggest an alternative: Have you considered generating/versioning terminal dumps of vim interactions, and then automatically generating optimised .gif files from those when they change?

Here's an example asciicast (there's alternative formats, but these are popular right now), generated from this input file (notice, also, how small the input file is, and how git-versioning-friendly the format is!):

example gif 1

That thing is 100kb. That's all. (They're so efficient and crisp, because the .gif only includes a single image-frame for each change — interactive terminal-emulator content often has a lot of waiting, in-between changes.)


Now, the advantages aside, there's an obvious disadvantage to this approach: the lack of the “what keys I just pressed”-overlay!

There's ongoing work (asciicast specification v2.0 providing "i" events representing keypresses on stdin) that would enable this, but even though that's largely implemented and being released soon, it's not implemented in asciicast2gif, and I don't know how, when, or if that's in the pipeline. I suspect to make this happen, somebody is going to have to go implement that, and send a pull-request.

(Meanwhile, there's Kraymer/keyriban, which was implemented specifically for this purpose — it's now deprecated, pending aforementioned asciicast 2.0 format, but hey, it's an interim solution if you want to start recording new gifs, and think my idea above is a good one!)

ELLIOTTCABLE commented 6 years ago

An update: there's now also svg-term-cli, which makes it trivial to ship these as even lighter, smoother, vector images. (=