fix indentation

This commit is contained in:
Mathias Schneider
2026-05-04 17:23:10 +02:00
parent 65e66968e2
commit 777312620a
2 changed files with 20 additions and 15 deletions
+20 -11
View File
@@ -17,6 +17,26 @@ return {
install_dir = vim.fn.stdpath("data") .. "/site",
})
-- Enable Treesitter-based indenting (selective)
vim.api.nvim_create_autocmd("FileType", {
pattern = "*",
callback = function()
local exclude = { "python" }
for _, lang in ipairs(exclude) do
if vim.bo.filetype == lang then
return
end
end
if vim.bo.buftype == "" and vim.bo.filetype ~= "" then
pcall(function()
vim.bo.indentexpr = "v:lua.vim.treesitter.indentexpr()"
end)
end
end,
desc = "Enable Treesitter indenting (selective)",
})
-- Auto-install parsers for these languages when opening a file
local ensure_installed = {
"python",
@@ -43,16 +63,5 @@ return {
end)
end
end
-- Enable Treesitter-based indenting (natively supported by Neovim)
vim.api.nvim_create_autocmd("FileType", {
pattern = "*",
callback = function()
if vim.bo.buftype == "" and vim.bo.filetype ~= "" then
vim.bo.indentexpr = "v:lua.vim.treesitter.indentexpr()"
end
end,
desc = "Enable Treesitter indenting",
})
end,
}