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.75k stars 261 forks source link

source lua files in `load_plugin` #1031

Open beardedsakimonkey opened 1 year ago

beardedsakimonkey commented 1 year ago

(This is a recreation of https://github.com/wbthomason/packer.nvim/pull/1030, which I accidentally closed by force pushing)

When installing packer from a clean slate[1], and running packer.sync() with config containing

use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })

I'd see the following error in my :messages (similar to https://github.com/wbthomason/packer.nvim/issues/897#issuecomment-1114244296):

[packer.nvim] [ERROR 20:50:19] async.lua:20: Error in coroutine: ...ack/packer/start/packer.nvim/lua/packer/plugin_utils.lua:236: Vim:E492: Not an editor command: TSUpdate

I think this is because nvim-treesitter sets up the :TSUpdate command in plugin/nvim-treesitter.lua and packer only sources .vim files when loading a plugin.

After making the change to also source .lua files, I no longer see the error message.

[1] rm -rf ~/.local/share/nvim/site/pack/packer && rm ~/.config/nvim/plugin/packer_compiled.lua