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.88k stars 265 forks source link

Don't load on certain filetypes #869

Open rgnkn opened 2 years ago

rgnkn commented 2 years ago

I know that this was already discussed here: https://github.com/wbthomason/packer.nvim/issues/257

But despite the discussion there I'd like to ask for such an option. I'll try to describe my concrete usecase:

I use a combination of the following plugins for snippets (including the conditions for lazy loading):

All works fine and as expected, BUT:

If I start nvim without any flename given, a TelescopePrompt gets displayed in order to select a session via SessionManager.nvim. This starts obviously in Insert Mode but autocompletion doesn't make sense here. Due to loading what I described above this start up prompt hangs anoyingly.

Therefore I'd like to state for friendly-snippets something along the lines of:

event = "InsertEnter" ft = ~"TelescopePrompt" or: ignore-ft = "TelescopePrompt"

So, that it leaves loading the plugin for any other filetype that might be opened (later).

I hope I was able to make my case.

rgnkn commented 2 years ago

Okay. I found a solution.

The lag came from LuaSnip config (there are three loadings via require). I was able to set it up via vim.defer_fn and the initial TelescopePrompt now pops up immediately.

I leave this issue open for two reasons:

a) I'm not 100% sure if this async configuration is stable (with nvim-cmp needing LuaSnip afterwards) b) I think there might be other setups for the vim startup that might make this option useful

Feel free to close this if you really think that this request is absolutely unuseful.