Skip to content

Struggling to get a custom router using ssh remote with port #248

@ErickKramer

Description

@ErickKramer

Thank you for maintaining this plugin! I was on the way to develop something similar when I found this.

I was going through your README.md and tried to get a custom router working for my enterprise Gitlab, but I am doing something wrong and I cannot identify what.

My current config looks as follows

return {
	"linrongbin16/gitlinker.nvim",
	cmd = "GitLink",
	config = function(opts)
		opts = opts or {}
		opts.router = {
			my_gitlab = {
				["^gitlab.myhost.com%"] = "https://gitlab.myhost.com/"
					.. "{_A.ORG}/"
					.. "{_A.REPO}/blobs/"
					.. "{_A.CURRENT_BRANCH}/"
					.. "{_A.FILE}"
					.. "#L{_A.LSTART}"
					.. "{(_A.LEND > _A.LSTART and ('-L' .. _A.LEND) or '')}",
			},
		}
		opts.debug = true
		opts.file_log = true
		require("gitlinker").setup(opts)
	end,
}

The remotes that we used are with the following form

ssh://git@gitlab.myhost.com:9898/some_group/some_repo.git

While running the GitLink my_gitlab I get the following error

Error executing vim.schedule lua callback: ...nvim/lazy/gitlinker.nvim/lua/gitlinker/commons/async.lua:80:
 The coroutine failed with this message:                                                                  
...im/lazy/gitlinker.nvim/lua/gitlinker/commons/logging.lua:455: fatal: failed to generate permanent url f
rom remote ("ssh://git@gitlab.myhost.com:9898/er_dev/er_rosinstall.git"): "...im/lazy/gitlin
ker.nvim/lua/gitlinker/commons/logging.lua:455: \"gitlab.myhost.com\" not support, please bi
nd it in 'router'!"                                                                                       
stack traceback:                                                                                          
        [C]: in function 'assert'                                                                         
        ...im/lazy/gitlinker.nvim/lua/gitlinker/commons/logging.lua:455: in function 'ensure'             
        .../.local/share/nvim/lazy/gitlinker.nvim/lua/gitlinker.lua:232: in function <.../.local/share/nvi
m/lazy/gitlinker.nvim/lua/gitlinker.lua:204>                                                              
stack traceback:                                                                                          
        [C]: in function 'error'                                                                          
        ...nvim/lazy/gitlinker.nvim/lua/gitlinker/commons/async.lua:80: in function 'cb'                  
        ...nvim/lazy/gitlinker.nvim/lua/gitlinker/commons/async.lua:120: in function <...nvim/lazy/gitlink
er.nvim/lua/gitlinker/commons/async.lua:119>

Do you have some idea how I can configure my custom router for this particular case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions