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

Behavior of passing a function to `config` does not match using `.config/nvim/after/plugin/foo.lua`

Open starptr opened this issue 2 years ago • 1 comments

  • nvim --version: v0.8.1
  • git --version: 2.37.1
  • Operating system/version: macOS latest (osx 13.1)
  • Terminal name/version: alacritty 0.11.0

Steps to reproduce

Use the which-key plugin. When configuring, place

local wk = require("which-key")
wk.setup()
wk.register(mappings, opts)

in packer.nvim's config field first as a function, then inside the config after directory.

Actual behaviour

Which-key doesn't work when using packer's config field.

Expected behaviour

Which-key should work, or packer.nvim should document why the config field has a different behavior.

packer files

Plugin specification file(s)

Post or link your plugin specification files here, if you aren't able to provide a minimal reproducer

packer log file

Post the contents of ~/.cache/nvim/packer.nvim.log here

packer compiled file

Post the contents of packer_compiled.vim here

starptr avatar Dec 23 '22 09:12 starptr

Similar issue using https://github.com/airblade/vim-rooter. Doing vim.cmd('echo g:rooter_patterns') in after/plugin works fine, but doing it either as a string or inside a function for the config gives me an error that the variable is not yet initialized.

MithicSpirit avatar Apr 30 '23 04:04 MithicSpirit