Rory's Blog
Home
Blog
Projects
Facebook
Google+
Github
RSS

Vim: Tags

04/05/15

I have been using vim tags at work for a while now, and so I'm kinda surprised I haven't written a post about it yet.

Frankly, vim tags are awesome and so is cscope. I'm sure there are tools that set it up for any given language, but right now I've only used them in C/C++.

Wondering where a variable or function you're reading is defined? Highlight the vim cursor on it and press crtl-] and vim will provide a list of places it thinks it's defined.

Personally, I don't like the default interface for the list that shows up. From what I've read, it's possible to change it, but I haven't dug into that yet. Maybe I'll get to it another post.

Anyways, vim will take you to the place it thinks it's defined, and you can read/modify code there to your liking. When finishing, just press crtl-t and you'll be back in the previous file where you left off.

This is really useful for debugging and also adding code to a hierachy structure of some sort.

Next time, I'll talk about how I use vim tags in conjunction with cscope, and maybe I'll finally do some thinking about making using cscope and vim tags a little bit less painful.