mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
highlight: retain highlighters with the buffers
This commit is contained in:
parent
c4862c656e
commit
f7424d23a1
1 changed files with 4 additions and 2 deletions
|
|
@ -2,7 +2,9 @@ local api = vim.api
|
||||||
local queries = require'nvim-treesitter.query'
|
local queries = require'nvim-treesitter.query'
|
||||||
local ts = vim.treesitter
|
local ts = vim.treesitter
|
||||||
|
|
||||||
local M = {}
|
local M = {
|
||||||
|
highlighters={}
|
||||||
|
}
|
||||||
|
|
||||||
function M.setup(bufnr, ft)
|
function M.setup(bufnr, ft)
|
||||||
local buf = bufnr or api.nvim_get_current_buf()
|
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")
|
local query = queries.get_query(ft, "highlights")
|
||||||
if not query then return end
|
if not query then return end
|
||||||
|
|
||||||
ts.TSHighlighter.new(query, buf, ft)
|
M.highlighters[buf] = ts.TSHighlighter.new(query, buf, ft)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue