gitlinker.nvim icon indicating copy to clipboard operation
gitlinker.nvim copied to clipboard

feat: support function for option - remote

Open MunifTanjim opened this issue 2 years ago • 3 comments
trafficstars

MunifTanjim avatar May 25 '23 13:05 MunifTanjim

hi @MunifTanjim ,

Seems ruifm doesn't maintain this repo any longer.

This feature is been implemented in my fork: https://github.com/linrongbin16/gitlinker.nvim.

linrongbin16 avatar Mar 12 '24 04:03 linrongbin16

Hey @linrongbin16 , I looked into your fork a few days ago. But couldn't figure out how to provide a function to dynamically set remote.

MunifTanjim avatar Mar 12 '24 05:03 MunifTanjim

Hey @linrongbin16 , I looked into your fork a few days ago. But couldn't figure out how to provide a function to dynamically set remote.

Type below command:

  • GitLink remote=upstream: copy the generated url to clipboard
  • GitLink! remote=upstream: open the generated url in browser.

The upstream is the remote configured in the git repository's .git/config.

For example in my gitlinker fork, the .git/config is:

image

There's only 1 configured remote: origin. So the GitLink and GitLink remote=origin are doing the same thing: they all generate the link for the origin remote (e.g. the repo hosted in GitHub).

Once your git repo contains multiple remote, the GitLink command will use the first detected remote, if you want to specify a remote, use GitLink remote=upstream will link you to the upstream remote.

linrongbin16 avatar Mar 12 '24 05:03 linrongbin16