VIM Fundamentals VIM Fundamentals

What Makes a Good Plugin

Learning Paths:
Check out a free preview of the full VIM Fundamentals course:
The "What Makes a Good Plugin" Lesson is part of the full, VIM Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

ThePrimeagen discusses what an ideal plugin should be and how they should have quick and intuitive commands to allow for faster user actions.

Get Unlimited Access Now

Transcript from the "What Makes a Good Plugin" Lesson

[00:00:00]
>> So we're gonna now go into this last little part. And there's two things I wanna do. First, I did wanna show you a plugin that I think embodies vim correctly. It was written by this person I did tweet out, I asked him, Timothy Pope as the Pope of vim which of his two pictures could we use?

[00:00:18] And of course, instead someone just made this which I feel like is the most appropriate form we could make for Tim Pope. It contains all the right facets to be able to do this. There we go, everything's ready, we're awesome. See, I'm still using plug, just like what I showed you to use plug's great.

[00:00:34] All right, so I don't think anything broke. So the plug I really like is called Fugitive. If I do this what it is is Fugitive allows you to look and get, right? There's a whole set of things around get, now it why in bodies the vim kind of spirit, is that I can walk up to it, I can press a single character and it does exactly what I think I'm gonna do as for stage.

[00:01:02] I want to stage all of it. I want to unstaged all of it. I want to stage these two things. I want to take this tea that we did and I just want to get rid of it, right? It's gone, it's not a part of this. It's been deleted from my system.

[00:01:13] It's also out of all of this. I can add all these together and then I can press CZZ I've just stashed all those changes. They are now in my Get stash, I can do CCA come right back to where we were be able to do that I can go on top of this, I can look at the two differences between these.

[00:01:30] I can go to the previous file, right you can actually see right here I'm inside of get. I'm actually inside of the other one, the historical one. I can navigate back out of here I can go to the new one. This is the one we're doing right now.

[00:01:43] It has a bunch of stuff and everything is all done via the keyboard but not just simply scrolling to each choice, right. So when I wanted to stash CZZ it is just like another command to do exactly what I want. So, it takes a long time to get to know all of these commands.

[00:02:00] But in the end what makes it so powerful is that it's just like the rest of vim when I wanna do something like muscle memory takes over and it just does it. I don't have to scroll to the right place to be able to add the right things, I don't have to do all that instead, I can just do the action.

[00:02:16] I can do CC, I can go right into a commit message, right? Do all that committed, you'll show me everything that's changed. I can get push and just push it right onto Master, so then nav playground you just got a whole bunch of extra stuff. And it's going to go do that I luckily cloned it down with HTPS.

[00:02:31] So it doesn't work for me to push it up. It's gonna try to ask me to do that. This is something that I think embodies the right method which is whenever you're doing things with them, you should try to think why am I not pressing like a couple keys to do what I want?

[00:02:44] Why am I searching, why am I taking this extra time? Why am I treating it as if it's like a mouse based UI, and I'm trying to find the right thing. Something is fundamentally broken about that and you'll never really enjoy the fast speeds of at all. If you're always having to do this like kinda slow based searching to get everything done and that's kinda how I think the ideal plug ins work.

[00:03:09] It's also why I've said multiple times that I'm not the biggest fan of fuzzy finders, I think fuzzy finders are great stop gaps. But if they're your primary form of navigation, I do think it's wrong. Because if you're in any sizable project, you have to type in a decent amount of characters to get to where you want.

[00:03:26] And then you end up having like just the dumbest set of characters in your head like I need to go to performance handler. I'm gonna go capital PE, capital HAND, right? You have to come up with like all these ways to be able to get to what you want and it's like never the right way, right?

[00:03:42] That's kind of how I think about it Is that great for stopgap, great for the zero 60 but there has to be better. Well, the next thing you can do is you can always use your already loaded buffers. This is better, because then the amount of stuff you type is much smaller, right?

[00:03:58] Now it's smaller, it's a little bit easy but still, there's a lot of cognitive overhead. I just think something about this still doesn't feel quite the right way and I think this works with any plug in you use requires you to think a lot instead of memorizing some command that becomes second nature as you use it enough times.

[00:04:18] I feel like something's broken about that. Some things you just can't get away from new project. You got a fuzzy find your way in.