mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2026-05-14 08:23:48 +00:00
Add indentation fallback
This commit is contained in:
parent
16dd8f5007
commit
c7f05a0f47
6
init.lua
6
init.lua
@ -891,8 +891,12 @@ require('lazy').setup({
|
||||
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
-- vim.wo.foldmethod = 'expr'
|
||||
|
||||
-- check if treesitter indentation is available for this language, and if so enable it
|
||||
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
||||
local has_indent_query = vim.treesitter.query.get(language, 'indent') ~= nil
|
||||
|
||||
-- enables treesitter based indentation
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
|
||||
end
|
||||
|
||||
local available_parsers = require('nvim-treesitter').get_available()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user