rgroli/other.nvim

Add built-in mappings for Golang

Closed this issue · 2 comments

erikw commented

The convention for Golang is to have the test file in the same directory as the source file, but with a _test.go suffix. For example /some/dir/impl.go -> /some/dir/impl_test.go.

Thus it should be easy to add a built-in mapping preset for Golang to this plugin. I think it could be something as simple as

{
    context = "test",
    pattern = "(.*).go$",
    target = "%1_test.go",
},
{
    context = "implementation",
    pattern = "(.*)_test.go$",
    target = "%1.go",
},

At least it seems to work on the first usages!

rgroli commented

Hi,
this is now added to the builtin mappings

erikw commented

Yay, it works great, thanks @rgroli!