fix: treesitter
This commit is contained in:
@@ -9,7 +9,6 @@ end)
|
|||||||
|
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
Config.now_if_args(function()
|
Config.now_if_args(function()
|
||||||
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
|
||||||
|
|
||||||
local filetypes = {
|
local filetypes = {
|
||||||
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
||||||
@@ -17,14 +16,14 @@ Config.now_if_args(function()
|
|||||||
'json', 'xml', 'toml', 'sh', 'bash', 'zsh', 'just', 'gitcommit', 'diff', 'regex', 'http'
|
'json', 'xml', 'toml', 'sh', 'bash', 'zsh', 'just', 'gitcommit', 'diff', 'regex', 'http'
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.on_filetype(table.concat(filetypes, ','), function()
|
Config.autocmd('FileType', filetypes, function(ev)
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
if pcall(vim.treesitter.start, ev.buf) and vim.bo[ev.buf].filetype == 'php' then
|
||||||
if pcall(vim.treesitter.start, buf) and vim.bo[buf].filetype == 'php' then
|
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
vim.bo[buf].indentexpr = 'v:lua.require"nvim-treesitter".indentexpr()'
|
|
||||||
end
|
end
|
||||||
end)
|
end, 'Start tree-sitter')
|
||||||
|
|
||||||
Config.later(function()
|
Config.later(function()
|
||||||
|
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||||
require('nvim-treesitter').install(vim.tbl_map(function(ft)
|
require('nvim-treesitter').install(vim.tbl_map(function(ft)
|
||||||
return vim.treesitter.language.get_lang(ft) or ft
|
return vim.treesitter.language.get_lang(ft) or ft
|
||||||
end, filetypes))
|
end, filetypes))
|
||||||
|
|||||||
Reference in New Issue
Block a user