TalkingQuickly
TalkingQuickly

Reputation: 548

ctags and ruby modules in vim

I'm using ripper tags (https://github.com/tmm1/ripper-tags) to generate ctags files for a ruby project.

My goals is, in vim, to be able to jump from a line such as:

::Api::Contracts::Creator.new(

To the relevant file which defines that module.

This configuration works fine if there is only one module called Creator. But in practice there will be many Creators in different namespaces, e.g there will also be an ::Api::Users::Creator.

The above configuration will just jump to the first definition of Creator rather than the specific Creator in question.

Is there anyway to configure ctags so that it will jump to the specific definition?

Upvotes: 2

Views: 526

Answers (1)

TalkingQuickly
TalkingQuickly

Reputation: 548

ripper-tags needs to be run with the option

--extra=1

So that tags will be generated which include the full module paths. This still leaves the problem that ctrl+] uses the current word so using it on Module::Class will only search for Class.

But this isn't really a ctags issue so I'll open a separate question on how best to write a custom command in vim to do this.

Using visual select to select the full definition and then ctrl+] will go to the correct definition.

Upvotes: 1

Related Questions