mirror of
https://github.com/dam9000/kickstart-modular.nvim.git
synced 2026-03-30 01:31:30 +00:00
Add treesitter indentation
This commit is contained in:
parent
a6dcf6874b
commit
4021496050
16
init.lua
16
init.lua
@ -882,6 +882,7 @@ require('lazy').setup({
|
||||
lazy = false,
|
||||
build = ':TSUpdate',
|
||||
branch = 'main',
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
||||
config = function()
|
||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
||||
require('nvim-treesitter').install(parsers)
|
||||
@ -890,9 +891,20 @@ require('lazy').setup({
|
||||
local buf, filetype = args.buf, args.match
|
||||
|
||||
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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user