mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
feat: syntax highlighting
This commit is contained in:
parent
8bb53c93d0
commit
d05728e155
4 changed files with 57 additions and 1 deletions
17
lua/nvim-treesitter/highlight.lua
Normal file
17
lua/nvim-treesitter/highlight.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
local api = vim.api
|
||||
local queries = require'nvim-treesitter.query'
|
||||
local ts = vim.treesitter
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.setup(bufnr, ft)
|
||||
local buf = bufnr or api.nvim_get_current_buf()
|
||||
local ft = ft or api.nvim_buf_get_option(buf, 'ft')
|
||||
|
||||
local query = queries.get_query(ft, "highlights")
|
||||
if not query then return end
|
||||
|
||||
ts.TSHighlighter.new(query, buf, ft)
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue