VIM Fundamentals

Introduction

ThePrimeagen

ThePrimeagen

terminal
VIM Fundamentals

Check out a free preview of the full VIM Fundamentals course

The "Introduction" Lesson is part of the full, VIM Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

ThePrimeagen provides a brief overview of the course, briefly introduces ED, and discusses the history of vim. The program that predates vim is vi which was written by Bill Joy for small systems on slow internet connections.

Preview
Close

Transcript from the "Introduction" Lesson

[00:00:00]
>> Hey welcome everyone I hope that everyone here is very excited about Vim. I'm very excited about Vim, and I'm kind of known as someone that gets a little yelling and screaming about vim. So I'll try to tone it down a little bit, and help you guys get focused up an awesome adventure.

[00:00:15]
So we're gonna kinda go through this this day, hopefully we'll be able to stick to most of this, we'll see how it goes. We're gonna start with just some basic introduction some hopefully some motivational material. After that I'm gonna go through the basics. Now we're gonna start pretty basic, and we're gonna move from there because I don't know what level everyone's at, and it's best just to assume the most basic and go forward.

[00:00:38]
Eventually we'll touch on the VimRC. We'll touch on navigating files, going through things, marks, etc. We'll do some recapping some plugins, some quick fix lists, some advanced tech manipulation, even writing your first little bit of a plugin. And eventually, I will then just get on here and pontificate about what I think is the greatest way to use them.

[00:00:57]
That's kinda the ending, and so when we're kinda going through this, you'll notice that my Vim looks ugly, that the experience isn't that nice. That's because we're gonna start with nothing. And we're gonna slowly make it into something. Now vim is not a batteries included editor. When you use VS code, everything's included the open it up, looks really nice you click around with your mouse.

[00:01:19]
Hopefully by the end of this, you'll just take your mouse and gently placed in the garbage and you'll never have to use it again. And you'll be able to fly on your keyboard and it'll be fantastic. All right, so we're gonna go through this if you don't know there is a Gatsby course I believe I'll be linking it here, if you go there, you can follow along.

[00:01:36]
You don't necessarily have to follow along any link that I'll be asking you to curl down and edit with Vim. I will just be pasting in the chat, so you don't have to worry a lot about that.
>> All right, so, like anything in life, a huge thing that affects our life is always our small decisions.

[00:01:54]
You're gonna be presented with a few large decisions in your lifetime, and those will greatly alter your life but it's like a single moment. But a lot of the things that determine our destination, aren't those big moments, right? And you can't control those big moments you don't know when they're gonna happen, you don't know how they're gonna happen.

[00:02:10]
It's the little things that really you can take control of, like something as simple as just brushing your teeth every day. Obviously, you're gonna have great teeth health and you'll have reduced risk of heart attack all these different things go into it. Just by making really small decisions, and there's I've been really hard.

[00:02:26]
Same with typing, if you practice if you take it seriously, if you don't look at your keyboard, you'll get really good at typing and your efficiency will go way up. And that is something that you just simply have to do day in and day out, and it's not like it's gonna make you a better developer.

[00:02:42]
But you'll be, thinking less about typing, you'll be thinking less about the thing you have to do, and more about the thing you're doing. And so it's just the little decisions, in Vim is like one of those little decisions. You simply have to commit to it, you have to learn about it, you have to practice each of the little moves, and throughout time, it'll get better and better and better and you'll get faster and faster and faster.

[00:03:04]
But Vim is kinda weird, right? For those that haven't opened up Vim, if you open up Vim, it probably feels arcane, esoteric, strange, and then you don't know how to quit. And then you become a meme that exists all over the Internet and you can't quit Vim and we all laugh at you, right?

[00:03:21]
So it's a weird piece of software. So I kinda wanted to show how did Vim get started or what, was before VIM really? So I'm gonna give you the most brief, and partially incorrect history of how VIM got started. So I'm gonna jump back over here. And just for a moment, I'm gonna open up a program called ED.

[00:03:42]
ED came before VIM, technically it was expert like I said it's partially incorrect history of VIM. So I'm just gonna open up a file. So let's find the file, we can open up what the README, I'm gonna open up the readme with ed. And when I do that, if I hit Enter, it's gonna give me just a number.

[00:04:00]
So if you're a developer today, how do you edit this file? Anyone have an idea? You probably don't, because I don't even I'm not even sure I start hitting Enter, It starts saying question marks for me. Like how did anyone develop anything at some point in their lifetime on ed?

[00:04:13]
Well, it turns out a lot of the software, foundationally that was developed was developed in this. So you can actually start typing in like line numbers, let me see number one, okay. Then you can hit Enter, and you can like walk through the file. If I wanted to make say like, I want to edit see, let's just see what's on line 15.

[00:04:32]
Okay, so we wanna make an edit, I can type in s/ability, and just say aboutily. All right, there we go. I've just changed the line, I am now a programmer, I've used ed, right and there's some other ways you can edit text and do things with ed, but this is how life was at one point, right?

[00:04:52]
I mean think about coming from the punch cards. How great is this from punch cards? This is phenomenal. Right but for us this looks strange. This is like I would never be able to do anything effective in this, cuz I couldn't remember where I was anything like that.

[00:05:07]
So to quit, you got to press quit then you press quit again because I didn't save my changes, or maybe I saved my changes. I actually don't even know what I just did there. We'll just assume that everything went well. And so that's it. I think overall, that just feels too strange, I wouldn't recommend getting good at it, you can, it'll be kind of like, hipster funny, but that's about as good as it will be and so we'll move on.

[00:05:32]
So ed during that time, about 1974, a guy named Bill Joy or 1976, decided he's gonna write something that's a little bit better. And he writes visual mode, which becomes known as VI. And VI is effectively where VIM comes from. And so he wrote this a long time ago, back then, you couldn't get more than 1K worth of RAM.

[00:05:57]
If you think about that, I think VS code takes one terabyte of RAM or something like that, I'm not exactly sure how many gigawatts it takes, but I know it's a lot of RAM. And so imagine if you had, effectively none, I don't even think you can spell electron with 1k, it's very, very small.

[00:06:13]
And so he wrote VI, for very small systems, and one of the hard parts is that Emacs during that time costed hundreds of dollars. So not only could you get emacs panky, you'd also have an editor whose learning curve looks like this. Very difficult but, you'd hopefully it figured out eventually you couldn't differentiate it at any point cuz it's just confusing out there.

[00:06:34]
But, you could pay hundreds of dollars for emacs or you could use ed, bill made VI, things are looking good. But then, when you start using VI, you're like, wow, why is it H, J, K and L for movement? Right? I mean, if you're using Linux at all this is very foundational, H, J, K and L is everywhere.

[00:06:51]
I think it's in Twitter, it's in Gmail, so how did that get started? Well, it turns out Bill Joy, may have been the only person on earth that had this keyboard, but he had the keyboard. H, J, K, L now had the arrow keys, you I mean, it could have been was the.

[00:07:06]
But now it's H, J, K, L now and that's just how life works, momentum, right? And so Bill Joy, he did eventually quit using vim and started using emacs. And when he did that he kinda left us with a little bit of words of wisdom. And his words of wisdom of course was people didn't know that VI was written for a world that doesn't exist anymore.

[00:07:27]
In other words, what he was trying to say is that, VI was originally written so he could edit code at home, and all he had was a 300 baud rate modem. Now, I'm pretty sure that if you looked in chat or anyone here, they most people probably don't even know what a ,it's not a term we really use, it effectively just means bits per second.

[00:07:47]
So that means he had a 300 bit per second, modem, a character usually takes about eight bits, back then they probably just had ASCII 256 so it was just eight bits. And that's all they had. And so that means you could get 300 characters a second to come into your file.

[00:08:03]
So, it was written for a world that was much, much different, today on this internet that I'm here right now. The internet that I'm using right now is technically, 3.3 million times faster, than what he wrote VI four. So it's, life's improved a little bit but, here's the deal is that just because a world that existed and you wrote a tool for that world doesn't mean it's not applicable still today.

[00:08:27]
And vi has gone through a lot of changes, it went from vi to an editor called Stevie in which nobody knows about, and I'm not even sure how to get to an editor called vim, which was based on Stevie. And eventually vi was open sourced, but vi was long since deprecated, and then became the de facto standard.

[00:08:43]
Vim was also written by guy's name is Bram, it's been contribute to a whole bunch. It's really picked up steam in the last few years as somehow a comeback editor because people are just really realizing how effective and how awesome it actually is. And so, I'm here today and hopefully we can kinda take that, and make it into something and everyone can at least leave here knowing what's available.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now