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 264 forks source link

[Question] How to disable plugin on large file? #885

Closed nyngwang closed 2 years ago

nyngwang commented 2 years ago

As title.

Context: sometimes the LSP go-to-defintion will jump into the library code, and some neovim packages will cause serious delay in cursor movement. So I would like to know is it possible to temporarily disable these plugins when some condition is met.

WieeRd commented 2 years ago

Packer can only decide when to load the plugin.
If you want to disable plugin under certain condition, you should use autocmd.

More specifically, an autocmd that is triggered on BufRead event,
checks file size, and disable your LSP plugin for that buffer.

nyngwang commented 2 years ago

@WieeRd Thanks for your info!