VimSchool Seminar 4 Is Up

I just posted the VimSchool Seminar 4 video, where I go through repetition and basic file navigation. You can get the videos here:

https://shop.learncodethehardway.org/products/contents/16/

I’ll update this post with the outline for what was covered in Seminar 4 after I finish formatting it tomorrow, but the summary is:

  • Navigating files in your directory.
  • Opening and moving between multiple files.
  • Working with buffers.
  • Doing window splits and moving them around.
  • Repeating normal commands and colon commands.
  • Making macros and then repeating them.
  • Doing normal commands, colon commands, and macros to multiple files and buffers.

Feel free to let me know if there’s any editing issues with this one.

VimSchool Seminar 5: Code Navigation

Next Thursday (Jun 28) I’ll cover how to setup tags for your language of choice, and do code navigation. I’ll demonstrate with Python and C, and use ctags and cscope for jumping around code based on the semantics of those languages, rather than just textual searching. In order to this seminar I’ll have to get into more Vim configuration, setting up tags, and other things needed for programming tasks.

I forgot to mention, if you want to buy Vim School you can do so here:

https://shop.learncodethehardway.org/access/buy/16/

I’m watching the 4th seminar and I was wondering if for exemple:
You’ve teached that you can do this
:%s/ (self).*/\1):/g so you take this content and put into a var \1 and substitute universally

but my question is, What I do if I want to change just the “selfs” that come before canvas for exemple, like this

init(self, canvas, color): <=== wanna change this one
def(self, color): <=== NOT this one
def (self, canvas, paddle): <=== this one
def (self, canvas): <== and this one

what regex I use in this case?

The same thing applies, but you just have to change what surrounds where you’re trying to capture. So let’s say you want those (self, characters, then you make that your regex you capture:

%s:/\((self,\).*/\1/g

Notice how I have the \(( first? The first \( starts the capture, but then I’m saying “capture everything that’s (self,”.

Another thing to do is if you use my configuration (either the starter or the one in 1B and 1C) then you’ll be able to visually select what you want. Use the / search command and then work out your regex visually. Once you have it, scroll up (up arrow) and copy it so you can use it in the %s command. Then just put \( \) around it.

1 Like

GOT IT!!!
thanks!! = )