highlight: retain highlighters with the buffers

This commit is contained in:
Thomas Vigouroux 2020-04-22 09:29:33 +02:00
parent c4862c656e
commit f7424d23a1

View file

@ -2,7 +2,9 @@ local api = vim.api
local queries = require'nvim-treesitter.query'
local ts = vim.treesitter
local M = {}
local M = {
highlighters={}
}
function M.setup(bufnr, ft)
local buf = bufnr or api.nvim_get_current_buf()
@ -11,7 +13,7 @@ function M.setup(bufnr, ft)
local query = queries.get_query(ft, "highlights")
if not query then return end
ts.TSHighlighter.new(query, buf, ft)
M.highlighters[buf] = ts.TSHighlighter.new(query, buf, ft)
end
return M