Transcript from the "Exercise 5: Vim command mode" Lesson
>> Jem: Command mode, so let's go to insert mode. Type "Hello, World!", then press Enter. Type "Hello, class!", okay so, now that we have something to search, we're gonna use the search command. Back in VIM, let me just type Hello, world. So hit escape back in command mode. So if I wanna search / I can type in Hello.
[00:00:30] I hit Enter, I'm now searching documents. I hit End, still in command mode, and move to the next instance.
>> Jem: I know, this seems trivial for a two line document, but later, when we're in much larger documents, find will save you. Unless you wanna just scroll, scroll, scroll, scroll, scroll, scroll, scroll.
[00:00:54] Shift+N searches from the bottom of the document, so Shift+N, N for search.
>> Jem: I have VIM cheat sheets, and they are massive. Because there are a lot of commands that you use and you probably don't even know that you use. But I don't wanna get too bogged down in all the commands, cuz they are many.
[00:01:16] So, so far we've learned search from bottom search from the top, we've learned how do undo and redo. Let's keep going and learn some more commands.
>> Jem: Okay, yeah, so, I cut and paste out of linuxmoz.com, they have cheat sheets. But trust me when I say it is many, many pages so I only want to give you the relevant, yes?
>> Speaker 2: Is there a way to make the search non case-sensitive?
>> Jem: There is, I actually don't know off the top of my head. I am not a VIM pro, but the good thing is if you Google non case-sensitive search, actually I'll just do that now.
>> Speaker 2: I think it is non maybe you meant case-sensitive, cuz I dont think it is.
>> Jem: I think it is currently, it's case-sensitive now.
>> Speaker 2: By default, case-sensitive.
>> Jem: So I'm just gonna do what I'm doing, VIM case-insensitive, search. This is how I solve all my problems at work, too. How do I do case-insensitive search?
>> Jem: Slash C, interesting, let's give that a shot.
[00:02:23] So I'll go back in Insert mode, actually go to here. Just want to go to the end, Insert. Actually, undo, say hello.
>> Jem: Hello /, what's that, forward c?
>> Jem: Cool.
>> Jem: So that was in command mode, escape / \c, and then case unsensitive search.
>> Jem: I know, it's so gnarly, cuz this is not what we're used to at all.
[00:03:09] And it gets people the first time they use VIM. They're just like, this is so ugly. But, again, if you're a VIM pro and you have all this stuff memorized from muscle memory. You're so much faster than most other IDEs you could possibly use.
>> Jem: Great question though, and never be scared to Google something.
[00:03:29] [LAUGH] Trust me, so many people just, I don't know, they get intimidated. And think no I need to memorize everything. No, I don't memorize most things, I have a search engine. So these are valuable cheats that you use. Again DD deletes a line, useful. :q will exit VI without saving anything.
[00:03:54] :wq is probably the one you're gonna use most.
>> Jem: So,
>> Jem: Actually, I think that's the next slide. So this just,
>> Jem: Yeah, so feel free that, these slides again are on jemyoung.com/fefs if you need to come here and reference. Or you can just Google VIM cheat sheet, and it'll tell you a whole bunch of commands.
[00:04:16] It'll tell you probably way more than you want to know.