Skip to content

fix(setup): detect whether plugin is loaded with global variable#301

Merged
linrongbin16 merged 2 commits intomasterfrom
plugin-loaded
Apr 7, 2026
Merged

fix(setup): detect whether plugin is loaded with global variable#301
linrongbin16 merged 2 commits intomasterfrom
plugin-loaded

Conversation

@linrongbin16
Copy link
Copy Markdown
Owner

Close #299 , #300

Adds a global variable vim.g.loaded_gitlinker to indicate whether this plugin is already initialized.

Hi @pirey, could you try this PR, see if it works for you?

Test Platforms

  • windows
  • macOS
  • linux

Test Hosts

Test Functions

  • Use GitLink(!) to copy git link (or open in browser).
  • Use GitLink(!) blame to copy the /blame link (or open in browser).
  • Use GitLink(!) default_branch to open the /main//master link in browser (or open in browser).
  • Use GitLink(!) current_branch to open the current branch link in browser (or open in browser).
  • Copy git link in a symlink directory of git repo.
  • Copy git link in an un-pushed git branch, and receive an expected error.
  • Copy git link in a pushed git branch but edited file, and receive a warning says the git link could be wrong.
  • Copy git link with 'file' and 'rev' parameters.

pirey and others added 2 commits April 6, 2026 20:51
…guration

The plugin automatically calls setup() in @plugin/gitlinker.lua without
arguments. If users also call setup() with custom router configs in
their Neovim config, the plugin-level call runs AFTER and overwrites
the user's configuration.

Fix by adding early return in configs.setup() if Configs is already
initialized.
@linrongbin16 linrongbin16 merged commit d7adb5e into master Apr 7, 2026
5 checks passed
@linrongbin16 linrongbin16 deleted the plugin-loaded branch April 7, 2026 02:03
@pirey
Copy link
Copy Markdown

pirey commented Apr 7, 2026

I tried it and it works now.
thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: setup() called in plugin/ overrides user's custom router configuration

2 participants