Transcript from the "Exercise 4: Vim modes" Lesson
>> Jem: So now we're on VI, it's kind of boring. If you're trying to click or hit enter, it's probably not doing anything because that's not the way VI works. And that's what makes it tricky in the beginning. But once you kind of wrap your hand around how it works, it's pretty fast to move around.
[00:00:15] So VIM has three modes. You've got command mode, insert mode, and last-line mode. Some people say it only has two modes command and insert. I like to say last-line because you have to write, save, do all sorts of file things. So three main modes. And this is, I know it's confusing but I guarantee by the end of the class once you come back to this you're like, this makes perfect sense.
[00:00:36] So command mode is where you start. That's where you're at right now. If you type anything with VIM, you saw the blank screen,
>> Jem: Let's see. So if I'd Escape, there's nothing on the screen. At the bottom you see, it's telling me nothing. I'm in command mode. So when I hit I, I'm in insert mode.
[00:00:58] And insert mode I can type, I hit Escape, I'm back in command mode. All right, everybody follow? That's why I went Mac with their new laptops, remove the Escape key, it was bizarre to me because you can't use VIM without the Escape key. Yeah, it doesn't make any sense, I don't know why they did that.
[00:01:17] Sorry, personal rant. So insert mode I. We can type. To get out of insert mode, Escape. That's it. Go ahead and try that now just so you're kind of familiar. All right, so everybody was able to type something. So let's go and type Haha VIM is easy. I know it's silly, but you learn best by repetition.
[00:01:39] That's just the fact of the matter. And probably you'll forget half these commands by the end of the day. It happens. You have to use VIM over and over and over and over again to like muscle memory. A great site if you're interested is vimgifs.com. And it tells you all the commands and kind of what should be happening.
[00:01:58] So I, of course, is insert mode, that's how we type things into VIM.
>> Jem: All right, any questions so far? Cuz we're gonna dive a little bit deeper into VIM. I wanna make sure everybody's comfortable. It's weird the first time cuz if you've only used a GUI based text editor this is bizarre, why do I have to type I to hit Escape and keep going in a circle, it doesn't make any sense.
[00:02:28] But over time it will, it'll become second nature.
>> Jem: Just to go into VIM, that's all it takes. So I'm in a chatroom just watching questions.
>> Speaker 2: You can repeat the question out loud [INAUDIBLE].
>> Jem: Okay, the question was I'm not able to open VIM on Mac, so on a Unix-based system we'll type in VI.
[00:03:04] In Windows, you need to be in the Bash shell, or some sort of Bash interface. Windows does not have VI built into PowerShell.
>> Jem: Good question, is there any reason why you'd use VIM over Nano if you're just editing text files? Personal preference, I'm sure we have all heard of that great nerdy debate of VIM versus Emacs.
[00:03:30] This is a longstanding debate just like tabs or spaces. Or two spaces or four spaces or yeah. No preference. I prefer VIM because VIM is baked into almost every single Unix distribution, so if you're on any sort of Unix server, there's gonna be VIM in there. Nano is on most of them as well.
[00:03:50] It's a different kind of text editor. But again, it's all kind of non GUI based text editor. There's also Emacs which is very powerful as well. Just as powerful as VIM but Emacs is generally not installed on a lot of distributions as well. But totally personal preference, but that's why we're learning VIM today because it's on most server.
[00:04:10] But again, If you wanna get good on server stuff and you wanna use Nano instead of VIM, totally your call, I'm not biased towards any of them. Cool, yes James, great answer. He said VIM is more widely available, and that's absolutely true.