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.74k stars 262 forks source link

loading conditional plugins break sequencing #865

Open ifplusor opened 2 years ago

ifplusor commented 2 years ago

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.6.1/share/nvim"

Run :checkhealth for more info

- `git --version`: git version 2.35.1
- Operating system/version: macOS 12.3.1 21E258 arm64
- Terminal name/version: iTerm2

### Steps to reproduce

```txt
:PackerCompile

Actual behaviour

load null-ls.nvim after nvim-lsp-installer, load nvim-lspconfig after null-ls.nvim.

Expected behaviour

load nvim-lspconfig before null-ls.nvim, load null-ls.nvim before nvim-lsp-installer.

packer files

Plugin specification file(s) ```lua use({ "neovim/nvim-lspconfig", event = { "VimEnter", "BufWinEnter", "BufRead", "BufNewFile", }, cond = not_run_in_vscode, }) use({ "jose-elias-alvarez/null-ls.nvim", after = "nvim-lspconfig", requires = { "nvim-lua/plenary.nvim" }, config = function() require("plugins.programming.null-ls").setup() end, cond = not_run_in_vscode, }) use({ "williamboman/nvim-lsp-installer", after = { "nvim-lspconfig", "null-ls.nvim", "cmp-nvim-lsp" }, requires = { "neovim/nvim-lspconfig", { "hrsh7th/cmp-nvim-lsp", opt = true } }, config = function() require("plugins.programming.nvim-lsp-installer").setup() end, cond = not_run_in_vscode, }) ```
packer compiled file ```lua -- Automatically generated packer.nvim plugin loader code if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') return end vim.api.nvim_command('packadd packer.nvim') local no_errors, error_msg = pcall(function() local time local profile_info local should_profile = false 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/james/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/james/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/james/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/james/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" local install_cpath_pattern = "/Users/james/.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), name, _G.packer_plugins[name]) 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 = { ["AutoSave.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nD\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\27plugins.tools.autosave\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/AutoSave.nvim", url = "https://github.com/Pocco81/AutoSave.nvim" }, LuaSnip = { after = { "nvim-cmp" }, cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nI\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup plugins.programming.luasnip\frequire\0" }, loaded = false, needs_bufread = true, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/LuaSnip", url = "https://github.com/L3MON4D3/LuaSnip" }, ["bufferline.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nC\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\26plugins.ui.bufferline\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/bufferline.nvim", url = "https://github.com/akinsho/bufferline.nvim" }, ["cmp-buffer"] = { after_files = { "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-buffer/after/plugin/cmp_buffer.lua" }, loaded = false, needs_bufread = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-buffer", url = "https://github.com/hrsh7th/cmp-buffer" }, ["cmp-cmdline"] = { after_files = { "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-cmdline/after/plugin/cmp_cmdline.lua" }, loaded = false, needs_bufread = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-cmdline", url = "https://github.com/hrsh7th/cmp-cmdline" }, ["cmp-nvim-lsp"] = { after = { "nvim-lsp-installer" }, after_files = { "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua" }, cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp", url = "https://github.com/hrsh7th/cmp-nvim-lsp" }, ["cmp-path"] = { after_files = { "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-path/after/plugin/cmp_path.lua" }, loaded = false, needs_bufread = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp-path", url = "https://github.com/hrsh7th/cmp-path" }, cmp_luasnip = { after_files = { "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp_luasnip/after/plugin/cmp_luasnip.lua" }, loaded = false, needs_bufread = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/cmp_luasnip", url = "https://github.com/saadparwaiz1/cmp_luasnip" }, ["gitsigns.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nE\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\28plugins.editor.gitsigns\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/gitsigns.nvim", url = "https://github.com/lewis6991/gitsigns.nvim" }, ["indent-blankline.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nM\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup$plugins.editor.indent-blankline\frequire\0" }, loaded = false, needs_bufread = false, only_cond = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/indent-blankline.nvim", url = "https://github.com/lukas-reineke/indent-blankline.nvim" }, ["litee.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nB\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\25plugins.ui.litee.lib\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/litee.nvim", url = "https://github.com/ldelossa/litee.nvim" }, ["lsp_signature.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nO\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup&plugins.programming.lsp_signature\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/lsp_signature.nvim", url = "https://github.com/ray-x/lsp_signature.nvim" }, ["lspkind-nvim"] = { loaded = true, path = "/Users/james/.local/share/nvim/site/pack/packer/start/lspkind-nvim", url = "https://github.com/onsails/lspkind-nvim" }, ["lualine.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\23plugins.ui.lualine\frequire\0" }, loaded = false, needs_bufread = false, only_cond = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/lualine.nvim", url = "https://github.com/nvim-lualine/lualine.nvim" }, ["null-ls.nvim"] = { after = { "nvim-lsp-installer" }, cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nI\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup plugins.programming.null-ls\frequire\0" }, load_after = { ["nvim-lspconfig"] = true }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/null-ls.nvim", url = "https://github.com/jose-elias-alvarez/null-ls.nvim" }, ["nvim-base16"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nD\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\27plugins.ui.nvim-base16\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-base16", url = "https://github.com/RRethy/nvim-base16" }, ["nvim-cmp"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nJ\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup!plugins.programming.nvim-cmp\frequire\0" }, load_after = { LuaSnip = true }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-cmp", url = "https://github.com/hrsh7th/nvim-cmp" }, ["nvim-comment"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nN\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup%plugins.programming.nvim-comment\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-comment", url = "https://github.com/terrortylor/nvim-comment" }, ["nvim-lsp-installer"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nT\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup+plugins.programming.nvim-lsp-installer\frequire\0" }, load_after = { ["cmp-nvim-lsp"] = true, ["null-ls.nvim"] = true, ["nvim-lspconfig"] = true }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-lsp-installer", url = "https://github.com/williamboman/nvim-lsp-installer" }, ["nvim-lspconfig"] = { after = { "nvim-lsp-installer", "null-ls.nvim" }, cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, loaded = false, needs_bufread = false, only_cond = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, ["nvim-tree.lua"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nB\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\25plugins.ui.nvim-tree\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua", url = "https://github.com/kyazdani42/nvim-tree.lua" }, ["nvim-treesitter"] = { after = { "nvim-treesitter-textobjects", "playground" }, commands = { "TSInstall", "TSInstallSync", "TSBufEnable", "TSBufToggle", "TSEnableAll", "TSInstallFromGrammer", "TSToggleAll", "TSUpdate", "TSUpdateSync" }, cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nQ\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup(plugins.programming.nvim-treesitter\frequire\0" }, loaded = false, needs_bufread = true, only_cond = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" }, ["nvim-treesitter-textobjects"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, load_after = { ["nvim-treesitter"] = true }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects", url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" }, ["nvim-web-devicons"] = { loaded = false, needs_bufread = false, only_cond = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", url = "https://github.com/kyazdani42/nvim-web-devicons" }, ["packer.nvim"] = { loaded = false, needs_bufread = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/packer.nvim", url = "https://github.com/wbthomason/packer.nvim" }, playground = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, load_after = { ["nvim-treesitter"] = true }, loaded = false, needs_bufread = true, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/playground", url = "https://github.com/nvim-treesitter/playground" }, ["plenary.nvim"] = { loaded = true, path = "/Users/james/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, ["project.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\n>\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\17project_nvim\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/project.nvim", url = "https://github.com/ahmedkhalf/project.nvim" }, ["stabilize.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nF\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\29plugins.editor.stabilize\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/stabilize.nvim", url = "https://github.com/luukvbaal/stabilize.nvim" }, ["telescope-fzf-native.nvim"] = { cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim", url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" }, ["telescope.nvim"] = { commands = { "Telescope" }, cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nE\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\28plugins.tools.telescope\frequire\0" }, keys = { { "", "" }, { "", "" }, { "", "" }, { "", "" }, { "", "" }, { "", "" } }, load_after = { ["trouble.nvim"] = true }, loaded = false, needs_bufread = true, only_cond = false, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/telescope.nvim", url = "https://github.com/nvim-telescope/telescope.nvim" }, ["trouble.nvim"] = { after = { "telescope.nvim" }, cond = { "\27LJ\2\n(\0\0\1\0\3\0\0056\0\0\0009\0\1\0009\0\2\0\19\0\0\0L\0\2\0\vvscode\6g\bvim\0" }, config = { "\27LJ\2\nC\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\26plugins.tools.trouble\frequire\0" }, loaded = false, needs_bufread = false, only_cond = true, path = "/Users/james/.local/share/nvim/site/pack/packer/opt/trouble.nvim", url = "https://github.com/folke/trouble.nvim" } } time([[Defining packer_plugins]], false) -- Conditional loads time([[Conditional loading of trouble.nvim]], true) require("packer.load")({"trouble.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of trouble.nvim]], false) time([[Conditional loading of gitsigns.nvim]], true) require("packer.load")({"gitsigns.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of gitsigns.nvim]], false) time([[Conditional loading of nvim-cmp]], true) require("packer.load")({"nvim-cmp"}, {}, _G.packer_plugins) time([[Conditional loading of nvim-cmp]], false) time([[Conditional loading of nvim-comment]], true) require("packer.load")({"nvim-comment"}, {}, _G.packer_plugins) time([[Conditional loading of nvim-comment]], false) time([[Conditional loading of bufferline.nvim]], true) require("packer.load")({"bufferline.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of bufferline.nvim]], false) time([[Conditional loading of nvim-treesitter-textobjects]], true) require("packer.load")({"nvim-treesitter-textobjects"}, {}, _G.packer_plugins) time([[Conditional loading of nvim-treesitter-textobjects]], false) time([[Conditional loading of litee.nvim]], true) require("packer.load")({"litee.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of litee.nvim]], false) time([[Conditional loading of lsp_signature.nvim]], true) require("packer.load")({"lsp_signature.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of lsp_signature.nvim]], false) time([[Conditional loading of nvim-tree.lua]], true) require("packer.load")({"nvim-tree.lua"}, {}, _G.packer_plugins) time([[Conditional loading of nvim-tree.lua]], false) time([[Conditional loading of project.nvim]], true) require("packer.load")({"project.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of project.nvim]], false) time([[Conditional loading of stabilize.nvim]], true) require("packer.load")({"stabilize.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of stabilize.nvim]], false) time([[Conditional loading of cmp-nvim-lsp]], true) require("packer.load")({"cmp-nvim-lsp"}, {}, _G.packer_plugins) time([[Conditional loading of cmp-nvim-lsp]], false) time([[Conditional loading of nvim-lsp-installer]], true) require("packer.load")({"nvim-lsp-installer"}, {}, _G.packer_plugins) time([[Conditional loading of nvim-lsp-installer]], false) time([[Conditional loading of AutoSave.nvim]], true) require("packer.load")({"AutoSave.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of AutoSave.nvim]], false) time([[Conditional loading of telescope-fzf-native.nvim]], true) require("packer.load")({"telescope-fzf-native.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of telescope-fzf-native.nvim]], false) time([[Conditional loading of null-ls.nvim]], true) require("packer.load")({"null-ls.nvim"}, {}, _G.packer_plugins) time([[Conditional loading of null-ls.nvim]], false) time([[Conditional loading of LuaSnip]], true) require("packer.load")({"LuaSnip"}, {}, _G.packer_plugins) time([[Conditional loading of LuaSnip]], false) time([[Conditional loading of nvim-base16]], true) require("packer.load")({"nvim-base16"}, {}, _G.packer_plugins) time([[Conditional loading of nvim-base16]], false) time([[Conditional loading of playground]], true) require("packer.load")({"playground"}, {}, _G.packer_plugins) time([[Conditional loading of playground]], false) -- Load plugins in order defined by `after` time([[Sequenced loading]], true) vim.cmd [[ packadd lspkind-nvim ]] time([[Sequenced loading]], false) -- Command lazy-loads time([[Defining lazy-load commands]], true) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSInstall lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSInstall", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSInstallSync lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSInstallSync", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSBufEnable lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSBufEnable", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSBufToggle lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSBufToggle", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSEnableAll lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSEnableAll", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSInstallFromGrammer lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSInstallFromGrammer", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSToggleAll lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSToggleAll", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSUpdate lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSUpdate", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TSUpdateSync lua require("packer.load")({'nvim-treesitter'}, { cmd = "TSUpdateSync", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Telescope lua require("packer.load")({'telescope.nvim'}, { cmd = "Telescope", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) time([[Defining lazy-load commands]], false) -- Keymap lazy-loads time([[Defining lazy-load keymaps]], true) vim.cmd [[noremap lua require("packer.load")({'telescope.nvim'}, { keys = "M-F>", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap lua require("packer.load")({'telescope.nvim'}, { keys = "M-t>", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap lua require("packer.load")({'telescope.nvim'}, { keys = "M-O>", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap lua require("packer.load")({'telescope.nvim'}, { keys = "M-P>", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap lua require("packer.load")({'telescope.nvim'}, { keys = "M-f>", prefix = "" }, _G.packer_plugins)]] vim.cmd [[noremap lua require("packer.load")({'telescope.nvim'}, { keys = "M-p>", 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 BufNewFile * ++once lua require("packer.load")({'indent-blankline.nvim', 'lualine.nvim', 'nvim-treesitter', 'nvim-lspconfig'}, { event = "BufNewFile *" }, _G.packer_plugins)]] vim.cmd [[au BufEnter * ++once lua require("packer.load")({'nvim-web-devicons'}, { event = "BufEnter *" }, _G.packer_plugins)]] vim.cmd [[au BufWinEnter * ++once lua require("packer.load")({'nvim-lspconfig'}, { event = "BufWinEnter *" }, _G.packer_plugins)]] vim.cmd [[au VimEnter * ++once lua require("packer.load")({'indent-blankline.nvim', 'lualine.nvim', 'nvim-lspconfig'}, { event = "VimEnter *" }, _G.packer_plugins)]] vim.cmd [[au BufRead * ++once lua require("packer.load")({'indent-blankline.nvim', 'lualine.nvim', 'nvim-treesitter', 'nvim-lspconfig'}, { event = "BufRead *" }, _G.packer_plugins)]] time([[Defining lazy-load event autocommands]], false) vim.cmd("augroup END") if should_profile then save_profiles() end end) if not no_errors then error_msg = error_msg:gsub('"', '\\"') vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') end ```
milanglacier commented 2 years ago

I remember that the after argument should receive a table of tables rather than a table of strings.

By the way, I find that manage two runtimes in packer is way more complicated.

Sometimes the logical connections between different specification is unclear (i.e when there are multiple lazy-loading arguments, especially cond + event, cond + after, etc) it is really a mess to know what on earth will be the event to trigger the plugins to be loaded.

I am thinking about doing it in another way: let compile_path being not in plugin/folder, so it will be not automatically sourced, and put it into another directory and require it in init.lua. And write another config for vscode and generate another compiled file and require it depending on the condition.

ifplusor commented 2 years ago

In README, after argument receive a string or a list of table. IMO, check required plugins is easy before loading specific plugin.

ljani commented 2 years ago

Here's my workaround, if anybody needs it:

local lsp_setup = function()
    local required_plugins = { "nvim-lsp-installer", "nvim-lspconfig", }

    for _, name in ipairs(required_plugins) do
        local plugin = _G.packer_plugins[name]
        if plugin == nil or not plugin.loaded then
            return
        end
    end

    require("nvim-lsp-installer").setup {}
    local lspconfig = require("lspconfig")

    -- ...
end

use {
    "williamboman/nvim-lsp-installer",
    cond = is_nvim,
    config = lsp_setup,
}

use {
    "neovim/nvim-lspconfig",
    cond = is_nvim,
    config = lsp_setup,
}