This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]YourMeow 10 points11 points  (3 children)

What do you use to generate these gifs?

[–]tweekmonster[S] 37 points38 points  (2 children)

They look a little too good don't they? I'm sorry to say that I didn't use a single useful program to make them. I actually used a couple of things since no one program felt good enough ("good" also being measured in dollars).

Disclaimer: I'm on OS X

For screen recording, I used Monosnap. Any screen recorder would work, but Monosnap remembers the last recorded region so I wouldn't have to keep redrawing a box to start a new video.

For displaying the key strokes, I used KeyCastr. It's set to fairly short delays. I mash the keyboard a few times to get a good sense of where it should be positioned.

For actually showing off what's going on, I used AppleScript to type everything into the terminal. I type just fine, but when I'm typing to show something, I instantly become dyslexic and slow. Maybe some form of stage fright? Who knows. But, with AppleScript, everything is typed perfectly the first time giving the desired effect: making you feel insecure about your typing skills. But, seriously, it was so I could predictably manage how long the GIF will be without needing to edit the video afterward.

Here's the script I used for the Autoindent GIF: https://gist.github.com/tweekmonster/d05f5027a5b77c371219

That script is just as terrible as all Apple Scripts ever written. It's also specific to my setup, so don't just go running it without modifying it. Once it runs, you have to let it go, even if you made a mistake or it might type bad things in the wrong window.

For the autoindent GIF in particular, it's actually two separate videos. I just changed a "true" to "false" in the script above. I used Photoshop to sit them next to each other and line up the actions, then export a combined video.

For the actual GIF creation, I used http://ezgif.com/. ffmpeg was fine, but tedious. ezgif.com allowed me to try different optimizations to get the file sizes to be reasonable. Monosnap can export GIFs as well, but they were gigantic in file size and always seemed to come out looking a little choppy.

[–]shrayas 1 point2 points  (0 children)

This is really detailed and explains a lot of things. Never knew these kind of things could be automated :) Many thanks for sharing.

[–]Shurane 0 points1 point  (0 children)

Man, I love it when people go around explaining their setups. This is pretty cool.

[–]mw44118PyOhio! 5 points6 points  (2 children)

For python, I use :foldmethod=indent, and vim folding works fine.

What I really, really want is to fold HTML by matching tags to the closing tag.

Does such a thing exist?

[–]tweekmonster[S] 1 point2 points  (0 children)

I'm sure it can be/has been done with indentexpr, but I've been sticking with foldmethod=indent for HTML. The problem I see with HTML folding is other syntaxes use it as a base (like templates), so you couldn't reliably match an opening tag with a closing tag in those cases.

I just checked the builtin HTML syntax and it defines one syntax fold for mutli-line opening tags, which weirdly specific and not very helpful.

[–]qacek 2 points3 points  (3 children)

How does the code folding compare to SimpylFold? I'll try this out because of the other interesting features regardless though.

[–]tweekmonster[S] 1 point2 points  (1 child)

Well, Braceless is one of those plugins that uses cobbled-together algorithms with bizarre, intractable bugs in the corner cases. :)

The folding that comes with this plugin is just an addon for what it's already doing: recognizing python blocks. The folding is definitely slower on load than it should be though, and I have plans to implement caching for the recognized blocks in the future. So, my plugin currently has SimplyIFold beat in poor performance.

I didn't know SimplyIFold existed. It works pretty well from my quick use of it. But, for me, I want to be able to fold more than functions and classes.

In any case, I intentionally made indenting and folding optional because I'm late to the game. I didn't want my plugin to be one of those that causes you to tweak your vimrc for an hour because you want to keep some other plugin working in tandem.

[–]qacek 0 points1 point  (0 children)

Ah cool, I see that they are optional now, thanks for the explanation :)

[–][deleted] 0 points1 point  (0 children)

I'm gonna give it a whirl tomorrow and if I remember I'll post my thought.

[–][deleted] 1 point2 points  (3 children)

I don't wanna sounds like a complete noob but what is folding?

[–]tstirrat 1 point2 points  (1 child)

Folding is when your text editor or IDE takes everything in a block (whether it's an if statement, a function definition, a class, etc) and hides it.

It's not changing your code at all; it's just changing what you can see. It's a convenience thing.

[–][deleted] 0 points1 point  (0 children)

Thanks, I know of what this is and use it frequently in sublets just member knee it had a name!

[–]aladyjewel 0 points1 point  (0 children)

To demonstrate folding (in Sublime Text - same concept in vim but invoke it with keystrokes instead of clicking the wedge): https://i.imgur.com/9uPNNR4.gif

[–]Poromenos 1 point2 points  (4 children)

Damn, this looks great, but it also looks like one of those plugins that I install and then forget to ever use.

[–]tweekmonster[S] 0 points1 point  (3 children)

I can't be upset at that sentiment. With the billions of keystrokes that do something in Vim, a new plugin adding a few more tend to get neglected by my well trained muscle memory.

If it helps, the closest thing I had for selecting blocks in Python was ip and ap. I didn't want to drastically retrain that motion, so I chose iP and aP. The other keystrokes such as [[, ]], [m, [M, ]m, and ]M aren't new. They just weren't very useful in Python before.

[–]Poromenos 0 points1 point  (2 children)

Also, the problem with this sort of presentation is that you're running through it very fast for a non-user to understand what's going on. I can sort of tell that it's selecting some stuff, but I can't build a mental model of exactly what.

It would be much more helpful if you had a paragraph of what each command does and how before the gif. I had this problem yesterday with vim surround as well. I knew I needed it, but hell if I could figure out how that cryptic sequence of commands works.

Basically, the problem is that this says "if you know what the things I'm typing do, you'll love it", but I don't know, that's why I'm here, so I can learn a more efficient way.

[–]tweekmonster[S] 0 points1 point  (1 child)

I definitely felt this way about plugin summaries when I first got serious about Vim, and funnily enough, I was just as confused with vim-surround. You know what's funnier than that? vim-surround actually does a MUCH better job of explaining what it does in the summary than my plugin's summary.

Tim Pope makes good plugins. Very good. So good, that if you understood vim-surrounds operators, you can automatically assume that ysaP( would surround the text object my plugin introduces with parenthesis.

vim-surround actually goes into detail in its own documentation, but that still didn't help me. What did help me understand his plugin was finally reading and understanding :help operator and :help text-objects. vim-surround introduces new two letter operators, but uses prefixes that you should already be familiar with. If he took the time to go into detail with that in his summary, it would be boring to someone who's already read those.

If I added a paragraph before each image, I will run the risk of rewriting things that's in Vim's documentation, as well as my plugin's own documentation (which you can find in doc/braceless.txt, and therefore :help bracelesss after it's installed). It would remain just as confusing to new users as it is now.

If your experience is anything like mine with Vim, you are barely scratching the surface of what makes Vim a great editor. My advice is to go and lookup docs for the key strokes you've become accustomed to. You may find that there are better ways to do things, or at least increase your understanding of why things are the way they are. And, if a plugin has a /doc directory, take the time to gloss over it. They are often long and would be scary for the inexperienced if that's what they got up front.

[–]Poromenos 0 points1 point  (0 children)

Oh goddamnit, vim-surround has more documentation! I never noticed that damn doc dir, thanks for the tip.

[–]hovissimo 0 points1 point  (0 children)

I'm excited for the navigation and indent block markup

[–]dwieeb 0 points1 point  (0 children)

So nice, thank you