I am using vim 7.x
I am using alternate file.
I have a mapping of *.hpp <--> *.cpp
Suppose I'm in
class Foo {
void some_me#mber_func(); // # = my cursor
}
in Foo.hpp
is there a way to tell vim to do the following:
- Grab word under # (easy, expand("")
- Look up the class I'm inside of ("Foo") <-- I have no idea how to do this
- Append `1 & 2 (easy: using ".") --> "Foo::some_member_func" 4: Switch files (easy, :A)
- Do a / on 4
So basically, I can script all of this together, except the "find the name of the enclosing class I'm in part (especially if classes are nested).
I know about ctags. I know about cscope. I'm choosing to not use them -- I prefer solutions where I understand where they break. [So readers, please downvote such suggestions.]
Thanks.