Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve hostname set in ssh config #53

Open
joaodubas opened this issue Feb 22, 2022 · 0 comments · May be fixed by #52
Open

Resolve hostname set in ssh config #53

joaodubas opened this issue Feb 22, 2022 · 0 comments · May be fixed by #52
Assignees
Labels
enhancement New feature or request

Comments

@joaodubas
Copy link

Is your feature request related to a problem? Please describe.

Usually, I configure access to git hosts through ssh config. This makes it easier to set different keys for my work and personal projects, as well as it simplifies setup remote hosts.

However, the current parser expects remote uri to be set as https://<hostname>/<user>/<repo>.git, or ssh://git@<hostname>/<user>/<repo>.git, or git@<hostname>:<user>/<repo>.git, and in my case, the remote uri is set as <alias>:<user>/<repo>.git, which causes the following error:

E5108: Error executing lua ...e/pack/packer/start/gitlinker.nvim/lua/gitlinker/git.lua:86: attempt to index local 'uri' (a nil value)
stack traceback:
        ...e/pack/packer/start/gitlinker.nvim/lua/gitlinker/git.lua:86: in function 'strip_uri'
        ...e/pack/packer/start/gitlinker.nvim/lua/gitlinker/git.lua:140: in function 'parse_uri'
        ...e/pack/packer/start/gitlinker.nvim/lua/gitlinker/git.lua:219: in function 'get_repo_data'
        .../site/pack/packer/start/gitlinker.nvim/lua/gitlinker.lua:55: in function 'get_buf_range_url_data'
        .../site/pack/packer/start/gitlinker.nvim/lua/gitlinker.lua:115: in function 'get_buf_range_url'
        [string ":lua"]:1: in main chunk

Describe the solution you'd like

It's possible to resolve the hostname using ssh -G <alias>, which returns a parseable result:

user git
hostname <hostname>
port <port>
...

Describe alternatives you've considered

  1. I changed my host alias to match the hostname without success.
  2. gitlinker could have a hook for the parser, making it possible to override the default implementation.

Additional context

--

@joaodubas joaodubas added the enhancement New feature or request label Feb 22, 2022
@joaodubas joaodubas linked a pull request Feb 22, 2022 that will close this issue
stevanmilic pushed a commit to stevanmilic/gitlinker.nvim that referenced this issue Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants