For example i would not want to load an indent guide plugin for lisps because of this:

So, this is like a negated filetype pattern? Neovim makes it a bit annoying to do that, as far as I know, but maybe there's some hack with e.g. a FileType * pattern that runs a function to check the filetype. That's super ugly and not very efficient, though.
I'll think more about how to do this, but ideas/examples from other plugins/PRs would be welcome.
So, this is like a negated filetype pattern? Neovim makes it a bit annoying to do that, as far as I know, but maybe there's some hack with e.g. a
FileType *pattern that runs a function to check the filetype. That's super ugly and not very efficient, though.I'll think more about how to do this, but ideas/examples from other plugins/PRs would be welcome.
You can access the filetype as buffer local option: vim.bo.filetype
Right - accessing the filetype isn't so much the hard part; it's more that it seems inelegant and potentially inefficient to run a check on every FileType * event (as my only current idea for doing this would require).
Maybe that isn't so bad? If anyone feels like making a PR implementing that approach (or a better approach if you have an idea for one), I'd be happy to take a look.
Not sure, if FileType events are retrievable as a table. You could then create a smaller table with the necessary functions.
I don't know of a way to get a table of FileType autocommands, but maybe it's possible.
The approach I'm proposing would look something like:
not_ft event, e.g. {html = {'foo', 'bar'}, css = {'baz'}}index = {html = {'baz'}, css = {'foo', 'bar'}}au FileType * lua require('packer.load').not_ft(<amatch>)packer.load.not_ft is something like (in semi-pseudocode):function not_ft(ft)
if not index[ft] then
load(all_not_ft_plugins)
elseif
index[ft] then load(index[ft])
end
end
I suppose this isn't as ugly as I'd conceived it to be...
I won't have time to add this before March, but if someone wants to pick it up, I'll have time to look at a PR.
Most helpful comment
So, this is like a negated filetype pattern? Neovim makes it a bit annoying to do that, as far as I know, but maybe there's some hack with e.g. a
FileType *pattern that runs a function to check the filetype. That's super ugly and not very efficient, though.I'll think more about how to do this, but ideas/examples from other plugins/PRs would be welcome.