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
-4
View File
@@ -75,10 +75,6 @@ vim.opt.shiftwidth = 4
-- Recommendation: Use true (spaces) for better portability across systems
vim.opt.expandtab = true
-- Smartindent: Auto-indent based on file type and syntax
-- Automatically adds indent after lines ending with specific characters
vim.opt.smartindent = true
-- ============================================================================
-- UI/UX SETTINGS
-- ============================================================================
+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,
}