lean.nvim icon indicating copy to clipboard operation
lean.nvim copied to clipboard

ftdetect script references rest of plugin

Open 4e554c4c opened this issue 1 year ago • 0 comments

Hi! I'd like to only load the lean.nvim plugin if im editing a lean file. I'm currently using the packer package manager, so I did

 use { 'Julian/lean.nvim', ft = { 'lean', 'lean3' }}

In order to do this, packer installs lean.nvim's ftdetect script without the rest of the plugin, so that lean.nvim can do filetype detection in order to determine if the plugin should be loaded. Unfortunately, lean.nvim's ftdetect script calls into the plugin itself. Because the plugin isn't loaded at the time, this causes filetype detection to crash.

Getting around this isn't too hard, since the fix is to just do

 use { 'Julian/lean.nvim', ft = { 'lean', 'lean3' }, module = 'lean'}

but it still doesn't seem optimal since this is loading the entire lean plugin when it's not necessary to do so.

It seems like it would be pretty easy to solve this by moving main/lua/lean/ft.lua to ftdetect/lean3.lua instead of using the vimscript shim.

4e554c4c avatar Aug 30 '22 18:08 4e554c4c