wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.89k stars 264 forks source link

Handlers are not being invoked on `packer.startup` after #331 #405

Open dhruvmanila opened 3 years ago

dhruvmanila commented 3 years ago

Steps to reproduce

Here's the gist of what's happening in my config:

In init.lua:

require("core.plugins")

In core/plugins.lua:

-- install packer if not found

-- Extending packer.nvim to store plugin info to be used by
-- :Telescope packer_plugins
packer.set_handler("type", function(_, plugin, type)
  -- ...
end)

packer.startup {
  function(use)
    -- plugin specifications
  end
}

Actual behaviour

Before this commit (8596be799f4068f30721f982195ce5703fd912f0), the handler would be called every time I open Neovim and thus can be used by Telescope right away. After that commit, the handler is not being called. Although, if I run any of the Packer... commands, the handler is being called.

Expected behaviour

The handler should be called even on packer.startup

packer files

Plugin specification file(s) Post or link your plugin specification files here, if you aren't able to provide a minimal reproducer Link: https://github.com/dhruvmanila/dotfiles/blob/master/config/nvim/lua/core/plugins.lua
packer log file Post the contents of ~/.cache/nvim/packer.nvim.log here Here are the logs where I tried fixing the plugin at commit df0f740b97c0f1baeb08daa659a221b8eb2f5d6b and then at 8596be799f4068f30721f982195ce5703fd912f0. ``` [INFO Mon Jun 14 18:48:18 2021] .../site/pack/packer/start/packer.nvim/lua/packer/clean.lua:79: Already clean! [DEBUG Mon Jun 14 18:48:20 2021] ...site/pack/packer/start/packer.nvim/lua/packer/update.lua:80: Updated hrsh7th/nvim-compe: { err = {}, messages = { "79c9af4 Fix #395 (51 minutes ago)" }, output = { "remote: Enumerating objects: 131, done. \nremote: Counting objects: 1% (1/93) \rremote: Counting objects: 2% (2/93) \rremote: Counting objects: 3% (3/93) \rremote: Counting objects: 4% (4/93) \rremote: Counting objects: 5% (5/93) \rremote: Counting objects: 6% (6/93) \rremote: Counting objects: 7% (7/93) \rremote: Counting objects: 8% (8/93) \rremote: Counting objects: 9% (9/93) \rremote: Counting objects: 10% (10/93) \rremote: Counting objects: 11% (11/93) \rremote: Counting objects: 12% (12/93) \rremote: Counting objects: 13% (13/93) \rremote: Counting objects: 15% (14/93) \rremote: Counting objects: 16% (15/93) \rremote: Counting objects: 17% (16/93) \rremote: Counting objects: 18% (17/93) \rremote: Counting objects: 19% (18/93) \rremote: Counting objects: 20% (19/93) \rremote: Counting objects: 21% (20/93) \rremote: Counting objects: 22% (21/93) \rremote: Counting objects: 23% (22/93) \rremote: Counting objects: 24% (23/93) \rremote: Counting objects: 25% (24/93) \rremote: Counting objects: 26% (25/93) \rremote: Counting objects: 27% (26/93) \rremote: Counting objects: 29% (27/93) \rremote: Counting objects: 30% (28/93) \rremote: Counting objects: 31% (29/93) \rremote: Counting objects: 32% (30/93) \rremote: Counting objects: 33% (31/93) \rremote: Counting objects: 34% (32/93) \rremote: Counting objects: 35% (33/93) \rremote: Counting objects: 36% (34/93) \rremote: Counting objects: 37% (35/93) \rremote: Counting objects: 38% (36/93) \rremote: Counting objects: 39% (37/93) \rremote: Counting objects: 40% (38/93) \rremote: Counting objects: 41% (39/93) \rremote: Counting objects: 43% (40/93) \rremote: Counting objects: 44% (41/93) \rremote: Counting objects: 45% (42/93) \rremote: Counting objects: 46% (43/93) \rremote: Counting objects: 47% (44/93) \rremote: Counting objects: 48% (45/93) \rremote: Counting objects: 49% (46/93) \rremote: Counting objects: 50% (47/93) \rremote: Counting objects: 51% (48/93) \rremote: Counting objects: 52% (49/93) \rremote: Counting objects: 53% (50/93) \rremote: Counting objects: 54% (51/93) \rremote: Counting objects: 55% (52/93) \rremote: Counting objects: 56% (53/93) \rremote: Counting objects: 58% (54/93) \rremote: Counting objects: 59% (55/93) \rremote: Counting objects: 60% (56/93) \rremote: Counting objects: 61% (57/93) \rremote: Counting objects: 62% (58/93) \rremote: Counting objects: 63% (59/93) \rremote: Counting objects: 64% (60/93) \rremote: Counting objects: 65% (61/93) \rremote: Counting objects: 66% (62/93) \rremote: Counting objects: 67% (63/93) \rremote: Counting objects: 68% (64/93) \rremote: Counting objects: 69% (65/93) \rremote: Counting objects: 70% (66/93) \rremote: Counting objects: 72% (67/93) \rremote: Counting objects: 73% (68/93) \rremote: Counting objects: 74% (69/93) \rremote: Counting objects: 75% (70/93) \rremote: Counting objects: 76% (71/93) \rremote: Counting objects: 77% (72/93) \rremote: Counting objects: 78% (73/93) \rremote: Counting objects: 79% (74/93) \rremote: Counting objects: 80% (75/93) \rremote: Counting objects: 81% (76/93) \rremote: Counting objects: 82% (77/93) \rremote: Counting objects: 83% (78/93) \rremote: Counting objects: 84% (79/93) \rremote: Counting objects: 86% (80/93) \rremote: Counting objects: 87% (81/93) \rremote: Counting objects: 88% (82/93) \rremote: Counting objects: 89% (83/93) \rremote: Counting objects: 90% (84/93) \rremote: Counting objects: 91% (85/93) \rremote: Counting objects: 92% (86/93) \rremote: Counting objects: 93% (87/93) \rremote: Counting objects: 94% (88/93) \rremote: Counting objects: 95% (89/93) \rremote: Counting objects: 96% (90/93) \rremote: Counting objects: 97% (91/93) \rremote: Counting objects: 98% (92/93) \rremote: Counting objects: 100% (93/93) \rremote: Counting objects: 100% (93/93), done. \nremote: Compressing objects: 33% (1/3) \rremote: Compressing objects: 66% (2/3) \rremote: Compressing objects: 100% (3/3) \rremote: Compressing objects: 100% (3/3), done. \nremote: Total 14 (delta 10), reused 14 (delta 10), pack-reused 0 \nFrom https://github.com/hrsh7th/nvim-compe\n 96fafb5..79c9af4 master -> origin/master", "Updating 96fafb5..79c9af4\nFast-forward\n autoload/compe.vim | 12 +++++++-----\n autoload/vital/_compe/VS/Vim/Buffer.vim | 3 +--\n autoload/vital/_compe/VS/Vim/Window.vim | 11 +++++++++++\n lua/compe/completion.lua | 15 +++++++++------\n lua/compe/init.lua | 4 ++--\n 5 files changed, 30 insertions(+), 15 deletions(-)" }, revs = { "96fafb5", "79c9af4" } } [DEBUG Mon Jun 14 18:48:20 2021] ...site/pack/packer/start/packer.nvim/lua/packer/update.lua:80: Updated wbthomason/packer.nvim: { err = {}, messages = { "4012bd4 fix(README.md): refer to the correct noautocmd PR (#404) (18 hours ago)", "f9b484f compile.lua: better error messages when nil (#329) (22 hours ago)\n8596be7 Refactor: decrease cost of requiring main module (#331) (2 days ago)" }, output = { "Note: switching to 'df0f740b97c0f1baeb08daa659a221b8eb2f5d6b'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by switching back to a branch.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -c with the switch command. Example:\n\n git switch -c \n\nOr undo this operation with:\n\n git switch -\n\nTurn off this advice by setting config variable advice.detachedHead to false\n\nHEAD is now at df0f740 Feature: allow run key to be a table of mixed types of hook (#364)", "remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0" }, revs = { "4012bd4", "df0f740" } } [INFO Mon Jun 14 18:48:20 2021] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:565: Finished compiling lazy-loaders! [INFO Mon Jun 14 18:48:38 2021] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:316: All configured plugins are installed [INFO Mon Jun 14 18:48:43 2021] .../site/pack/packer/start/packer.nvim/lua/packer/clean.lua:79: Already clean! [INFO Mon Jun 14 18:48:49 2021] .../site/pack/packer/start/packer.nvim/lua/packer/clean.lua:79: Already clean! [INFO Mon Jun 14 18:49:02 2021] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:565: Finished compiling lazy-loaders! [INFO Mon Jun 14 18:50:10 2021] .../site/pack/packer/start/packer.nvim/lua/packer/clean.lua:79: Already clean! [DEBUG Mon Jun 14 18:50:13 2021] ...site/pack/packer/start/packer.nvim/lua/packer/update.lua:80: Updated wbthomason/packer.nvim: { err = {}, messages = { "8596be7 Refactor: decrease cost of requiring main module (#331) (2 days ago)" }, output = { "Previous HEAD position was df0f740 Feature: allow run key to be a table of mixed types of hook (#364)\nHEAD is now at 8596be7 Refactor: decrease cost of requiring main module (#331)", "remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0" }, revs = { "df0f740", "8596be7" } } [INFO Mon Jun 14 18:50:32 2021] .../site/pack/packer/start/packer.nvim/lua/packer/clean.lua:79: Already clean! [DEBUG Mon Jun 14 18:50:34 2021] ...site/pack/packer/start/packer.nvim/lua/packer/update.lua:80: Updated wbthomason/packer.nvim: { err = {}, messages = { "4012bd4 fix(README.md): refer to the correct noautocmd PR (#404) (18 hours ago)\nf9b484f compile.lua: better error messages when nil (#329) (22 hours ago)" }, output = { "Your branch is up to date with 'origin/master'.", "Previous HEAD position was 8596be7 Refactor: decrease cost of requiring main module (#331)\nSwitched to branch 'master'", "Already up to date." }, revs = { "8596be7", "4012bd4" } } [INFO Mon Jun 14 18:50:35 2021] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:565: Finished compiling lazy-loaders! [INFO Mon Jun 14 18:58:10 2021] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:565: Finished compiling lazy-loaders! [INFO Mon Jun 14 18:58:43 2021] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:316: All configured plugins are installed [INFO Mon Jun 14 18:59:19 2021] .../site/pack/packer/start/packer.nvim/lua/packer/clean.lua:79: Already clean! [DEBUG Mon Jun 14 18:59:21 2021] ...site/pack/packer/start/packer.nvim/lua/packer/update.lua:80: Updated hrsh7th/nvim-compe: { err = {}, messages = { "9c123d6 Fix resolved item detection (9 minutes ago)" }, output = { "remote: Enumerating objects: 41, done. \nremote: Counting objects: 2% (1/38) \rremote: Counting objects: 5% (2/38) \rremote: Counting objects: 7% (3/38) \rremote: Counting objects: 10% (4/38) \rremote: Counting objects: 13% (5/38) \rremote: Counting objects: 15% (6/38) \rremote: Counting objects: 18% (7/38) \rremote: Counting objects: 21% (8/38) \rremote: Counting objects: 23% (9/38) \rremote: Counting objects: 26% (10/38) \rremote: Counting objects: 28% (11/38) \rremote: Counting objects: 31% (12/38) \rremote: Counting objects: 34% (13/38) \rremote: Counting objects: 36% (14/38) \rremote: Counting objects: 39% (15/38) \rremote: Counting objects: 42% (16/38) \rremote: Counting objects: 44% (17/38) \rremote: Counting objects: 47% (18/38) \rremote: Counting objects: 50% (19/38) \rremote: Counting objects: 52% (20/38) \rremote: Counting objects: 55% (21/38) \rremote: Counting objects: 57% (22/38) \rremote: Counting objects: 60% (23/38) \rremote: Counting objects: 63% (24/38) \rremote: Counting objects: 65% (25/38) \rremote: Counting objects: 68% (26/38) \rremote: Counting objects: 71% (27/38) \rremote: Counting objects: 73% (28/38) \rremote: Counting objects: 76% (29/38) \rremote: Counting objects: 78% (30/38) \rremote: Counting objects: 81% (31/38) \rremote: Counting objects: 84% (32/38) \rremote: Counting objects: 86% (33/38) \rremote: Counting objects: 89% (34/38) \rremote: Counting objects: 92% (35/38) \rremote: Counting objects: 94% (36/38) \rremote: Counting objects: 97% (37/38) \rremote: Counting objects: 100% (38/38) \rremote: Counting objects: 100% (38/38), done. \nremote: Compressing objects: 100% (1/1) \rremote: Compressing objects: 100% (1/1), done. \nremote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0 \nFrom https://github.com/hrsh7th/nvim-compe\n 79c9af4..9c123d6 master -> origin/master", "Updating 79c9af4..9c123d6\nFast-forward", "lua/compe/source.lua | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)" }, revs = { "79c9af4", "9c123d6" } } ```
packer compiled file Post the contents of `packer_compiled.vim` here ```vim " Automatically generated packer.nvim plugin loader code if !has('nvim-0.5') echohl WarningMsg echom "Invalid Neovim version for packer.nvim!" echohl None finish endif packadd packer.nvim try lua << END local time local profile_info local should_profile = true if should_profile then local hrtime = vim.loop.hrtime profile_info = {} time = function(chunk, start) if start then profile_info[chunk] = hrtime() else profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 end end else time = function(chunk, start) end end local function save_profiles(threshold) local sorted_times = {} for chunk_name, time_taken in pairs(profile_info) do sorted_times[#sorted_times + 1] = {chunk_name, time_taken} end table.sort(sorted_times, function(a, b) return a[2] > b[2] end) local results = {} for i, elem in ipairs(sorted_times) do if not threshold or threshold and elem[2] > threshold then results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' end end _G._packer = _G._packer or {} _G._packer.profile_output = results end time([[Luarocks path setup]], true) local package_path_str = "/Users/dhruvmanilawala/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/dhruvmanilawala/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/dhruvmanilawala/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/dhruvmanilawala/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" local install_cpath_pattern = "/Users/dhruvmanilawala/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" if not string.find(package.path, package_path_str, 1, true) then package.path = package.path .. ';' .. package_path_str end if not string.find(package.cpath, install_cpath_pattern, 1, true) then package.cpath = package.cpath .. ';' .. install_cpath_pattern end time([[Luarocks path setup]], false) time([[try_loadstring definition]], true) local function try_loadstring(s, component, name) local success, result = pcall(loadstring(s)) if not success then vim.schedule(function() vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) end) end return result end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { ["FixCursorHold.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim" }, ["applescript.vim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/applescript.vim" }, ["clever-f.vim"] = { loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/clever-f.vim" }, ["editorconfig-vim"] = { loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/editorconfig-vim" }, ["gitsigns.nvim"] = { config = { "require('plugin.gitsigns')" }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/gitsigns.nvim" }, ["gruvbox-material"] = { config = { "require('plugin.colorscheme')" }, loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/gruvbox-material" }, ["lir.nvim"] = { config = { "require('plugin.lir')" }, loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/lir.nvim" }, ["lsp-status.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/lsp-status.nvim" }, ["lsp_signature.nvim"] = { loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/lsp_signature.nvim" }, ["lua-dev.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/lua-dev.nvim" }, ["luv-vimdocs"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/luv-vimdocs" }, ["nvim-colorizer.lua"] = { config = { "\27LJ\2\n¡\1\0\0\6\0\n\0\0146\0\0\0009\0\1\0009\0\2\0'\2\3\0'\3\4\0'\4\5\0005\5\6\0B\0\5\0016\0\a\0'\2\b\0B\0\2\0029\0\t\0B\0\1\1K\0\1\0\nsetup\14colorizer\frequire\1\0\1\fnoremap\2\29ColorizerToggle\15cc\6n\20nvim_set_keymap\bapi\bvim\0" }, keys = { { "", "cc" } }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-colorizer.lua" }, ["nvim-compe"] = { after_files = { "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-compe/after/plugin/compe.vim" }, config = { "require('plugin.completion')" }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-compe" }, ["nvim-lightbulb"] = { loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-lightbulb" }, ["nvim-lint"] = { config = { "require('plugin.lint')" }, loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/nvim-lint" }, ["nvim-lspconfig"] = { config = { "require('plugin.lsp')" }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig" }, ["nvim-luaref"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/nvim-luaref" }, ["nvim-nonicons"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/nvim-nonicons" }, ["nvim-tree.lua"] = { config = { "require('plugin.nvim_tree')" }, keys = { { "", "" } }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua" }, ["nvim-treesitter"] = { after = { "nvim-treesitter-textobjects" }, config = { "require('plugin.treesitter')" }, loaded = false, needs_bufread = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-treesitter" }, ["nvim-treesitter-textobjects"] = { load_after = { ["nvim-treesitter"] = true }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects" }, ["nvim-web-devicons"] = { config = { "require('plugin.nvim_web_devicons')" }, loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/nvim-web-devicons" }, ["packer.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/packer.nvim" }, playground = { commands = { "TSPlaygroundToggle", "TSHighlightCapturesUnderCursor" }, loaded = false, needs_bufread = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/playground" }, ["plenary.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/plenary.nvim" }, ["popup.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/popup.nvim" }, ["requirements.txt.vim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/requirements.txt.vim" }, ["startuptime.vim"] = { commands = { "StartupTime" }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/startuptime.vim" }, ["telescope-bookmarks.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/telescope-bookmarks.nvim" }, ["telescope-fzf-native.nvim"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim" }, ["telescope.nvim"] = { config = { "require('plugin.telescope')" }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/telescope.nvim" }, ["tree-sitter-lua"] = { loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/tree-sitter-lua" }, ["vim-cheat40"] = { config = { "vim.g.cheat40_use_default = false" }, loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-cheat40" }, ["vim-commentary"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-commentary" }, ["vim-easy-align"] = { config = { "\27LJ\2\n”\1\0\0\a\0\b\0\0185\0\0\0006\1\1\0009\1\2\0019\1\3\1'\3\4\0'\4\5\0'\5\6\0\18\6\0\0B\1\5\0016\1\1\0009\1\2\0019\1\3\1'\3\a\0'\4\5\0'\5\6\0\18\6\0\0B\1\5\1K\0\1\0\6x\22(EasyAlign)\age\6n\20nvim_set_keymap\bapi\bvim\1\0\2\fnoremap\2\vsilent\2\0" }, keys = { { "", "ge" } }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/vim-easy-align" }, ["vim-eunuch"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-eunuch" }, ["vim-external"] = { config = { "require('plugin.vim_external')" }, loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-external" }, ["vim-fugitive"] = { config = { "require('plugin.fugitive')" }, loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-fugitive" }, ["vim-rooter"] = { loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/vim-rooter" }, ["vim-scriptease"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-scriptease" }, ["vim-slash"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-slash" }, ["vim-startify"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-startify" }, ["vim-toml"] = { loaded = true, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/start/vim-toml" }, ["vista.vim"] = { config = { "require('plugin.vista')" }, keys = { { "", "vv" } }, loaded = false, needs_bufread = false, path = "/Users/dhruvmanilawala/.local/share/nvim/site/pack/packer/opt/vista.vim" } } time([[Defining packer_plugins]], false) -- Setup for: vim-rooter time([[Setup for vim-rooter]], true) try_loadstring("\27LJ\2\nÁ\1\0\0\2\0\b\0\0176\0\0\0009\0\1\0'\1\3\0=\1\2\0006\0\0\0009\0\1\0)\1\0\0=\1\4\0006\0\0\0009\0\1\0)\1\1\0=\1\5\0006\0\0\0009\0\1\0005\1\a\0=\1\6\0K\0\1\0\1\4\0\0\t.git\rMakefile\23*requirements*.txt\20rooter_patterns\25rooter_resolve_links\24rooter_silent_chdir\blcd\18rooter_cd_cmd\6g\bvim\0", "setup", "vim-rooter") time([[Setup for vim-rooter]], false) time([[packadd for vim-rooter]], true) vim.cmd [[packadd vim-rooter]] time([[packadd for vim-rooter]], false) -- Setup for: editorconfig-vim time([[Setup for editorconfig-vim]], true) try_loadstring("\27LJ\2\nÃ\1\0\0\2\0\a\0\r6\0\0\0009\0\1\0005\1\3\0=\1\2\0006\0\0\0009\0\1\0'\1\5\0=\1\4\0006\0\0\0009\0\1\0)\1\1\0=\1\6\0K\0\1\0(EditorConfig_preserve_formatoptions\tnone$EditorConfig_max_line_indicator\1\3\0\0\18fugitive://.*\rscp://.*\"EditorConfig_exclude_patterns\6g\bvim\0", "setup", "editorconfig-vim") time([[Setup for editorconfig-vim]], false) time([[packadd for editorconfig-vim]], true) vim.cmd [[packadd editorconfig-vim]] time([[packadd for editorconfig-vim]], false) -- Setup for: clever-f.vim time([[Setup for clever-f.vim]], true) try_loadstring("\27LJ\2\n´\1\0\0\2\0\a\0\0176\0\0\0009\0\1\0)\1\1\0=\1\2\0006\0\0\0009\0\1\0)\1\1\0=\1\3\0006\0\0\0009\0\1\0)\1\1\0=\1\4\0006\0\0\0009\0\1\0'\1\6\0=\1\5\0K\0\1\0\a;:#clever_f_chars_match_any_signs\25clever_f_show_prompt\24clever_f_smart_case\28clever_f_across_no_line\6g\bvim\0", "setup", "clever-f.vim") time([[Setup for clever-f.vim]], false) time([[packadd for clever-f.vim]], true) vim.cmd [[packadd clever-f.vim]] time([[packadd for clever-f.vim]], false) -- Config for: vim-fugitive time([[Config for vim-fugitive]], true) require('plugin.fugitive') time([[Config for vim-fugitive]], false) -- Config for: lir.nvim time([[Config for lir.nvim]], true) require('plugin.lir') time([[Config for lir.nvim]], false) -- Config for: nvim-lint time([[Config for nvim-lint]], true) require('plugin.lint') time([[Config for nvim-lint]], false) -- Config for: vim-cheat40 time([[Config for vim-cheat40]], true) vim.g.cheat40_use_default = false time([[Config for vim-cheat40]], false) -- Config for: nvim-web-devicons time([[Config for nvim-web-devicons]], true) require('plugin.nvim_web_devicons') time([[Config for nvim-web-devicons]], false) -- Config for: gruvbox-material time([[Config for gruvbox-material]], true) require('plugin.colorscheme') time([[Config for gruvbox-material]], false) -- Config for: vim-external time([[Config for vim-external]], true) require('plugin.vim_external') time([[Config for vim-external]], false) -- Command lazy-loads time([[Defining lazy-load commands]], true) vim.cmd [[command! -nargs=* -range -bang -complete=file StartupTime lua require("packer.load")({'startuptime.vim'}, { cmd = "StartupTime", l1 = , l2 = , bang = , args = }, _G.packer_plugins)]] vim.cmd [[command! -nargs=* -range -bang -complete=file TSPlaygroundToggle lua require("packer.load")({'playground'}, { cmd = "TSPlaygroundToggle", l1 = , l2 = , bang = , args = }, _G.packer_plugins)]] vim.cmd [[command! -nargs=* -range -bang -complete=file TSHighlightCapturesUnderCursor lua require("packer.load")({'playground'}, { cmd = "TSHighlightCapturesUnderCursor", l1 = , l2 = , bang = , args = }, _G.packer_plugins)]] time([[Defining lazy-load commands]], false) -- Keymap lazy-loads time([[Defining lazy-load keymaps]], true) vim.cmd [[noremap cc lua require("packer.load")({'nvim-colorizer.lua'}, { keys = "Leader>cc", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap lua require("packer.load")({'nvim-tree.lua'}, { keys = "C-n>", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap vv lua require("packer.load")({'vista.vim'}, { keys = "Leader>vv", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap ge lua require("packer.load")({'vim-easy-align'}, { keys = "ge", prefix = "" }, _G.packer_plugins)]] time([[Defining lazy-load keymaps]], false) vim.cmd [[augroup packer_load_aucmds]] vim.cmd [[au!]] -- Event lazy-loads time([[Defining lazy-load event autocommands]], true) vim.cmd [[au BufReadPre * ++once lua require("packer.load")({'nvim-lspconfig', 'gitsigns.nvim'}, { event = "BufReadPre *" }, _G.packer_plugins)]] vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter'}, { event = "BufRead *" }, _G.packer_plugins)]] vim.cmd [[au InsertEnter * ++once lua require("packer.load")({'nvim-compe'}, { event = "InsertEnter *" }, _G.packer_plugins)]] vim.cmd [[au BufNewFile * ++once lua require("packer.load")({'gitsigns.nvim', 'nvim-treesitter'}, { event = "BufNewFile *" }, _G.packer_plugins)]] vim.cmd [[au VimEnter * ++once lua require("packer.load")({'telescope.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]] time([[Defining lazy-load event autocommands]], false) vim.cmd("augroup END") if should_profile then save_profiles(0) end END catch echohl ErrorMsg echom "Error in packer_compiled: " .. v:exception echom "Please check your config for correctness" echohl None endtry ```
wbthomason commented 3 years ago

Cool, thanks for the report! I think you might be the first person I've encountered actually using the extensible handlers feature.

This is expected with #331, because I did not expect people to use handlers like this - I had in mind that a handler would do something at install/update time, and that anything that needed to be done at startup time would be in a setup/config key.

After #402, your use case will work again. Until then, we could hack in a shim to run handlers before fully managing plugins (see https://github.com/wbthomason/packer.nvim/commit/8596be799f4068f30721f982195ce5703fd912f0#diff-bae1764133e447f91f3c4ad4892840c0862259c0a2cdfde9b84dc264e72547edR255-R261), or you could perhaps work around this with a setup function generator (though this is, I admit, a clunky workaround). What do you think?

dhruvmanila commented 3 years ago

This is expected with #331, because I did not expect people to use handlers like this - I had in mind that a handler would do something at install/update time, and that anything that needed to be done at startup time would be in a setup/config key.

Ah, right that makes sense although my use case is somewhat different. I was looking for plugin information specifically URL, full repository name and installed location and most of that was not present in packer_plugins global variable, but then I found this feature in the docs and so I thought to use it like this :)

After #402, your use case will work again. Until then, we could hack in a shim to run handlers before fully managing plugins (see 8596be7#diff-bae1764133e447f91f3c4ad4892840c0862259c0a2cdfde9b84dc264e72547edR255-R261), or you could perhaps work around this with a setup function generator (though this is, I admit, a clunky workaround). What do you think?

I don't understand how would we run handlers before managing plugins as the handler requires the information you're storing for each plugin in the manage function such as type, install_path, short_name, etc.

I do see that the manage_all_plugins function is exposed through a private variable __manage_all and calling that at the end of plugins.lua file fixes the problem although I anticipate this should not be used.