rgroli/other.nvim

Target mapping

Closed this issue · 2 comments

I've been thinking of creating something similar for a while so I already love this plugin very much. Thank you!

However, at work for python projects we can have the following

module1.py
test_module1.py

or

module2.py
module2_test.py

and I was wondering if there was a way for the target mapping to accept different matching patterns with a regex or a list of patterns or something along these lines.

Thank you for this plugin.

Thanks for the kind words :)

For your case I successfullly tested this mapping:

    require("other-nvim").setup({
      mappings = {
            {
             pattern = "(.*)/(.*)_test.py",
             target = "/%1/%2.py",
            },
            {
             pattern = "(.*)/test_(.*).py",
             target = "/%1/%2.py",
            },
            {
             pattern = "(.*)/(.*).py",
             target = "/%1/\\(%2_test.py\\|test_%2.py\\)",
            },
      }, 
    })

Awesome, looks good! Many thanks! :)