Learn more about Vim in our dedicated tutorial: VIM and Python – A Match Made in Heaven
Overview & Use Cases
00:00 Welcome to the section about VIM. Here, we’re going to talk about the classic Unix text editor, VIM, which comes from Vi IMproved. That’s what VIM stands for, but I don’t really know what VI itself stands for, but whatever it was, VIM is one, but improved. Okay, ha.
I mentioned that it’s a text editor that’s built into the command line—in Unix systems, that is, so for macOS and Linux operating systems. And to open up a file in VIM, all I need to do is type in
vim and then I can give it a filename—for example,
Okay, so I have to have this window selected, and now when I press I, I switch to insert mode. You can see down here at the bottom, it tells me now I’m in
INSERT mode. And now I can type, and I’m actually typing something, so now it’s happening what I would expect it to happen from a normal text editor. If I press Escape, I switch back to the command mode, which you don’t really see any notice down here, but this means that when you’re typing now, nothing goes in there.
02:09 It’s two modes that you can switch between. Now, this whole thing already sounds pretty complicated, right? So, there’s this question, “Why would you want to use VIM in the first place?” And the quick answer for what are the good use cases is generally that VIM is just there. It’s built into your command line if you’re using a Unix system, and if you’re working with anything on a server, it’s very likely that you’re going to be using a Unix system, because most servers today are using some kind of Linux operating system.
02:38 That means that if you’re remotely SSH-ing into this server, VIM is going to be there for you. So anything that you know about using VIM is going to work there, while other text editors or IDEs, they’re just not going to be there.
02:53 So, the main reason for using VIM, is pretty much that it’s just ubiquitous. It’s there. And another advantage for using VIM is also that it’s very lightweight, so everything executes very quickly, and it kind of stays true to this understanding that, like, code is just text, right?
03:10 Text. It’s a text editor in its purest form, so to say. We’re just writing text here. Now, that makes it very lightweight and fast, but it also doesn’t give you a lot of functionality that some of the other text editors and IDEs that we’ll talk about later are providing for you. Okay, so I think that’s the quick overview of what is VIM, or VI.
vim and then the filename, or just
vim and then you have to decide for the filename later on. It opens up. And then, how to get out—which is one of the most Googled questions, supposedly, on Stack Overflow—is you press Escape to go into this command mode, and then you type colon (
:) to start a command, and
:q allows you to go out.
Then you type a colon (
:) that starts off, “I’m going to type a command now,” and you press
q for quit, and that closes the editor. Now, if you would have already typed something in there, there’s some overrides or you have to save it with a filename—we’ll talk about this a bit. But those are the very basics, and to review, VIM is a very basic, lightweight text editor that’s built into your command line on any Unix operating systems, which means it’s going to be very lightweight, and it’s going to be pretty much everywhere.
04:43 Those would be your reasons for wanting to use it, because if you know how to navigate with it, you can also work on a server with the same text editor that you’re already used to. Okay! So, in the next video, we’re going to create our little code snippet and run it and I’m going to show you how to do this using VIM. See you there!
Become a Member to join the conversation.