Vim is a keyboard-based text editor that can improve your productivity when writing code. Learn more in the Vim for VS Code course https://bit.ly/370N7Pr

Special Thanks to Joe Previte! https://twitter.com/jsjoeio

Vim history https://en.wikipedia.org/wiki/Vim_(text_editor)
Vim cheatsheet https://vim.rtorr.com/

#vim #dev #100SecondsOfCode


Install the quiz app 🤓

iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://play.google.com/store/apps/details?id=io.fireship.quizapp

Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment. 

My VS Code Theme

- Atom One Dark 
- vscode-icons
- Fira Code Font
2024-02-04T05:57:43.651Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
17640972-128f-48ea-88f1-f6151cc6a411
92cdbeb507b6cb0a9347c078399a081caaa24f8ed3451282dba37b32d23e38c2
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
Vim, a text editor for writing code where you navigate around the screen with a keyboard instead of a mouse.
It's based on the original Unix text editor VI, which came about in 19 76.
Then vi improved or Vim followed it in 1991 with a bunch of improvements.
But why in the age of modern c d e's would you ever wanna use a keyboard based text editor.
When you write code all day every day, your fingers should be glued to the keyboard at all times.
Every time you touch the mouse, your sivity declines.
Learning to code with Vim is like learning to play an instrument.
It'll be painful at first, but that pain will lead to more precise and productive code editing in the future.
Vim runs in the terminal, and it's installed on almost every machine.
And at some point, you'll likely find yourself accidentally dropped into Vim with no way to escape.
Let me out of here.
If you find yourself there, you can quit them by typing colon q.
That will close an unmodified file.
Or if it has been modified, You can use q bang to throw away your changes or colon w q to write the changes and then quit.
Now that we're out, let's use Vim to open up a file.
Currently, c.
We're in normal mode, but we can toggle between different modes like insert, visual, and command line depending on what we're trying to do.
We can move around the text with the arrow keys or the letters h j k l.
If we find a character we want to delete, we can hit x or double d to quickly delete an entire line.
If that was a mistake, hit u to undo Now, currently the document is kind of hard to read, so let's add line numbers by running colon set number and now we can navigate to any line with colon number.
Now, if we want to change some text, 6.
We need to go into insert mode by hitting I and that frees up the keyboard for us to type into the document.
Once we're done modifying our code.
We can hit the escape key to go back to normal mode, but now, like any good developer, we need to copy and paste some code in here from Stack Overflow.
We can paste from the system clipboard by entering plus p into them.
And now that our software is complete, we can hit colon w to save it, then run the program directly from them with colon bang followed by the shell command we want to run.
Congratulations.
You're no longer a sway dev, but a true software engineer.
This has been Vim in 100 seconds, but stay tuned because you don't need 2 ditch v s code to get the benefits of Vim.
That's why I invited a true expert and the instructor of the Vim for Versus Code course, Joe Prebitt, sit to take us beyond 100 seconds of Vim.
Hello, everyone.
I'm Joe, and I will be your guide as we go beyond 100 seconds To discuss why you should learn VIM and how you can leverage it inside your favorite editor, Versus Code.
First, let's talk about why you should learn VIM.
Vim is an evergreen skill, meaning you can learn it once and the knowledge will last with you for the rest of your career.
It allows you to work faster and more efficiently within your editor.
Here's a side by side comparison.
On the left, we have editing with Vim.
On the right, we have editing without Vim.
As you can see, VIM lets you do more from the keyboard, meaning you get to spend less time editing and more time coding.
Now let's talk about How to set up Vim with Versus Code.
Once you're inside Versus Code, head over to the extension panel and search Vim.
You should see the first extension called Vim.
And to make sure it's the right version, double check that it's vscodevim.vim, And it should have around 2,000,000 installations.
Go ahead and install this extension.
The next thing we're going to do is set up key repeat.
So head over to Google and look up vscode vim GitHub.
You should see the first link, which is a GitHub repository called vscode vim/vim.
There, you're gonna scroll down to the installation section.
In here, you'll see instructions for how to enable Key repeating.
This is a handy thing to add, especially when you're new to VIM because it'll allow you to hit the key And it will repeat as in if you were to hit j to move down.
Find your operating system.
I'm on Mac.
And then run this in your terminal.
And now for the changes to take effect, you're going to want to restart Versus Code.
To verify that it worked, go ahead and create a new file.
And now you should see that your cursor is a little bit wider.
Go ahead and hit I.
This will put us in insert mode and then hit return a bunch of times, then hit escape.
And now try hitting and holding k and see if your cursor moves up.
If it moves like this Pretty smooth.
Then you've enabled key repeating.
If it gets stuck, then you may want to try restarting Versus Code again We're revisiting the installation instructions.
Great.
Now that we have our editor set up, I'd like to teach you a few different commands in Vim.
So we'll review some of the ones that Jeff mentioned earlier in the video, and then we'll also learn a few new ones.
So inside Versus code, go ahead and create a new file And save it as hello dotmd.
Now what I want you to do is hit I to enter insert mode and hit returns.
We add a few lines for us to work with and then hit escape.
Great.
So the first commands that we're going to talk about are for navigation and they will be h j k and l.
So right now, we're in command mode.
So if we hit k, we'll start moving up.
If we hit j, we'll move down.
So remember, we just learned k for moving up.
I like to think of it as kicking a soccer ball up.
I'm kicking upwards on my editor and j for jumping down.
Use whatever mnemonic comes to mind to help you remember those.
The next, we'll talk about our h in l.
So I'm gonna write hello world here and you can do the same.
So again, the way that I did that was I for insert mode, start typing Hello, world.
And then when you're done, hit escape, and you'll be back in command mode.
So the first one we'll talk about is h.
So if you hit h, You'll start moving to the left, as in you're moving to the beginning of the line, also the h in hello world.
Now, once we're there, if we wanna go back right, we start hitting l, and that will move us towards the l in world.
So again, figure out a mnemonic that's going to help you remember those.
For me, I like to think of h as in I'm going home to the left And then l, you would think that would be l for left, but it's actually the opposite of that.
So l for right.
Great.
So now we're we're feeling comfortable with navigating in Vim.
Again, we're in command mode.
We're moving up and down with j and k and left and right with h and l.
The other thing to to remember is if you take a look, pause for a second, look at your keyboard, see where the keys are on your keyboard.
You should see the h to the left of j and k.
So that also helps me remember.
And then l So the other thing I wanna point out is you still have access to your mouse.
So you can click to move around.
So there's no need to worry about getting stuck in Vim.
I'm sure you've heard horror stories.
People not being able to exit them.
Luckily, using Vim inside of Versus Code, we're really just using the Vim key bindings.
So we don't have to worry.
We can close a file.
We can navigate.
Uh, no need to to fear being stuck in VIM.
Now the next thing I want to point out is some editing commands.
So we will talk about I, capital I, a and capital a for editing in a line.
So we're gonna go back to our hello world and you'll see right now the cursor is at the end of the line.
If I hit shift I or capital I, It'll move me in insert mode at the beginning so I could write a word like, I don't know, Joe.
And then if I hit escape, I'm back in command mode where I can move around.
So you'll notice the one thing that I wanna point out to a tip is a lot of Vim users remap their caps lock key to escape.
So instead of Caps lock being caps lock when I hit the key, it actually is escape.
And so it's a lot more accessible.
It's closer.
It's right next to my pinky Rather than having to reach to the corner of the keyboard and hit escape.
So that's one thing I'd encourage you to look into, uh, remapping your caps lock key to escape If you are serious about learning them.
So we just covered capital I.
We know that lowercase I is insert mode.
Right?
So now what I want to talk about is lowercase a.
The thing that you gotta pay attention to here is the cursor.
Right now, it's on top of the exclamation point.
So if it hit I, it'll move to the left.
And now if I go back, now if I hit a, it'll enter into insert mode but after the cursor.
So like this.
So again, uh, if we have like a number 2 here and we want to add to the beginning and make it 22 will hit I that'll let us enter at the beginning.
And now if we want to add to the end, like say I wanted to add period 22.
So 22/22, then I can use lowercase a.
So those are very handy when you're Inserting letters or making changes, uh, in a line.
Now, the next one that I want to talk about is capital a And so this is like appending to the end of the line.
So you'll enter insert mode at the end of a line.
So here I am.
Wanna add more exclamation points at the end of hello world.
So if I hit shift a, it will move the cursor to the end and it will enter into insert mode.
So now that I can Enter a few exclamation points.
Now if we go back to the beginning, we can do shift I.
Now we're insert mode at the beginning of the line.
So as as you can see the I capital I a capital a are very handy for editing in a line.
Great.
Uh, we've talked about navigation.
We've talked about editing and align.
Now, the last 2 that I want to talk about are x and r.
And these are handy for making changes while in command mode.
If we go back up right here and so I wanna get to the beginning of the sentence.
So I'm gonna hit shift I, hit escape because I wanna be in command mode.
So you'll see that I have 4 j's.
Right.
I don't really need all of those.
So what we're going to do is actually use x to delete those.
So x is kind of like x out of character.
So I'll hit it 3 times.
123.
And now, I have 1 j, which is correct.
So you can see, we're able to make edits without leaving command mode.
So we just talked about x for x ing out characters.
Now, let's talk about r for replacing characters.
So I'm going to go to the h here And I want this to be capital, so I'll hit r and then shift h, uh, which is just a a capital h, and now it will replace it.
And again, I haven't left command mode.
Here, let's see this for 22/22.
Let's change this to, uh, 52 22.
So we'll hit r and then 5.
And so, basically, what it does is it replaces the character under the cursor with the new character that you type in.
So we've talked about navigation with h j k l.
We've talked about editing in line with I, capital I, a, and capital a.
And now I've talked about making changes on command mode with x and r.
I hope you enjoyed that brief introduction to Vim inside Versus code.
If you'd like to learn more, head over to vim for v s code dot com and check out my course.
It's got 100 exercises to help you learn how How to use Vim inside Versus Code, and we teach you 22 different commands.
Use the coupon code Fireship for $5 off.
Thanks for watching, and I will see you in the next one.

Speaker 0: Vim, a text editor for writing code where you navigate around the screen with a keyboard instead of a mouse. It's based on the original Unix text editor VI, which came about in 19 76. Then vi improved or Vim followed it in 1991 with a bunch of improvements. But why in the age of modern c d e's would you ever wanna use a keyboard based text editor. When you write code all day every day, your fingers should be glued to the keyboard at all times.

Every time you touch the mouse, your sivity declines. Learning to code with Vim is like learning to play an instrument. It'll be painful at first, but that pain will lead to more precise and productive code editing in the future. Vim runs in the terminal, and it's installed on almost every machine. And at some point, you'll likely find yourself accidentally dropped into Vim with no way to escape.

Speaker 1: Let me out of here.

Speaker 0: If you find yourself there, you can quit them by typing colon q. That will close an unmodified file. Or if it has been modified, You can use q bang to throw away your changes or colon w q to write the changes and then quit. Now that we're out, let's use Vim to open up a file. Currently, c.

We're in normal mode, but we can toggle between different modes like insert, visual, and command line depending on what we're trying to do. We can move around the text with the arrow keys or the letters h j k l. If we find a character we want to delete, we can hit x or double d to quickly delete an entire line. If that was a mistake, hit u to undo Now, currently the document is kind of hard to read, so let's add line numbers by running colon set number and now we can navigate to any line with colon number. Now, if we want to change some text, 6.

We need to go into insert mode by hitting I and that frees up the keyboard for us to type into the document. Once we're done modifying our code. We can hit the escape key to go back to normal mode, but now, like any good developer, we need to copy and paste some code in here from Stack Overflow. We can paste from the system clipboard by entering plus p into them. And now that our software is complete, we can hit colon w to save it, then run the program directly from them with colon bang followed by the shell command we want to run.

Congratulations. You're no longer a sway dev, but a true software engineer. This has been Vim in 100 seconds, but stay tuned because you don't need 2 ditch v s code to get the benefits of Vim. That's why I invited a true expert and the instructor of the Vim for Versus Code course, Joe Prebitt, sit to take us beyond 100 seconds of Vim.

Speaker 1: Hello, everyone. I'm Joe, and I will be your guide as we go beyond 100 seconds To discuss why you should learn VIM and how you can leverage it inside your favorite editor, Versus Code. First, let's talk about why you should learn VIM. Vim is an evergreen skill, meaning you can learn it once and the knowledge will last with you for the rest of your career. It allows you to work faster and more efficiently within your editor.

Here's a side by side comparison. On the left, we have editing with Vim. On the right, we have editing without Vim. As you can see, VIM lets you do more from the keyboard, meaning you get to spend less time editing and more time coding. Now let's talk about How to set up Vim with Versus Code.

Once you're inside Versus Code, head over to the extension panel and search Vim. You should see the first extension called Vim. And to make sure it's the right version, double check that it's vscodevim.vim, And it should have around 2,000,000 installations. Go ahead and install this extension. The next thing we're going to do is set up key repeat.

So head over to Google and look up vscode vim GitHub. You should see the first link, which is a GitHub repository called vscode vim/vim. There, you're gonna scroll down to the installation section. In here, you'll see instructions for how to enable Key repeating. This is a handy thing to add, especially when you're new to VIM because it'll allow you to hit the key And it will repeat as in if you were to hit j to move down.

Find your operating system. I'm on Mac. And then run this in your terminal. And now for the changes to take effect, you're going to want to restart Versus Code. To verify that it worked, go ahead and create a new file.

And now you should see that your cursor is a little bit wider. Go ahead and hit I. This will put us in insert mode and then hit return a bunch of times, then hit escape. And now try hitting and holding k and see if your cursor moves up. If it moves like this Pretty smooth.

Then you've enabled key repeating. If it gets stuck, then you may want to try restarting Versus Code again We're revisiting the installation instructions. Great. Now that we have our editor set up, I'd like to teach you a few different commands in Vim. So we'll review some of the ones that Jeff mentioned earlier in the video, and then we'll also learn a few new ones.

So inside Versus code, go ahead and create a new file And save it as hello dotmd. Now what I want you to do is hit I to enter insert mode and hit returns. We add a few lines for us to work with and then hit escape. Great. So the first commands that we're going to talk about are for navigation and they will be h j k and l.

So right now, we're in command mode. So if we hit k, we'll start moving up. If we hit j, we'll move down. So remember, we just learned k for moving up. I like to think of it as kicking a soccer ball up.

I'm kicking upwards on my editor and j for jumping down. Use whatever mnemonic comes to mind to help you remember those. The next, we'll talk about our h in l. So I'm gonna write hello world here and you can do the same. So again, the way that I did that was I for insert mode, start typing Hello, world.

And then when you're done, hit escape, and you'll be back in command mode. So the first one we'll talk about is h. So if you hit h, You'll start moving to the left, as in you're moving to the beginning of the line, also the h in hello world. Now, once we're there, if we wanna go back right, we start hitting l, and that will move us towards the l in world. So again, figure out a mnemonic that's going to help you remember those.

For me, I like to think of h as in I'm going home to the left And then l, you would think that would be l for left, but it's actually the opposite of that. So l for right. Great. So now we're we're feeling comfortable with navigating in Vim. Again, we're in command mode.

We're moving up and down with j and k and left and right with h and l. The other thing to to remember is if you take a look, pause for a second, look at your keyboard, see where the keys are on your keyboard. You should see the h to the left of j and k. So that also helps me remember. And then l So the other thing I wanna point out is you still have access to your mouse.

So you can click to move around. So there's no need to worry about getting stuck in Vim. I'm sure you've heard horror stories. People not being able to exit them. Luckily, using Vim inside of Versus Code, we're really just using the Vim key bindings.

So we don't have to worry. We can close a file. We can navigate. Uh, no need to to fear being stuck in VIM. Now the next thing I want to point out is some editing commands.

So we will talk about I, capital I, a and capital a for editing in a line. So we're gonna go back to our hello world and you'll see right now the cursor is at the end of the line. If I hit shift I or capital I, It'll move me in insert mode at the beginning so I could write a word like, I don't know, Joe. And then if I hit escape, I'm back in command mode where I can move around. So you'll notice the one thing that I wanna point out to a tip is a lot of Vim users remap their caps lock key to escape.

So instead of Caps lock being caps lock when I hit the key, it actually is escape. And so it's a lot more accessible. It's closer. It's right next to my pinky Rather than having to reach to the corner of the keyboard and hit escape. So that's one thing I'd encourage you to look into, uh, remapping your caps lock key to escape If you are serious about learning them.

So we just covered capital I. We know that lowercase I is insert mode. Right? So now what I want to talk about is lowercase a. The thing that you gotta pay attention to here is the cursor.

Right now, it's on top of the exclamation point. So if it hit I, it'll move to the left. And now if I go back, now if I hit a, it'll enter into insert mode but after the cursor. So like this. So again, uh, if we have like a number 2 here and we want to add to the beginning and make it 22 will hit I that'll let us enter at the beginning.

And now if we want to add to the end, like say I wanted to add period 22. So 22/22, then I can use lowercase a. So those are very handy when you're Inserting letters or making changes, uh, in a line. Now, the next one that I want to talk about is capital a And so this is like appending to the end of the line. So you'll enter insert mode at the end of a line.

So here I am. Wanna add more exclamation points at the end of hello world. So if I hit shift a, it will move the cursor to the end and it will enter into insert mode. So now that I can Enter a few exclamation points. Now if we go back to the beginning, we can do shift I.

Now we're insert mode at the beginning of the line. So as as you can see the I capital I a capital a are very handy for editing in a line. Great. Uh, we've talked about navigation. We've talked about editing and align.

Now, the last 2 that I want to talk about are x and r. And these are handy for making changes while in command mode. If we go back up right here and so I wanna get to the beginning of the sentence. So I'm gonna hit shift I, hit escape because I wanna be in command mode. So you'll see that I have 4 j's.

Right. I don't really need all of those. So what we're going to do is actually use x to delete those. So x is kind of like x out of character. So I'll hit it 3 times.

123. And now, I have 1 j, which is correct. So you can see, we're able to make edits without leaving command mode. So we just talked about x for x ing out characters. Now, let's talk about r for replacing characters.

So I'm going to go to the h here And I want this to be capital, so I'll hit r and then shift h, uh, which is just a a capital h, and now it will replace it. And again, I haven't left command mode. Here, let's see this for 22/22. Let's change this to, uh, 52 22. So we'll hit r and then 5.

And so, basically, what it does is it replaces the character under the cursor with the new character that you type in. So we've talked about navigation with h j k l. We've talked about editing in line with I, capital I, a, and capital a. And now I've talked about making changes on command mode with x and r. I hope you enjoyed that brief introduction to Vim inside Versus code.

If you'd like to learn more, head over to vim for v s code dot com and check out my course. It's got 100 exercises to help you learn how How to use Vim inside Versus Code, and we teach you 22 different commands. Use the coupon code Fireship for $5 off.

Speaker 0: Thanks for watching, and I will see you in the next one.
Vim, a text editor for writing code where you navigate around the screen with a keyboard instead of a mouse. It's based on the original Unix text editor VI, which came about in 19 76. Then vi improved or Vim followed it in 1991 with a bunch of improvements. But why in the age of modern c d e's would you ever wanna use a keyboard based text editor. When you write code all day every day, your fingers should be glued to the keyboard at all times. Every time you touch the mouse, your sivity declines. Learning to code with Vim is like learning to play an instrument. It'll be painful at first, but that pain will lead to more precise and productive code editing in the future. Vim runs in the terminal, and it's installed on almost every machine. And at some point, you'll likely find yourself accidentally dropped into Vim with no way to escape. Let me out of here. If you find yourself there, you can quit them by typing colon q. That will close an unmodified file. Or if it has been modified, You can use q bang to throw away your changes or colon w q to write the changes and then quit. Now that we're out, let's use Vim to open up a file. Currently, c. We're in normal mode, but we can toggle between different modes like insert, visual, and command line depending on what we're trying to do. We can move around the text with the arrow keys or the letters h j k l. If we find a character we want to delete, we can hit x or double d to quickly delete an entire line. If that was a mistake, hit u to undo Now, currently the document is kind of hard to read, so let's add line numbers by running colon set number and now we can navigate to any line with colon number. Now, if we want to change some text, 6. We need to go into insert mode by hitting I and that frees up the keyboard for us to type into the document. Once we're done modifying our code. We can hit the escape key to go back to normal mode, but now, like any good developer, we need to copy and paste some code in here from Stack Overflow.
We can paste from the system clipboard by entering plus p into them. And now that our software is complete, we can hit colon w to save it, then run the program directly from them with colon bang followed by the shell command we want to run. Congratulations. You're no longer a sway dev, but a true software engineer.
software
software development
programming
This has been Vim in 100 seconds, but stay tuned because you don't need 2 ditch v s code to get the benefits of Vim. That's why I invited a true expert and the instructor of the Vim for Versus Code course, Joe Prebitt, sit to take us beyond 100 seconds of Vim.
Hello, everyone. I'm Joe, and I will be your guide as we go beyond 100 seconds To discuss why you should learn VIM and how you can leverage it inside your favorite editor, Versus Code. First, let's talk about why you should learn VIM. Vim is an evergreen skill, meaning you can learn it once and the knowledge will last with you for the rest of your career.
deep learning
It allows you to work faster and more efficiently within your editor. Here's a side by side comparison. On the left, we have editing with Vim. On the right, we have editing without Vim. As you can see, VIM lets you do more from the keyboard, meaning you get to spend less time editing and more time coding. Now let's talk about How to set up Vim with Versus Code. Once you're inside Versus Code, head over to the extension panel and search Vim. You should see the first extension called Vim. And to make sure it's the right version, double check that it's vscodevim.vim, And it should have around 2,000,000 installations. Go ahead and install this extension. The next thing we're going to do is set up key repeat. So head over to Google and look up vscode vim GitHub. You should see the first link, which is a GitHub repository called vscode vim/vim. There, you're gonna scroll down to the installation section. In here, you'll see instructions for how to enable Key repeating. This is a handy thing to add, especially when you're new to VIM because it'll allow you to hit the key And it will repeat as in if you were to hit j to move down. Find your operating system. I'm on Mac. And then run this in your terminal. And now for the changes to take effect, you're going to want to restart Versus Code. To verify that it worked, go ahead and create a new file. And now you should see that your cursor is a little bit wider. Go ahead and hit I. This will put us in insert mode and then hit return a bunch of times, then hit escape. And now try hitting and holding k and see if your cursor moves up. If it moves like this Pretty smooth. Then you've enabled key repeating. If it gets stuck, then you may want to try restarting Versus Code again We're revisiting the installation instructions. Great. Now that we have our editor set up, I'd like to teach you a few different commands in Vim. So we'll review some of the ones that Jeff mentioned earlier in the video, and then we'll also learn a few new ones.
So inside Versus code, go ahead and create a new file And save it as hello dotmd. Now what I want you to do is hit I to enter insert mode and hit returns. We add a few lines for us to work with and then hit escape. Great. So the first commands that we're going to talk about are for navigation and they will be h j k and l.
programming
So right now, we're in command mode. So if we hit k, we'll start moving up. If we hit j, we'll move down. So remember, we just learned k for moving up. I like to think of it as kicking a soccer ball up. I'm kicking upwards on my editor and j for jumping down. Use whatever mnemonic comes to mind to help you remember those. The next, we'll talk about our h in l. So I'm gonna write hello world here and you can do the same. So again, the way that I did that was I for insert mode, start typing Hello, world. And then when you're done, hit escape, and you'll be back in command mode. So the first one we'll talk about is h. So if you hit h, You'll start moving to the left, as in you're moving to the beginning of the line, also the h in hello world. Now, once we're there, if we wanna go back right, we start hitting l, and that will move us towards the l in world. So again, figure out a mnemonic that's going to help you remember those. For me, I like to think of h as in I'm going home to the left And then l, you would think that would be l for left, but it's actually the opposite of that. So l for right. Great. So now we're we're feeling comfortable with navigating in Vim. Again, we're in command mode. We're moving up and down with j and k and left and right with h and l. The other thing to to remember is if you take a look, pause for a second, look at your keyboard, see where the keys are on your keyboard. You should see the h to the left of j and k. So that also helps me remember. And then l So the other thing I wanna point out is you still have access to your mouse. So you can click to move around. So there's no need to worry about getting stuck in Vim. I'm sure you've heard horror stories. People not being able to exit them. Luckily, using Vim inside of Versus Code, we're really just using the Vim key bindings. So we don't have to worry. We can close a file. We can navigate. Uh, no need to to fear being stuck in VIM. Now the next thing I want to point out is some editing commands.
So we will talk about I, capital I, a and capital a for editing in a line. So we're gonna go back to our hello world and you'll see right now the cursor is at the end of the line. If I hit shift I or capital I, It'll move me in insert mode at the beginning so I could write a word like, I don't know, Joe.
writing
And then if I hit escape, I'm back in command mode where I can move around. So you'll notice the one thing that I wanna point out to a tip is a lot of Vim users remap their caps lock key to escape. So instead of Caps lock being caps lock when I hit the key, it actually is escape. And so it's a lot more accessible. It's closer. It's right next to my pinky Rather than having to reach to the corner of the keyboard and hit escape. So that's one thing I'd encourage you to look into, uh, remapping your caps lock key to escape If you are serious about learning them. So we just covered capital I. We know that lowercase I is insert mode. Right? So now what I want to talk about is lowercase a. The thing that you gotta pay attention to here is the cursor. Right now, it's on top of the exclamation point. So if it hit I, it'll move to the left. And now if I go back, now if I hit a, it'll enter into insert mode but after the cursor. So like this. So again, uh, if we have like a number 2 here and we want to add to the beginning and make it 22 will hit I that'll let us enter at the beginning. And now if we want to add to the end, like say I wanted to add period 22. So 22/22, then I can use lowercase a. So those are very handy when you're Inserting letters or making changes, uh, in a line. Now, the next one that I want to talk about is capital a And so this is like appending to the end of the line. So you'll enter insert mode at the end of a line. So here I am. Wanna add more exclamation points at the end of hello world. So if I hit shift a, it will move the cursor to the end and it will enter into insert mode. So now that I can Enter a few exclamation points. Now if we go back to the beginning, we can do shift I. Now we're insert mode at the beginning of the line. So as as you can see the I capital I a capital a are very handy for editing in a line. Great. Uh, we've talked about navigation. We've talked about editing and align. Now, the last 2 that I want to talk about are x and r. And these are handy for making changes while in command mode. If we go back up right here and so I wanna get to the beginning of the sentence. So I'm gonna hit shift I, hit escape because I wanna be in command mode. So you'll see that I have 4 j's. Right. I don't really need all of those. So what we're going to do is actually use x to delete those. So x is kind of like x out of character. So I'll hit it 3 times. 123. And now, I have 1 j, which is correct. So you can see, we're able to make edits without leaving command mode. So we just talked about x for x ing out characters. Now, let's talk about r for replacing characters. So I'm going to go to the h here And I want this to be capital, so I'll hit r and then shift h, uh, which is just a a capital h, and now it will replace it. And again, I haven't left command mode. Here, let's see this for 22/22. Let's change this to, uh, 52 22. So we'll hit r and then 5. And so, basically, what it does is it replaces the character under the cursor with the new character that you type in. So we've talked about navigation with h j k l. We've talked about editing in line with I, capital I, a, and capital a. And now I've talked about making changes on command mode with x and r. I hope you enjoyed that brief introduction to Vim inside Versus code. If you'd like to learn more, head over to vim for v s code dot com and check out my course. It's got 100 exercises to help you learn how How to use Vim inside Versus Code, and we teach you 22 different commands. Use the coupon code Fireship for $5 off. Thanks for watching, and I will see you in the next one.
Vim, a text editor for writing code where you navigate around the screen with a keyboard instead of a mouse. It's based on the original Unix text editor VI, which came about in 19 76. Then vi improved or Vim followed it in 1991 with a bunch of improvements. But why in the age of modern c d e's would you ever wanna use a keyboard based text editor. When you write code all day every day, your fingers should be glued to the keyboard at all times. Every time you touch the mouse, your sivity declines. Learning to code with Vim is like learning to play an instrument. It'll be painful at first, but that pain will lead to more precise and productive code editing in the future. Vim runs in the terminal, and it's installed on almost every machine. And at some point, you'll likely find yourself accidentally dropped into Vim with no way to escape. Let me out of here. If you find yourself there, you can quit them by typing colon q. That will close an unmodified file. Or if it has been modified, You can use q bang to throw away your changes or colon w q to write the changes and then quit. Now that we're out, let's use Vim to open up a file. Currently, c. We're in normal mode, but we can toggle between different modes like insert, visual, and command line depending on what we're trying to do. We can move around the text with the arrow keys or the letters h j k l. If we find a character we want to delete, we can hit x or double d to quickly delete an entire line. If that was a mistake, hit u to undo Now, currently the document is kind of hard to read, so let's add line numbers by running colon set number and now we can navigate to any line with colon number. Now, if we want to change some text, 6. We need to go into insert mode by hitting I and that frees up the keyboard for us to type into the document. Once we're done modifying our code. We can hit the escape key to go back to normal mode, but now, like any good developer, we need to copy and paste some code in here from Stack Overflow. We can paste from the system clipboard by entering plus p into them. And now that our software is complete, we can hit colon w to save it, then run the program directly from them with colon bang followed by the shell command we want to run. Congratulations. You're no longer a sway dev, but a true software engineer. This has been Vim in 100 seconds, but stay tuned because you don't need 2 ditch v s code to get the benefits of Vim. That's why I invited a true expert and the instructor of the Vim for Versus Code course, Joe Prebitt, sit to take us beyond 100 seconds of Vim. Hello, everyone. I'm Joe, and I will be your guide as we go beyond 100 seconds To discuss why you should learn VIM and how you can leverage it inside your favorite editor, Versus Code. First, let's talk about why you should learn VIM. Vim is an evergreen skill, meaning you can learn it once and the knowledge will last with you for the rest of your career. It allows you to work faster and more efficiently within your editor. Here's a side by side comparison. On the left, we have editing with Vim. On the right, we have editing without Vim. As you can see, VIM lets you do more from the keyboard, meaning you get to spend less time editing and more time coding. Now let's talk about How to set up Vim with Versus Code. Once you're inside Versus Code, head over to the extension panel and search Vim. You should see the first extension called Vim. And to make sure it's the right version, double check that it's vscodevim.vim, And it should have around 2,000,000 installations. Go ahead and install this extension. The next thing we're going to do is set up key repeat. So head over to Google and look up vscode vim GitHub. You should see the first link, which is a GitHub repository called vscode vim/vim. There, you're gonna scroll down to the installation section. In here, you'll see instructions for how to enable Key repeating. This is a handy thing to add, especially when you're new to VIM because it'll allow you to hit the key And it will repeat as in if you were to hit j to move down. Find your operating system. I'm on Mac. And then run this in your terminal. And now for the changes to take effect, you're going to want to restart Versus Code. To verify that it worked, go ahead and create a new file. And now you should see that your cursor is a little bit wider. Go ahead and hit I. This will put us in insert mode and then hit return a bunch of times, then hit escape. And now try hitting and holding k and see if your cursor moves up. If it moves like this Pretty smooth. Then you've enabled key repeating. If it gets stuck, then you may want to try restarting Versus Code again We're revisiting the installation instructions. Great. Now that we have our editor set up, I'd like to teach you a few different commands in Vim. So we'll review some of the ones that Jeff mentioned earlier in the video, and then we'll also learn a few new ones. So inside Versus code, go ahead and create a new file And save it as hello dotmd. Now what I want you to do is hit I to enter insert mode and hit returns. We add a few lines for us to work with and then hit escape. Great. So the first commands that we're going to talk about are for navigation and they will be h j k and l. So right now, we're in command mode. So if we hit k, we'll start moving up. If we hit j, we'll move down. So remember, we just learned k for moving up. I like to think of it as kicking a soccer ball up. I'm kicking upwards on my editor and j for jumping down. Use whatever mnemonic comes to mind to help you remember those. The next, we'll talk about our h in l. So I'm gonna write hello world here and you can do the same. So again, the way that I did that was I for insert mode, start typing Hello, world. And then when you're done, hit escape, and you'll be back in command mode. So the first one we'll talk about is h. So if you hit h, You'll start moving to the left, as in you're moving to the beginning of the line, also the h in hello world. Now, once we're there, if we wanna go back right, we start hitting l, and that will move us towards the l in world. So again, figure out a mnemonic that's going to help you remember those. For me, I like to think of h as in I'm going home to the left And then l, you would think that would be l for left, but it's actually the opposite of that. So l for right. Great. So now we're we're feeling comfortable with navigating in Vim. Again, we're in command mode. We're moving up and down with j and k and left and right with h and l. The other thing to to remember is if you take a look, pause for a second, look at your keyboard, see where the keys are on your keyboard. You should see the h to the left of j and k. So that also helps me remember. And then l So the other thing I wanna point out is you still have access to your mouse. So you can click to move around. So there's no need to worry about getting stuck in Vim. I'm sure you've heard horror stories. People not being able to exit them. Luckily, using Vim inside of Versus Code, we're really just using the Vim key bindings. So we don't have to worry. We can close a file. We can navigate. Uh, no need to to fear being stuck in VIM. Now the next thing I want to point out is some editing commands. So we will talk about I, capital I, a and capital a for editing in a line. So we're gonna go back to our hello world and you'll see right now the cursor is at the end of the line. If I hit shift I or capital I, It'll move me in insert mode at the beginning so I could write a word like, I don't know, Joe. And then if I hit escape, I'm back in command mode where I can move around. So you'll notice the one thing that I wanna point out to a tip is a lot of Vim users remap their caps lock key to escape. So instead of Caps lock being caps lock when I hit the key, it actually is escape. And so it's a lot more accessible. It's closer. It's right next to my pinky Rather than having to reach to the corner of the keyboard and hit escape. So that's one thing I'd encourage you to look into, uh, remapping your caps lock key to escape If you are serious about learning them. So we just covered capital I. We know that lowercase I is insert mode. Right? So now what I want to talk about is lowercase a. The thing that you gotta pay attention to here is the cursor. Right now, it's on top of the exclamation point. So if it hit I, it'll move to the left. And now if I go back, now if I hit a, it'll enter into insert mode but after the cursor. So like this. So again, uh, if we have like a number 2 here and we want to add to the beginning and make it 22 will hit I that'll let us enter at the beginning. And now if we want to add to the end, like say I wanted to add period 22. So 22/22, then I can use lowercase a. So those are very handy when you're Inserting letters or making changes, uh, in a line. Now, the next one that I want to talk about is capital a And so this is like appending to the end of the line. So you'll enter insert mode at the end of a line. So here I am. Wanna add more exclamation points at the end of hello world. So if I hit shift a, it will move the cursor to the end and it will enter into insert mode. So now that I can Enter a few exclamation points. Now if we go back to the beginning, we can do shift I. Now we're insert mode at the beginning of the line. So as as you can see the I capital I a capital a are very handy for editing in a line. Great. Uh, we've talked about navigation. We've talked about editing and align. Now, the last 2 that I want to talk about are x and r. And these are handy for making changes while in command mode. If we go back up right here and so I wanna get to the beginning of the sentence. So I'm gonna hit shift I, hit escape because I wanna be in command mode. So you'll see that I have 4 j's. Right. I don't really need all of those. So what we're going to do is actually use x to delete those. So x is kind of like x out of character. So I'll hit it 3 times. 123. And now, I have 1 j, which is correct. So you can see, we're able to make edits without leaving command mode. So we just talked about x for x ing out characters. Now, let's talk about r for replacing characters. So I'm going to go to the h here And I want this to be capital, so I'll hit r and then shift h, uh, which is just a a capital h, and now it will replace it. And again, I haven't left command mode. Here, let's see this for 22/22. Let's change this to, uh, 52 22. So we'll hit r and then 5. And so, basically, what it does is it replaces the character under the cursor with the new character that you type in. So we've talked about navigation with h j k l. We've talked about editing in line with I, capital I, a, and capital a. And now I've talked about making changes on command mode with x and r. I hope you enjoyed that brief introduction to Vim inside Versus code. If you'd like to learn more, head over to vim for v s code dot com and check out my course. It's got 100 exercises to help you learn how How to use Vim inside Versus Code, and we teach you 22 different commands. Use the coupon code Fireship for $5 off. Thanks for watching, and I will see you in the next one.
Vim,
vim
a
a
text
text
editor
editor
for
for
writing
writing
code
code
where
where
you
you
navigate
navigate
around
around
the
the
screen
screen
with
with
a
a
keyboard
keyboard
instead
instead
of
of
a
a
mouse.
mouse
It's
it's
based
based
on
on
the
the
original
original
Unix
unix
text
text
editor
editor
VI,
vi
which
which
came
came
about
about
in
in
19
19
76.
76
Then
then
vi
vi
improved
improved
or
or
Vim
vim
followed
followed
it
it
in
in
1991
1991
with
with
a
a
bunch
bunch
of
of
improvements.
improvements
But
but
why
why
in
in
the
the
age
age
of
of
modern
modern
c
c
d
d
e's
e's
would
would
you
you
ever
ever
wanna
wanna
use
use
a
a
keyboard
keyboard
based
based
text
text
editor.
editor
When
when
you
you
write
write
code
code
all
all
day
day
every
every
day,
day
your
your
fingers
fingers
should
should
be
be
glued
glued
to
to
the
the
keyboard
keyboard
at
at
all
all
times.
times
Every
every
time
time
you
you
touch
touch
the
the
mouse,
mouse
your
your
sivity
sivity
declines.
declines
Learning
learning
to
to
code
code
with
with
Vim
vim
is
is
like
like
learning
learning
to
to
play
play
an
an
instrument.
instrument
It'll
it'll
be
be
painful
painful
at
at
first,
first
but
but
that
that
pain
pain
will
will
lead
lead
to
to
more
more
precise
precise
and
and
productive
productive
code
code
editing
editing
in
in
the
the
future.
future
Vim
vim
runs
runs
in
in
the
the
terminal,
terminal
and
and
it's
it's
installed
installed
on
on
almost
almost
every
every
machine.
machine
And
and
at
at
some
some
point,
point
you'll
you'll
likely
likely
find
find
yourself
yourself
accidentally
accidentally
dropped
dropped
into
into
Vim
vim
with
with
no
no
way
way
to
to
escape.
escape
Let
let
me
me
out
out
of
of
here.
here
If
if
you
you
find
find
yourself
yourself
there,
there
you
you
can
can
quit
quit
them
them
by
by
typing
typing
colon
colon
q.
q
That
that
will
will
close
close
an
an
unmodified
unmodified
file.
file
Or
or
if
if
it
it
has
has
been
been
modified,
modified
You
you
can
can
use
use
q
q
bang
bang
to
to
throw
throw
away
away
your
your
changes
changes
or
or
colon
colon
w
w
q
q
to
to
write
write
the
the
changes
changes
and
and
then
then
quit.
quit
Now
now
that
that
we're
we're
out,
out
let's
let's
use
use
Vim
vim
to
to
open
open
up
up
a
a
file.
file
Currently,
currently
c.
c
We're
we're
in
in
normal
normal
mode,
mode
but
but
we
we
can
can
toggle
toggle
between
between
different
different
modes
modes
like
like
insert,
insert
visual,
visual
and
and
command
command
line
line
depending
depending
on
on
what
what
we're
we're
trying
trying
to
to
do.
do
We
we
can
can
move
move
around
around
the
the
text
text
with
with
the
the
arrow
arrow
keys
keys
or
or
the
the
letters
letters
h
h
j
j
k
k
l.
l
If
if
we
we
find
find
a
a
character
character
we
we
want
want
to
to
delete,
delete
we
we
can
can
hit
hit
x
x
or
or
double
double
d
d
to
to
quickly
quickly
delete
delete
an
an
entire
entire
line.
line
If
if
that
that
was
was
a
a
mistake,
mistake
hit
hit
u
u
to
to
undo
undo
Now,
now
currently
currently
the
the
document
document
is
is
kind
kind
of
of
hard
hard
to
to
read,
read
so
so
let's
let's
add
add
line
line
numbers
numbers
by
by
running
running
colon
colon
set
set
number
number
and
and
now
now
we
we
can
can
navigate
navigate
to
to
any
any
line
line
with
with
colon
colon
number.
number
Now,
now
if
if
we
we
want
want
to
to
change
change
some
some
text,
text
6.
6
We
we
need
need
to
to
go
go
into
into
insert
insert
mode
mode
by
by
hitting
hitting
I
i
and
and
that
that
frees
frees
up
up
the
the
keyboard
keyboard
for
for
us
us
to
to
type
type
into
into
the
the
document.
document
Once
once
we're
we're
done
done
modifying
modifying
our
our
code.
code
We
we
can
can
hit
hit
the
the
escape
escape
key
key
to
to
go
go
back
back
to
to
normal
normal
mode,
mode
but
but
now,
now
like
like
any
any
good
good
developer,
developer
we
we
need
need
to
to
copy
copy
and
and
paste
paste
some
some
code
code
in
in
here
here
from
from
Stack
stack
Overflow.
overflow
We
we
can
can
paste
paste
from
from
the
the
system
system
clipboard
clipboard
by
by
entering
entering
plus
plus
p
p
into
into
them.
them
And
and
now
now
that
that
our
our
software
software
is
is
complete,
complete
we
we
can
can
hit
hit
colon
colon
w
w
to
to
save
save
it,
it
then
then
run
run
the
the
program
program
directly
directly
from
from
them
them
with
with
colon
colon
bang
bang
followed
followed
by
by
the
the
shell
shell
command
command
we
we
want
want
to
to
run.
run
Congratulations.
congratulations
You're
you're
no
no
longer
longer
a
a
sway
sway
dev,
dev
but
but
a
a
true
true
software
software
engineer.
engineer
This
this
has
has
been
been
Vim
vim
in
in
100
100
seconds,
seconds
but
but
stay
stay
tuned
tuned
because
because
you
you
don't
don't
need
need
2
2
ditch
ditch
v
v
s
s
code
code
to
to
get
get
the
the
benefits
benefits
of
of
Vim.
vim
That's
that's
why
why
I
i
invited
invited
a
a
true
true
expert
expert
and
and
the
the
instructor
instructor
of
of
the
the
Vim
vim
for
for
Versus
versus
Code
code
course,
course
Joe
joe
Prebitt,
prebitt
sit
sit
to
to
take
take
us
us
beyond
beyond
100
100
seconds
seconds
of
of
Vim.
vim
Hello,
hello
everyone.
everyone
I'm
i'm
Joe,
joe
and
and
I
i
will
will
be
be
your
your
guide
guide
as
as
we
we
go
go
beyond
beyond
100
100
seconds
seconds
To
to
discuss
discuss
why
why
you
you
should
should
learn
learn
VIM
vim
and
and
how
how
you
you
can
can
leverage
leverage
it
it
inside
inside
your
your
favorite
favorite
editor,
editor
Versus
versus
Code.
code
First,
first
let's
let's
talk
talk
about
about
why
why
you
you
should
should
learn
learn
VIM.
vim
Vim
vim
is
is
an
an
evergreen
evergreen
skill,
skill
meaning
meaning
you
you
can
can
learn
learn
it
it
once
once
and
and
the
the
knowledge
knowledge
will
will
last
last
with
with
you
you
for
for
the
the
rest
rest
of
of
your
your
career.
career
It
it
allows
allows
you
you
to
to
work
work
faster
faster
and
and
more
more
efficiently
efficiently
within
within
your
your
editor.
editor
Here's
here's
a
a
side
side
by
by
side
side
comparison.
comparison
On
on
the
the
left,
left
we
we
have
have
editing
editing
with
with
Vim.
vim
On
on
the
the
right,
right
we
we
have
have
editing
editing
without
without
Vim.
vim
As
as
you
you
can
can
see,
see
VIM
vim
lets
lets
you
you
do
do
more
more
from
from
the
the
keyboard,
keyboard
meaning
meaning
you
you
get
get
to
to
spend
spend
less
less
time
time
editing
editing
and
and
more
more
time
time
coding.
coding
Now
now
let's
let's
talk
talk
about
about
How
how
to
to
set
set
up
up
Vim
vim
with
with
Versus
versus
Code.
code
Once
once
you're
you're
inside
inside
Versus
versus
Code,
code
head
head
over
over
to
to
the
the
extension
extension
panel
panel
and
and
search
search
Vim.
vim
You
you
should
should
see
see
the
the
first
first
extension
extension
called
called
Vim.
vim
And
and
to
to
make
make
sure
sure
it's
it's
the
the
right
right
version,
version
double
double
check
check
that
that
it's
it's
vscodevim.vim,
vscodevim.vim
And
and
it
it
should
should
have
have
around
around
2,000,000
2,000,000
installations.
installations
Go
go
ahead
ahead
and
and
install
install
this
this
extension.
extension
The
the
next
next
thing
thing
we're
we're
going
going
to
to
do
do
is
is
set
set
up
up
key
key
repeat.
repeat
So
so
head
head
over
over
to
to
Google
google
and
and
look
look
up
up
vscode
vscode
vim
vim
GitHub.
github
You
you
should
should
see
see
the
the
first
first
link,
link
which
which
is
is
a
a
GitHub
github
repository
repository
called
called
vscode
vscode
vim/vim.
vim/vim
There,
there
you're
you're
gonna
gonna
scroll
scroll
down
down
to
to
the
the
installation
installation
section.
section
In
in
here,
here
you'll
you'll
see
see
instructions
instructions
for
for
how
how
to
to
enable
enable
Key
key
repeating.
repeating
This
this
is
is
a
a
handy
handy
thing
thing
to
to
add,
add
especially
especially
when
when
you're
you're
new
new
to
to
VIM
vim
because
because
it'll
it'll
allow
allow
you
you
to
to
hit
hit
the
the
key
key
And
and
it
it
will
will
repeat
repeat
as
as
in
in
if
if
you
you
were
were
to
to
hit
hit
j
j
to
to
move
move
down.
down
Find
find
your
your
operating
operating
system.
system
I'm
i'm
on
on
Mac.
mac
And
and
then
then
run
run
this
this
in
in
your
your
terminal.
terminal
And
and
now
now
for
for
the
the
changes
changes
to
to
take
take
effect,
effect
you're
you're
going
going
to
to
want
want
to
to
restart
restart
Versus
versus
Code.
code
To
to
verify
verify
that
that
it
it
worked,
worked
go
go
ahead
ahead
and
and
create
create
a
a
new
new
file.
file
And
and
now
now
you
you
should
should
see
see
that
that
your
your
cursor
cursor
is
is
a
a
little
little
bit
bit
wider.
wider
Go
go
ahead
ahead
and
and
hit
hit
I.
i
This
this
will
will
put
put
us
us
in
in
insert
insert
mode
mode
and
and
then
then
hit
hit
return
return
a
a
bunch
bunch
of
of
times,
times
then
then
hit
hit
escape.
escape
And
and
now
now
try
try
hitting
hitting
and
and
holding
holding
k
k
and
and
see
see
if
if
your
your
cursor
cursor
moves
moves
up.
up
If
if
it
it
moves
moves
like
like
this
this
Pretty
pretty
smooth.
smooth
Then
then
you've
you've
enabled
enabled
key
key
repeating.
repeating
If
if
it
it
gets
gets
stuck,
stuck
then
then
you
you
may
may
want
want
to
to
try
try
restarting
restarting
Versus
versus
Code
code
again
again
We're
we're
revisiting
revisiting
the
the
installation
installation
instructions.
instructions
Great.
great
Now
now
that
that
we
we
have
have
our
our
editor
editor
set
set
up,
up
I'd
i'd
like
like
to
to
teach
teach
you
you
a
a
few
few
different
different
commands
commands
in
in
Vim.
vim
So
so
we'll
we'll
review
review
some
some
of
of
the
the
ones
ones
that
that
Jeff
jeff
mentioned
mentioned
earlier
earlier
in
in
the
the
video,
video
and
and
then
then
we'll
we'll
also
also
learn
learn
a
a
few
few
new
new
ones.
ones
So
so
inside
inside
Versus
versus
code,
code
go
go
ahead
ahead
and
and
create
create
a
a
new
new
file
file
And
and
save
save
it
it
as
as
hello
hello
dotmd.
dotmd
Now
now
what
what
I
i
want
want
you
you
to
to
do
do
is
is
hit
hit
I
i
to
to
enter
enter
insert
insert
mode
mode
and
and
hit
hit
returns.
returns
We
we
add
add
a
a
few
few
lines
lines
for
for
us
us
to
to
work
work
with
with
and
and
then
then
hit
hit
escape.
escape
Great.
great
So
so
the
the
first
first
commands
commands
that
that
we're
we're
going
going
to
to
talk
talk
about
about
are
are
for
for
navigation
navigation
and
and
they
they
will
will
be
be
h
h
j
j
k
k
and
and
l.
l
So
so
right
right
now,
now
we're
we're
in
in
command
command
mode.
mode
So
so
if
if
we
we
hit
hit
k,
k
we'll
we'll
start
start
moving
moving
up.
up
If
if
we
we
hit
hit
j,
j
we'll
we'll
move
move
down.
down
So
so
remember,
remember
we
we
just
just
learned
learned
k
k
for
for
moving
moving
up.
up
I
i
like
like
to
to
think
think
of
of
it
it
as
as
kicking
kicking
a
a
soccer
soccer
ball
ball
up.
up
I'm
i'm
kicking
kicking
upwards
upwards
on
on
my
my
editor
editor
and
and
j
j
for
for
jumping
jumping
down.
down
Use
use
whatever
whatever
mnemonic
mnemonic
comes
comes
to
to
mind
mind
to
to
help
help
you
you
remember
remember
those.
those
The
the
next,
next
we'll
we'll
talk
talk
about
about
our
our
h
h
in
in
l.
l
So
so
I'm
i'm
gonna
gonna
write
write
hello
hello
world
world
here
here
and
and
you
you
can
can
do
do
the
the
same.
same
So
so
again,
again
the
the
way
way
that
that
I
i
did
did
that
that
was
was
I
i
for
for
insert
insert
mode,
mode
start
start
typing
typing
Hello,
hello
world.
world
And
and
then
then
when
when
you're
you're
done,
done
hit
hit
escape,
escape
and
and
you'll
you'll
be
be
back
back
in
in
command
command
mode.
mode
So
so
the
the
first
first
one
one
we'll
we'll
talk
talk
about
about
is
is
h.
h
So
so
if
if
you
you
hit
hit
h,
h
You'll
you'll
start
start
moving
moving
to
to
the
the
left,
left
as
as
in
in
you're
you're
moving
moving
to
to
the
the
beginning
beginning
of
of
the
the
line,
line
also
also
the
the
h
h
in
in
hello
hello
world.
world
Now,
now
once
once
we're
we're
there,
there
if
if
we
we
wanna
wanna
go
go
back
back
right,
right
we
we
start
start
hitting
hitting
l,
l
and
and
that
that
will
will
move
move
us
us
towards
towards
the
the
l
l
in
in
world.
world
So
so
again,
again
figure
figure
out
out
a
a
mnemonic
mnemonic
that's
that's
going
going
to
to
help
help
you
you
remember
remember
those.
those
For
for
me,
me
I
i
like
like
to
to
think
think
of
of
h
h
as
as
in
in
I'm
i'm
going
going
home
home
to
to
the
the
left
left
And
and
then
then
l,
l
you
you
would
would
think
think
that
that
would
would
be
be
l
l
for
for
left,
left
but
but
it's
it's
actually
actually
the
the
opposite
opposite
of
of
that.
that
So
so
l
l
for
for
right.
right
Great.
great
So
so
now
now
we're
we're
we're
we're
feeling
feeling
comfortable
comfortable
with
with
navigating
navigating
in
in
Vim.
vim
Again,
again
we're
we're
in
in
command
command
mode.
mode
We're
we're
moving
moving
up
up
and
and
down
down
with
with
j
j
and
and
k
k
and
and
left
left
and
and
right
right
with
with
h
h
and
and
l.
l
The
the
other
other
thing
thing
to
to
to
to
remember
remember
is
is
if
if
you
you
take
take
a
a
look,
look
pause
pause
for
for
a
a
second,
second
look
look
at
at
your
your
keyboard,
keyboard
see
see
where
where
the
the
keys
keys
are
are
on
on
your
your
keyboard.
keyboard
You
you
should
should
see
see
the
the
h
h
to
to
the
the
left
left
of
of
j
j
and
and
k.
k
So
so
that
that
also
also
helps
helps
me
me
remember.
remember
And
and
then
then
l
l
So
so
the
the
other
other
thing
thing
I
i
wanna
wanna
point
point
out
out
is
is
you
you
still
still
have
have
access
access
to
to
your
your
mouse.
mouse
So
so
you
you
can
can
click
click
to
to
move
move
around.
around
So
so
there's
there's
no
no
need
need
to
to
worry
worry
about
about
getting
getting
stuck
stuck
in
in
Vim.
vim
I'm
i'm
sure
sure
you've
you've
heard
heard
horror
horror
stories.
stories
People
people
not
not
being
being
able
able
to
to
exit
exit
them.
them
Luckily,
luckily
using
using
Vim
vim
inside
inside
of
of
Versus
versus
Code,
code
we're
we're
really
really
just
just
using
using
the
the
Vim
vim
key
key
bindings.
bindings
So
so
we
we
don't
don't
have
have
to
to
worry.
worry
We
we
can
can
close
close
a
a
file.
file
We
we
can
can
navigate.
navigate
Uh,
uh
no
no
need
need
to
to
to
to
fear
fear
being
being
stuck
stuck
in
in
VIM.
vim
Now
now
the
the
next
next
thing
thing
I
i
want
want
to
to
point
point
out
out
is
is
some
some
editing
editing
commands.
commands
So
so
we
we
will
will
talk
talk
about
about
I,
i
capital
capital
I,
i
a
a
and
and
capital
capital
a
a
for
for
editing
editing
in
in
a
a
line.
line
So
so
we're
we're
gonna
gonna
go
go
back
back
to
to
our
our
hello
hello
world
world
and
and
you'll
you'll
see
see
right
right
now
now
the
the
cursor
cursor
is
is
at
at
the
the
end
end
of
of
the
the
line.
line
If
if
I
i
hit
hit
shift
shift
I
i
or
or
capital
capital
I,
i
It'll
it'll
move
move
me
me
in
in
insert
insert
mode
mode
at
at
the
the
beginning
beginning
so
so
I
i
could
could
write
write
a
a
word
word
like,
like
I
i
don't
don't
know,
know
Joe.
joe
And
and
then
then
if
if
I
i
hit
hit
escape,
escape
I'm
i'm
back
back
in
in
command
command
mode
mode
where
where
I
i
can
can
move
move
around.
around
So
so
you'll
you'll
notice
notice
the
the
one
one
thing
thing
that
that
I
i
wanna
wanna
point
point
out
out
to
to
a
a
tip
tip
is
is
a
a
lot
lot
of
of
Vim
vim
users
users
remap
remap
their
their
caps
caps
lock
lock
key
key
to
to
escape.
escape
So
so
instead
instead
of
of
Caps
caps
lock
lock
being
being
caps
caps
lock
lock
when
when
I
i
hit
hit
the
the
key,
key
it
it
actually
actually
is
is
escape.
escape
And
and
so
so
it's
it's
a
a
lot
lot
more
more
accessible.
accessible
It's
it's
closer.
closer
It's
it's
right
right
next
next
to
to
my
my
pinky
pinky
Rather
rather
than
than
having
having
to
to
reach
reach
to
to
the
the
corner
corner
of
of
the
the
keyboard
keyboard
and
and
hit
hit
escape.
escape
So
so
that's
that's
one
one
thing
thing
I'd
i'd
encourage
encourage
you
you
to
to
look
look
into,
into
uh,
uh
remapping
remapping
your
your
caps
caps
lock
lock
key
key
to
to
escape
escape
If
if
you
you
are
are
serious
serious
about
about
learning
learning
them.
them
So
so
we
we
just
just
covered
covered
capital
capital
I.
i
We
we
know
know
that
that
lowercase
lowercase
I
i
is
is
insert
insert
mode.
mode
Right?
right
So
so
now
now
what
what
I
i
want
want
to
to
talk
talk
about
about
is
is
lowercase
lowercase
a.
a
The
the
thing
thing
that
that
you
you
gotta
gotta
pay
pay
attention
attention
to
to
here
here
is
is
the
the
cursor.
cursor
Right
right
now,
now
it's
it's
on
on
top
top
of
of
the
the
exclamation
exclamation
point.
point
So
so
if
if
it
it
hit
hit
I,
i
it'll
it'll
move
move
to
to
the
the
left.
left
And
and
now
now
if
if
I
i
go
go
back,
back
now
now
if
if
I
i
hit
hit
a,
a
it'll
it'll
enter
enter
into
into
insert
insert
mode
mode
but
but
after
after
the
the
cursor.
cursor
So
so
like
like
this.
this
So
so
again,
again
uh,
uh
if
if
we
we
have
have
like
like
a
a
number
number
2
2
here
here
and
and
we
we
want
want
to
to
add
add
to
to
the
the
beginning
beginning
and
and
make
make
it
it
22
22
will
will
hit
hit
I
i
that'll
that'll
let
let
us
us
enter
enter
at
at
the
the
beginning.
beginning
And
and
now
now
if
if
we
we
want
want
to
to
add
add
to
to
the
the
end,
end
like
like
say
say
I
i
wanted
wanted
to
to
add
add
period
period
22.
22
So
so
22/22,
22/22
then
then
I
i
can
can
use
use
lowercase
lowercase
a.
a
So
so
those
those
are
are
very
very
handy
handy
when
when
you're
you're
Inserting
inserting
letters
letters
or
or
making
making
changes,
changes
uh,
uh
in
in
a
a
line.
line
Now,
now
the
the
next
next
one
one
that
that
I
i
want
want
to
to
talk
talk
about
about
is
is
capital
capital
a
a
And
and
so
so
this
this
is
is
like
like
appending
appending
to
to
the
the
end
end
of
of
the
the
line.
line
So
so
you'll
you'll
enter
enter
insert
insert
mode
mode
at
at
the
the
end
end
of
of
a
a
line.
line
So
so
here
here
I
i
am.
am
Wanna
wanna
add
add
more
more
exclamation
exclamation
points
points
at
at
the
the
end
end
of
of
hello
hello
world.
world
So
so
if
if
I
i
hit
hit
shift
shift
a,
a
it
it
will
will
move
move
the
the
cursor
cursor
to
to
the
the
end
end
and
and
it
it
will
will
enter
enter
into
into
insert
insert
mode.
mode
So
so
now
now
that
that
I
i
can
can
Enter
enter
a
a
few
few
exclamation
exclamation
points.
points
Now
now
if
if
we
we
go
go
back
back
to
to
the
the
beginning,
beginning
we
we
can
can
do
do
shift
shift
I.
i
Now
now
we're
we're
insert
insert
mode
mode
at
at
the
the
beginning
beginning
of
of
the
the
line.
line
So
so
as
as
as
as
you
you
can
can
see
see
the
the
I
i
capital
capital
I
i
a
a
capital
capital
a
a
are
are
very
very
handy
handy
for
for
editing
editing
in
in
a
a
line.
line
Great.
great
Uh,
uh
we've
we've
talked
talked
about
about
navigation.
navigation
We've
we've
talked
talked
about
about
editing
editing
and
and
align.
align
Now,
now
the
the
last
last
2
2
that
that
I
i
want
want
to
to
talk
talk
about
about
are
are
x
x
and
and
r.
r
And
and
these
these
are
are
handy
handy
for
for
making
making
changes
changes
while
while
in
in
command
command
mode.
mode
If
if
we
we
go
go
back
back
up
up
right
right
here
here
and
and
so
so
I
i
wanna
wanna
get
get
to
to
the
the
beginning
beginning
of
of
the
the
sentence.
sentence
So
so
I'm
i'm
gonna
gonna
hit
hit
shift
shift
I,
i
hit
hit
escape
escape
because
because
I
i
wanna
wanna
be
be
in
in
command
command
mode.
mode
So
so
you'll
you'll
see
see
that
that
I
i
have
have
4
4
j's.
j's
Right.
right
I
i
don't
don't
really
really
need
need
all
all
of
of
those.
those
So
so
what
what
we're
we're
going
going
to
to
do
do
is
is
actually
actually
use
use
x
x
to
to
delete
delete
those.
those
So
so
x
x
is
is
kind
kind
of
of
like
like
x
x
out
out
of
of
character.
character
So
so
I'll
i'll
hit
hit
it
it
3
3
times.
times
123.
123
And
and
now,
now
I
i
have
have
1
1
j,
j
which
which
is
is
correct.
correct
So
so
you
you
can
can
see,
see
we're
we're
able
able
to
to
make
make
edits
edits
without
without
leaving
leaving
command
command
mode.
mode
So
so
we
we
just
just
talked
talked
about
about
x
x
for
for
x
x
ing
ing
out
out
characters.
characters
Now,
now
let's
let's
talk
talk
about
about
r
r
for
for
replacing
replacing
characters.
characters
So
so
I'm
i'm
going
going
to
to
go
go
to
to
the
the
h
h
here
here
And
and
I
i
want
want
this
this
to
to
be
be
capital,
capital
so
so
I'll
i'll
hit
hit
r
r
and
and
then
then
shift
shift
h,
h
uh,
uh
which
which
is
is
just
just
a
a
a
a
capital
capital
h,
h
and
and
now
now
it
it
will
will
replace
replace
it.
it
And
and
again,
again
I
i
haven't
haven't
left
left
command
command
mode.
mode
Here,
here
let's
let's
see
see
this
this
for
for
22/22.
22/22
Let's
let's
change
change
this
this
to,
to
uh,
uh
52
52
22.
22
So
so
we'll
we'll
hit
hit
r
r
and
and
then
then
5.
5
And
and
so,
so
basically,
basically
what
what
it
it
does
does
is
is
it
it
replaces
replaces
the
the
character
character
under
under
the
the
cursor
cursor
with
with
the
the
new
new
character
character
that
that
you
you
type
type
in.
in
So
so
we've
we've
talked
talked
about
about
navigation
navigation
with
with
h
h
j
j
k
k
l.
l
We've
we've
talked
talked
about
about
editing
editing
in
in
line
line
with
with
I,
i
capital
capital
I,
i
a,
a
and
and
capital
capital
a.
a
And
and
now
now
I've
i've
talked
talked
about
about
making
making
changes
changes
on
on
command
command
mode
mode
with
with
x
x
and
and
r.
r
I
i
hope
hope
you
you
enjoyed
enjoyed
that
that
brief
brief
introduction
introduction
to
to
Vim
vim
inside
inside
Versus
versus
code.
code
If
if
you'd
you'd
like
like
to
to
learn
learn
more,
more
head
head
over
over
to
to
vim
vim
for
for
v
v
s
s
code
code
dot
dot
com
com
and
and
check
check
out
out
my
my
course.
course
It's
it's
got
got
100
100
exercises
exercises
to
to
help
help
you
you
learn
learn
how
how
How
how
to
to
use
use
Vim
vim
inside
inside
Versus
versus
Code,
code
and
and
we
we
teach
teach
you
you
22
22
different
different
commands.
commands
Use
use
the
the
coupon
coupon
code
code
Fireship
fireship
for
for
$5
$5
off.
off
Thanks
thanks
for
for
watching,
watching
and
and
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
The speakers discuss the history and benefits of using a keyboard for writing code, including editing and faster work efficiency. They also provide guidance on navigating VIM and editing commands, including key repeat and moving up and down. The importance of using the " Lewis key" to move up and down is emphasized, and viewers are encouraged to check out the website for more resources and a discount code for Fireship.
Vim in 100 Seconds
Vim, a text editor for writing code where you navigate around the screen with a keyboard instead of a mouse. It's based on the original Unix text editor VI, which came about in 19 76. Then vi improved or Vim followed it in 1991 with a bunch of improvements. But why in the age of modern c d e's would you ever wanna use a keyboard based text editor. When you write code all day every day, your fingers should be glued to the keyboard at all times. Every time you touch the mouse, your sivity declines. Learning to code with Vim is like learning to play an instrument. It'll be painful at first, but that pain will lead to more precise and productive code editing in the future. Vim runs in the terminal, and it's installed on almost every machine. And at some point, you'll likely find yourself accidentally dropped into Vim with no way to escape. Let me out of here. If you find yourself there, you can quit them by typing colon q. That will close an unmodified file. Or if it has been modified, You can use q bang to throw away your changes or colon w q to write the changes and then quit. Now that we're out, let's use Vim to open up a file. Currently, c. We're in normal mode, but we can toggle between different modes like insert, visual, and command line depending on what we're trying to do. We can move around the text with the arrow keys or the letters h j k l. If we find a character we want to delete, we can hit x or double d to quickly delete an entire line. If that was a mistake, hit u to undo Now, currently the document is kind of hard to read, so let's add line numbers by running colon set number and now we can navigate to any line with colon number. Now, if we want to change some text, 6. We need to go into insert mode by hitting I and that frees up the keyboard for us to type into the document. Once we're done modifying our code. We can hit the escape key to go back to normal mode, but now, like any good developer, we need to copy and paste some code in here from Stack Overflow. We can paste from the system clipboard by entering plus p into them. And now that our software is complete, we can hit colon w to save it, then run the program directly from them with colon bang followed by the shell command we want to run. Congratulations. You're no longer a sway dev, but a true software engineer. This has been Vim in 100 seconds, but stay tuned because you don't need 2 ditch v s code to get the benefits of Vim. That's why I invited a true expert and the instructor of the Vim for Versus Code course, Joe Prebitt, sit to take us beyond 100 seconds of Vim. Hello, everyone. I'm Joe, and I will be your guide as we go beyond 100 seconds To discuss why you should learn VIM and how you can leverage it inside your favorite editor, Versus Code. First, let's talk about why you should learn VIM. Vim is an evergreen skill, meaning you can learn it once and the knowledge will last with you for the rest of your career. It allows you to work faster and more efficiently within your editor. Here's a side by side comparison. On the left, we have editing with Vim. On the right, we have editing without Vim. As you can see, VIM lets you do more from the keyboard, meaning you get to spend less time editing and more time coding. Now let's talk about How to set up Vim with Versus Code. Once you're inside Versus Code, head over to the extension panel and search Vim. You should see the first extension called Vim. And to make sure it's the right version, double check that it's vscodevim.vim, And it should have around 2,000,000 installations. Go ahead and install this extension. The next thing we're going to do is set up key repeat. So head over to Google and look up vscode vim GitHub. You should see the first link, which is a GitHub repository called vscode vim/vim. There, you're gonna scroll down to the installation section. In here, you'll see instructions for how to enable Key repeating. This is a handy thing to add, especially when you're new to VIM because it'll allow you to hit the key And it will repeat as in if you were to hit j to move down. Find your operating system. I'm on Mac. And then run this in your terminal. And now for the changes to take effect, you're going to want to restart Versus Code. To verify that it worked, go ahead and create a new file. And now you should see that your cursor is a little bit wider. Go ahead and hit I. This will put us in insert mode and then hit return a bunch of times, then hit escape. And now try hitting and holding k and see if your cursor moves up. If it moves like this Pretty smooth. Then you've enabled key repeating. If it gets stuck, then you may want to try restarting Versus Code again We're revisiting the installation instructions. Great. Now that we have our editor set up, I'd like to teach you a few different commands in Vim. So we'll review some of the ones that Jeff mentioned earlier in the video, and then we'll also learn a few new ones. So inside Versus code, go ahead and create a new file And save it as hello dotmd. Now what I want you to do is hit I to enter insert mode and hit returns. We add a few lines for us to work with and then hit escape. Great. So the first commands that we're going to talk about are for navigation and they will be h j k and l. So right now, we're in command mode. So if we hit k, we'll start moving up. If we hit j, we'll move down. So remember, we just learned k for moving up. I like to think of it as kicking a soccer ball up. I'm kicking upwards on my editor and j for jumping down. Use whatever mnemonic comes to mind to help you remember those. The next, we'll talk about our h in l. So I'm gonna write hello world here and you can do the same. So again, the way that I did that was I for insert mode, start typing Hello, world. And then when you're done, hit escape, and you'll be back in command mode. So the first one we'll talk about is h. So if you hit h, You'll start moving to the left, as in you're moving to the beginning of the line, also the h in hello world. Now, once we're there, if we wanna go back right, we start hitting l, and that will move us towards the l in world. So again, figure out a mnemonic that's going to help you remember those. For me, I like to think of h as in I'm going home to the left And then l, you would think that would be l for left, but it's actually the opposite of that. So l for right. Great. So now we're we're feeling comfortable with navigating in Vim. Again, we're in command mode. We're moving up and down with j and k and left and right with h and l. The other thing to to remember is if you take a look, pause for a second, look at your keyboard, see where the keys are on your keyboard. You should see the h to the left of j and k. So that also helps me remember. And then l So the other thing I wanna point out is you still have access to your mouse. So you can click to move around. So there's no need to worry about getting stuck in Vim. I'm sure you've heard horror stories. People not being able to exit them. Luckily, using Vim inside of Versus Code, we're really just using the Vim key bindings. So we don't have to worry. We can close a file. We can navigate. Uh, no need to to fear being stuck in VIM. Now the next thing I want to point out is some editing commands. So we will talk about I, capital I, a and capital a for editing in a line. So we're gonna go back to our hello world and you'll see right now the cursor is at the end of the line. If I hit shift I or capital I, It'll move me in insert mode at the beginning so I could write a word like, I don't know, Joe. And then if I hit escape, I'm back in command mode where I can move around. So you'll notice the one thing that I wanna point out to a tip is a lot of Vim users remap their caps lock key to escape. So instead of Caps lock being caps lock when I hit the key, it actually is escape. And so it's a lot more accessible. It's closer. It's right next to my pinky Rather than having to reach to the corner of the keyboard and hit escape. So that's one thing I'd encourage you to look into, uh, remapping your caps lock key to escape If you are serious about learning them. So we just covered capital I. We know that lowercase I is insert mode. Right? So now what I want to talk about is lowercase a. The thing that you gotta pay attention to here is the cursor. Right now, it's on top of the exclamation point. So if it hit I, it'll move to the left. And now if I go back, now if I hit a, it'll enter into insert mode but after the cursor. So like this. So again, uh, if we have like a number 2 here and we want to add to the beginning and make it 22 will hit I that'll let us enter at the beginning. And now if we want to add to the end, like say I wanted to add period 22. So 22/22, then I can use lowercase a. So those are very handy when you're Inserting letters or making changes, uh, in a line. Now, the next one that I want to talk about is capital a And so this is like appending to the end of the line. So you'll enter insert mode at the end of a line. So here I am. Wanna add more exclamation points at the end of hello world. So if I hit shift a, it will move the cursor to the end and it will enter into insert mode. So now that I can Enter a few exclamation points. Now if we go back to the beginning, we can do shift I. Now we're insert mode at the beginning of the line. So as as you can see the I capital I a capital a are very handy for editing in a line. Great. Uh, we've talked about navigation. We've talked about editing and align. Now, the last 2 that I want to talk about are x and r. And these are handy for making changes while in command mode. If we go back up right here and so I wanna get to the beginning of the sentence. So I'm gonna hit shift I, hit escape because I wanna be in command mode. So you'll see that I have 4 j's. Right. I don't really need all of those. So what we're going to do is actually use x to delete those. So x is kind of like x out of character. So I'll hit it 3 times. 123. And now, I have 1 j, which is correct. So you can see, we're able to make edits without leaving command mode. So we just talked about x for x ing out characters. Now, let's talk about r for replacing characters. So I'm going to go to the h here And I want this to be capital, so I'll hit r and then shift h, uh, which is just a a capital h, and now it will replace it. And again, I haven't left command mode. Here, let's see this for 22/22. Let's change this to, uh, 52 22. So we'll hit r and then 5. And so, basically, what it does is it replaces the character under the cursor with the new character that you type in. So we've talked about navigation with h j k l. We've talked about editing in line with I, capital I, a, and capital a. And now I've talked about making changes on command mode with x and r. I hope you enjoyed that brief introduction to Vim inside Versus code. If you'd like to learn more, head over to vim for v s code dot com and check out my course. It's got 100 exercises to help you learn how How to use Vim inside Versus Code, and we teach you 22 different commands. Use the coupon code Fireship for $5 off. Thanks for watching, and I will see you in the next one.
The speakers discuss the history and benefits of using a keyboard for writing code, including editing and faster work efficiency. They also provide guidance on navigating VIM and editing commands, including key repeat and moving up and down. The importance of using the " Lewis key" to move up and down is emphasized, and viewers are encouraged to check out the website for more resources and a discount code for Fireship.

        [INST]
        You are youtuber called Fireship you make engaging high-intensity and entertaining coding tutorials and tech news. 
        you covers a wide range of topics relevant to programmers, aiming to help them learn and improve their skills quickly.
        
        Given the title of the video : Vim in 100 Seconds 
        and a small summary : The speakers discuss the history and benefits of using a keyboard for writing code, including editing and faster work efficiency. They also provide guidance on navigating VIM and editing commands, including key repeat and moving up and down. The importance of using the " Lewis key" to move up and down is emphasized, and viewers are encouraged to check out the website for more resources and a discount code for Fireship.
        [/INST]
        
        Generate the video : Vim, a text editor for writing code where you navigate around the screen with a keyboard instead of a mouse. It's based on the original Unix text editor VI, which came about in 19 76. Then vi improved or Vim followed it in 1991 with a bunch of improvements. But why in the age of modern c d e's would you ever wanna use a keyboard based text editor. When you write code all day every day, your fingers should be glued to the keyboard at all times. Every time you touch the mouse, your sivity declines. Learning to code with Vim is like learning to play an instrument. It'll be painful at first, but that pain will lead to more precise and productive code editing in the future. Vim runs in the terminal, and it's installed on almost every machine. And at some point, you'll likely find yourself accidentally dropped into Vim with no way to escape. Let me out of here. If you find yourself there, you can quit them by typing colon q. That will close an unmodified file. Or if it has been modified, You can use q bang to throw away your changes or colon w q to write the changes and then quit. Now that we're out, let's use Vim to open up a file. Currently, c. We're in normal mode, but we can toggle between different modes like insert, visual, and command line depending on what we're trying to do. We can move around the text with the arrow keys or the letters h j k l. If we find a character we want to delete, we can hit x or double d to quickly delete an entire line. If that was a mistake, hit u to undo Now, currently the document is kind of hard to read, so let's add line numbers by running colon set number and now we can navigate to any line with colon number. Now, if we want to change some text, 6. We need to go into insert mode by hitting I and that frees up the keyboard for us to type into the document. Once we're done modifying our code. We can hit the escape key to go back to normal mode, but now, like any good developer, we need to copy and paste some code in here from Stack Overflow. We can paste from the system clipboard by entering plus p into them. And now that our software is complete, we can hit colon w to save it, then run the program directly from them with colon bang followed by the shell command we want to run. Congratulations. You're no longer a sway dev, but a true software engineer. This has been Vim in 100 seconds, but stay tuned because you don't need 2 ditch v s code to get the benefits of Vim. That's why I invited a true expert and the instructor of the Vim for Versus Code course, Joe Prebitt, sit to take us beyond 100 seconds of Vim. Hello, everyone. I'm Joe, and I will be your guide as we go beyond 100 seconds To discuss why you should learn VIM and how you can leverage it inside your favorite editor, Versus Code. First, let's talk about why you should learn VIM. Vim is an evergreen skill, meaning you can learn it once and the knowledge will last with you for the rest of your career. It allows you to work faster and more efficiently within your editor. Here's a side by side comparison. On the left, we have editing with Vim. On the right, we have editing without Vim. As you can see, VIM lets you do more from the keyboard, meaning you get to spend less time editing and more time coding. Now let's talk about How to set up Vim with Versus Code. Once you're inside Versus Code, head over to the extension panel and search Vim. You should see the first extension called Vim. And to make sure it's the right version, double check that it's vscodevim.vim, And it should have around 2,000,000 installations. Go ahead and install this extension. The next thing we're going to do is set up key repeat. So head over to Google and look up vscode vim GitHub. You should see the first link, which is a GitHub repository called vscode vim/vim. There, you're gonna scroll down to the installation section. In here, you'll see instructions for how to enable Key repeating. This is a handy thing to add, especially when you're new to VIM because it'll allow you to hit the key And it will repeat as in if you were to hit j to move down. Find your operating system. I'm on Mac. And then run this in your terminal. And now for the changes to take effect, you're going to want to restart Versus Code. To verify that it worked, go ahead and create a new file. And now you should see that your cursor is a little bit wider. Go ahead and hit I. This will put us in insert mode and then hit return a bunch of times, then hit escape. And now try hitting and holding k and see if your cursor moves up. If it moves like this Pretty smooth. Then you've enabled key repeating. If it gets stuck, then you may want to try restarting Versus Code again We're revisiting the installation instructions. Great. Now that we have our editor set up, I'd like to teach you a few different commands in Vim. So we'll review some of the ones that Jeff mentioned earlier in the video, and then we'll also learn a few new ones. So inside Versus code, go ahead and create a new file And save it as hello dotmd. Now what I want you to do is hit I to enter insert mode and hit returns. We add a few lines for us to work with and then hit escape. Great. So the first commands that we're going to talk about are for navigation and they will be h j k and l. So right now, we're in command mode. So if we hit k, we'll start moving up. If we hit j, we'll move down. So remember, we just learned k for moving up. I like to think of it as kicking a soccer ball up. I'm kicking upwards on my editor and j for jumping down. Use whatever mnemonic comes to mind to help you remember those. The next, we'll talk about our h in l. So I'm gonna write hello world here and you can do the same. So again, the way that I did that was I for insert mode, start typing Hello, world. And then when you're done, hit escape, and you'll be back in command mode. So the first one we'll talk about is h. So if you hit h, You'll start moving to the left, as in you're moving to the beginning of the line, also the h in hello world. Now, once we're there, if we wanna go back right, we start hitting l, and that will move us towards the l in world. So again, figure out a mnemonic that's going to help you remember those. For me, I like to think of h as in I'm going home to the left And then l, you would think that would be l for left, but it's actually the opposite of that. So l for right. Great. So now we're we're feeling comfortable with navigating in Vim. Again, we're in command mode. We're moving up and down with j and k and left and right with h and l. The other thing to to remember is if you take a look, pause for a second, look at your keyboard, see where the keys are on your keyboard. You should see the h to the left of j and k. So that also helps me remember. And then l So the other thing I wanna point out is you still have access to your mouse. So you can click to move around. So there's no need to worry about getting stuck in Vim. I'm sure you've heard horror stories. People not being able to exit them. Luckily, using Vim inside of Versus Code, we're really just using the Vim key bindings. So we don't have to worry. We can close a file. We can navigate. Uh, no need to to fear being stuck in VIM. Now the next thing I want to point out is some editing commands. So we will talk about I, capital I, a and capital a for editing in a line. So we're gonna go back to our hello world and you'll see right now the cursor is at the end of the line. If I hit shift I or capital I, It'll move me in insert mode at the beginning so I could write a word like, I don't know, Joe. And then if I hit escape, I'm back in command mode where I can move around. So you'll notice the one thing that I wanna point out to a tip is a lot of Vim users remap their caps lock key to escape. So instead of Caps lock being caps lock when I hit the key, it actually is escape. And so it's a lot more accessible. It's closer. It's right next to my pinky Rather than having to reach to the corner of the keyboard and hit escape. So that's one thing I'd encourage you to look into, uh, remapping your caps lock key to escape If you are serious about learning them. So we just covered capital I. We know that lowercase I is insert mode. Right? So now what I want to talk about is lowercase a. The thing that you gotta pay attention to here is the cursor. Right now, it's on top of the exclamation point. So if it hit I, it'll move to the left. And now if I go back, now if I hit a, it'll enter into insert mode but after the cursor. So like this. So again, uh, if we have like a number 2 here and we want to add to the beginning and make it 22 will hit I that'll let us enter at the beginning. And now if we want to add to the end, like say I wanted to add period 22. So 22/22, then I can use lowercase a. So those are very handy when you're Inserting letters or making changes, uh, in a line. Now, the next one that I want to talk about is capital a And so this is like appending to the end of the line. So you'll enter insert mode at the end of a line. So here I am. Wanna add more exclamation points at the end of hello world. So if I hit shift a, it will move the cursor to the end and it will enter into insert mode. So now that I can Enter a few exclamation points. Now if we go back to the beginning, we can do shift I. Now we're insert mode at the beginning of the line. So as as you can see the I capital I a capital a are very handy for editing in a line. Great. Uh, we've talked about navigation. We've talked about editing and align. Now, the last 2 that I want to talk about are x and r. And these are handy for making changes while in command mode. If we go back up right here and so I wanna get to the beginning of the sentence. So I'm gonna hit shift I, hit escape because I wanna be in command mode. So you'll see that I have 4 j's. Right. I don't really need all of those. So what we're going to do is actually use x to delete those. So x is kind of like x out of character. So I'll hit it 3 times. 123. And now, I have 1 j, which is correct. So you can see, we're able to make edits without leaving command mode. So we just talked about x for x ing out characters. Now, let's talk about r for replacing characters. So I'm going to go to the h here And I want this to be capital, so I'll hit r and then shift h, uh, which is just a a capital h, and now it will replace it. And again, I haven't left command mode. Here, let's see this for 22/22. Let's change this to, uh, 52 22. So we'll hit r and then 5. And so, basically, what it does is it replaces the character under the cursor with the new character that you type in. So we've talked about navigation with h j k l. We've talked about editing in line with I, capital I, a, and capital a. And now I've talked about making changes on command mode with x and r. I hope you enjoyed that brief introduction to Vim inside Versus code. If you'd like to learn more, head over to vim for v s code dot com and check out my course. It's got 100 exercises to help you learn how How to use Vim inside Versus Code, and we teach you 22 different commands. Use the coupon code Fireship for $5 off. Thanks for watching, and I will see you in the next one.
        