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

fix: load plugin/ in autocmds before 'loadplugins' #46

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

lewis6991
Copy link
Owner

@lewis6991 lewis6991 commented Dec 3, 2024

No description provided.

@lewis6991 lewis6991 mentioned this pull request Dec 3, 2024
@lewis6991 lewis6991 force-pushed the fix/pluginloadplugin branch 2 times, most recently from 51fc627 to 9881ba7 Compare December 3, 2024 14:52
@lewis6991 lewis6991 changed the title fix/pluginloadplugin fix: load plugin/ in autocmds before 'loadplugins' Dec 3, 2024
@lewis6991 lewis6991 force-pushed the fix/pluginloadplugin branch 2 times, most recently from 5416a69 to cba3d33 Compare December 3, 2024 14:54
@lewis6991 lewis6991 linked an issue Dec 3, 2024 that may be closed by this pull request
@lewis6991 lewis6991 force-pushed the fix/pluginloadplugin branch from cba3d33 to a59b262 Compare December 3, 2024 14:58
@lewis6991 lewis6991 merged commit 23fd6a0 into main Dec 9, 2024
6 checks passed
@zeertzjq
Copy link

zeertzjq commented Dec 9, 2024

This change breaks plugins that are configured via global variables. Now pckr.nvim must be loaded after the global variables are set.

@lewis6991
Copy link
Owner Author

lewis6991 commented Dec 9, 2024

Sorry I don't understand. I load pckr before plugin/ is loaded. The variable is just used to signal when plugin/* is sourced during initialisation instead of using VimEnter which happens later.

@zeertzjq
Copy link

Sorry, it seems that the breakage I observed came from something else.

@lewis6991
Copy link
Owner Author

Ok. Do you have any more details?

@zeertzjq
Copy link

Hmm, it seems that the behavior of pckr.nvim hasn't changed, but I somehow just noticed that pckr.nvim loads plugin/ from the packages immediately after require('pckr').add().

@lewis6991
Copy link
Owner Author

Only if run pckr after initialisation, otherwise when else would you load plugin/? I've tried to make sure to follow the semantics of :packadd as close as possible.

@lewis6991 lewis6991 deleted the fix/pluginloadplugin branch December 10, 2024 09:25
@zeertzjq
Copy link

zeertzjq commented Dec 10, 2024

Hmm, it seems to do that in init.lua as well. With the following init.lua:

local function bootstrap_pckr()
  local pckr_path = vim.fn.stdpath("data") .. "/pckr/pckr.nvim"

  if not (vim.uv or vim.loop).fs_stat(pckr_path) then
    vim.fn.system({
      'git',
      'clone',
      "--filter=blob:none",
      'https://github.com/lewis6991/pckr.nvim',
      pckr_path
    })
  end

  vim.opt.rtp:prepend(pckr_path)
end

bootstrap_pckr()

print(vim.g.undotree_DiffCommand)
require('pckr').add{
  { 'mbbill/undotree', start = true },
}
print(vim.g.undotree_DiffCommand)

It prints:

nil
diff

which means calling require('pckr').add() loads the plugin/ directories.

@lewis6991
Copy link
Owner Author

Looks like a bug with start = true.

@lewis6991
Copy link
Owner Author

lewis6991 commented Dec 10, 2024

This behaviour is caused by do_loadplugins() in pckr/loader.lua. You can disable this by setting _native_loadplugins = true.

I implemented a custom loadplugins behaviour because the built-in implementation was slow. However I think I might have resolved this in neovim/neovim#24191

Need to re-assess if it is still necessary. #49

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.

plugin/* not loaded when nvim {file}
2 participants