-
Notifications
You must be signed in to change notification settings - Fork 67
enable for only a single language or list of languages #30
Comments
~ Yeah just change `enabled` from `true` to a table of languages you want to enable it for (just like the main nvim-treesitter plugin) ~
|
@p00f I just tried setting |
It is https://github.com/nvim-treesitter/nvim-treesitter#modules |
@p00f thanks that works, shame it works in that order since to only enable it for a few languages I'd end up having to list all available languages except the one I want 😅 . Anyway thanks for the help. |
I don't want to implement this on the module side, can you open an issue on the main nvim-treesitter repo and see? If they don't want to then I'll try doing it |
Unless I'm missing something why is it needed to be added to treesitter? I actually don't see that useful on the treesitter side but I see it useful here, the reason is I might want treesitter support for more languages than I'd like rainbow parentheses support. Technically I want support for treesitter for everything, but rainbow parentheses support only for lisp like languages. |
This is an not a standalone plugin but an nvim-treesitter module generated from the module template given by nvim-treesitter: Enabling and disabling is controlled by the main nvim-treesitter plugin: If they implement this on their side then you can do it to any module given here https://github.com/nvim-treesitter/nvim-treesitter/wiki/Extra-modules-and-plugins#extra-modules note that 3 out of the 6 modules mentioned there are outside the nvim-treesitter organization |
I think I found a way around this limitation without maintaining a full table of disabled languages. local parsers = require("nvim-treesitter.parsers")
rainbow = {
enable = true,
-- Enable only for lisp like languages
disable = vim.tbl_filter(
function(p)
return p ~= "clojure" and p ~= "commonlisp" and p ~= "fennel" and p ~= "query"
end,
parsers.available_parsers()
)
},
|
Neat! If that list grows larger you can use local enabled_list = {"clojure", "fennel", "commonlisp", "query", ...}
rainbow = {
enable = true,
-- Enable only for lisp like languages
disable = vim.tbl_filter(
function(p)
local disable = true
for _, lang in pairs(enabled_list) do
if p==lang then disable = false end
end
return disable
end,
parsers.available_parsers()
)
}, |
Should be a part of the documentation imho. |
It would be nice if |
Hi 👋🏿 thanks for your work on this plugin.
I've just moved over from
luochen1990
's plugin and I'm wondering if it's possible to enable this plugin for only a few filetypes primarily since there are only a few languages I use that tend to get a little unmanageable with their parens (e.g. lisps) but for things likelua
I don't really need this functionality.The text was updated successfully, but these errors were encountered: