mirror of
https://github.com/dam9000/kickstart-modular.nvim.git
synced 2026-03-30 01:31:30 +00:00
Merge upstream: Add treesitter indentation
This commit is contained in:
commit
ad485aecd7
@ -4,6 +4,7 @@ return {
|
|||||||
lazy = false,
|
lazy = false,
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
branch = 'main',
|
branch = 'main',
|
||||||
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
||||||
config = function()
|
config = function()
|
||||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
||||||
require('nvim-treesitter').install(parsers)
|
require('nvim-treesitter').install(parsers)
|
||||||
@ -12,9 +13,20 @@ return {
|
|||||||
local buf, filetype = args.buf, args.match
|
local buf, filetype = args.buf, args.match
|
||||||
|
|
||||||
local language = vim.treesitter.language.get_lang(filetype)
|
local language = vim.treesitter.language.get_lang(filetype)
|
||||||
if not vim.tbl_contains(parsers, language) then return end
|
if not language then return end
|
||||||
|
|
||||||
vim.treesitter.start()
|
-- check if parser exists and load it
|
||||||
|
if not vim.treesitter.language.add(language) then return end
|
||||||
|
-- enables syntax highlighting and other treesitter features
|
||||||
|
vim.treesitter.start(buf, language)
|
||||||
|
|
||||||
|
-- enables treesitter based folds
|
||||||
|
-- for more info on folds see `:help folds`
|
||||||
|
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||||
|
-- vim.wo.foldmethod = 'expr'
|
||||||
|
|
||||||
|
-- enables treesitter based indentation
|
||||||
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user