Skip to content

Instantly share code, notes, and snippets.

@kjell
Created July 6, 2015 20:39
Show Gist options
  • Save kjell/de9d69339a06dadd6d00 to your computer and use it in GitHub Desktop.
Save kjell/de9d69339a06dadd6d00 to your computer and use it in GitHub Desktop.

So up next we have Derek. Are you here today? I'm here. Do you need...? He's running. So you all need to get your computers out if you have OS X or Linux. Get them out. All right. Quiet down. This is serious business. Probably going to the command line. …

So we are going to learn as vi. Vim is an editor we're going to don't it in five minutes.

You might say I'm crazy.

You're crazy.

First thing you need to do is open up your terminal.

Second thing that you need to do is type what I type. Type and press enter.

Type my name, D-E-R-E-K, nothing happens, that's pretty weird.

Now type Yvonne's name. Y-V-O-N-N-E. You don't see anything, that's weird.

Now type Millie's name. M-I-L-L-I-E, what happened there? So Vim has something called insertion mode and it's different from the normal kind of mode, which is movie mode, or normal mode. But insertion mode is like a text editor.

So now type insert twice. And now type, "When I was a boy, I wanted to be a train." Dash Max Barry, Machine Man. Now type insert. Now this is movement mode.

This is default mode movement mode is like Vim because movement mode is like learning a great piece of music for the tenth time. Every time you learn something new.

Think about back when you listened to Taylor Swift. And you need an O, H. In Vim, H is back. Now hold L. In Vim, L is forward. Now press K, that's up. And press J, that's down.

Now, press O, and that's -- on the next line, start typing, and now press enter.

And now type, "Why listen to Nickelback when you can listen to Taylor Swift," period, escape. Now, there are a few other ways you can move around in Vim. You can move by the word by pressing B, back, back, back, back, back, or forward by words by pressing W, forward, forward, forward, back, back, back.

You can go forward by typing A, and now I want you to type brussels sprouts, all in caps. Period and escape. Now press U, undo that. No one likes brussels sprouts.

Now I want you to type O again and I want you to type, "I will not bribe Principal Skinner." Now press escape, now type 20, period. Now I want you again to type dash NOT. Now that it's search. What that does it searches for that term inside of your text editor, or you can call it a buffer, that's what Vim calls it. You type N again, and it goes down to the next word. And you type capital N and it will go back to the preview.

Now the thing that it doesn't do is it doesn't highlight anything. That's weird. But we can change that. Just type colon, set, space, hlsearch, just like that and now you can see the highlights. Pretty cool, right? Pretty cool! Now even if you want to save this text because we've done a lot of work today.

So you hit save, colon, w, and you put desktop, so you can find it really easily next time you want to use this text file. And now, you can quit. That's how you use Vim, guys.

[ Applause ] [ https://github.com/OpenNews/srccon-data/blob/fd60c07a12ae25dbd7bbfb27b09f57ff7c3b2b05/2015/transcripts/SRCCON2015LightningTalks.txt#L40-L47 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment