linrongbin16 / gitlinker.nvim

Maintained fork of ruifm's gitlinker, refactored with bug fixes, ssh aliases, blame support and other improvements.
GNU General Public License v3.0
163 stars 9 forks source link

Question: current_branch and default_branch for custom domains #244

Closed achojo closed 2 months ago

achojo commented 2 months ago

Hi, I just started to use gitlinker.nvim and I liked it a lot.

I have configured browse and blame for custom Gitlab domain

This is the how it's looks like (just domain is changed)

require('gitlinker').setup({
  router = {
    browse = {
      ["^gitlab%.your%.host"] = require('gitlinker.routers').gitlab_browse,
    },
    blame = {
      ["^gitlab%.your%.host"] = require('gitlinker.routers').gitlab_blame,
    },
  }
})

And wanted to ask, is there a way to add current_branch and default_branch for custom domains with builtin functions?

linrongbin16 commented 2 months ago

hi @achojo , no.

The API is a legacy design before the string template.

So I didn't implement APIs for the branches.

Please try string template, or PR is welcome as well.

achojo commented 2 months ago

Thanks for response, I think I am going to start using string templates.

And just want to leave a link to the file where builtin string templates reside for anyone who will be looking for it. https://github.com/linrongbin16/gitlinker.nvim/blob/542f51784f20107ef9ecdadc47825204837efed5/lua/gitlinker/configs.lua?plain=1#L20

Kind of small contribution :)