rgroli/other.nvim

[Feature] Add spec patterns to default rails mappings

Closed this issue · 1 comments

Thanks for this amazing plugin.

I would like to note that many rspec users use spec instead of test folder and suffix.
It's well handled when going from a source file to a spec file, but the other way around isn't a default.

I added these mappings in order to make it work for me.

        {
          pattern = '(.+)/spec/(.*)/(.*)/(.*)_spec.rb',
          target = {
            { context = "source", target = '%1/db/%3/%4.rb' },
            { context = "source", target = '%1/app/%3/%4.rb' },
            { context = "source", target = '%1/%3/%4.rb' },
          },
        },
        {
          pattern = '(.+)/spec/(.*)/(.*)_spec.rb',
          target = {
            { context = "source", target = '%1/db/%2/%3.rb' },
            { context = "source", target = '%1/app/%2/%3.rb' },
            { context = "source", target = '%1/lib/%2/%3.rb' },
          },
        },
        {
          pattern = '(.+)/spec/(.*)/(.*)_(.*)_spec.rb',
          target = {
            { context = "source", target = '%1/app/%4s/%3_%4.rb' },
          },
        }

I can create a PR if you're open to it

@elkesrio Very open to it - I welcome every PR 😄