mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-04 20:40:02 -04:00
feat: add locals to setup procedure
This commit is contained in:
parent
0d5ef2f980
commit
b2b6e51a7c
2 changed files with 19 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
|||
local api = vim.api
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
local install = require'nvim-treesitter.install'
|
||||
local locals = require'nvim-treesitter.locals'
|
||||
|
||||
local M = {}
|
||||
|
||||
|
|
@ -8,6 +9,12 @@ local M = {}
|
|||
-- this is the main interface through the plugin
|
||||
function M.setup(lang)
|
||||
if parsers.has_parser(lang) then
|
||||
if locals.is_supported(lang) then
|
||||
print("Locals setup for", lang)
|
||||
api.nvim_command(string.format([[
|
||||
autocmd NvimTreesitter FileType %s lua vim.api.nvim_buf_attach(0, true, {on_lines=require'nvim-treesitter.locals'.on_lines})
|
||||
]], lang))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue