I'd do the following if I was making a sizable batch of these gifs:
Record the screen of me typing using any of the tools in Scott's link in his comment above
Import the clips into Adobe After Effects
Create a new composition for each clip and trim as needed
Then I'd use the GifGun After Effects plugin to export them as GIFs.
(There's even an option to ...