diff --git a/term/.config/nvim/lua/basic-settings.lua b/term/.config/nvim/lua/basic-settings.lua index b702602..fc98dcc 100644 --- a/term/.config/nvim/lua/basic-settings.lua +++ b/term/.config/nvim/lua/basic-settings.lua @@ -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 -- ============================================================================ diff --git a/term/.config/nvim/lua/plugins/treesitter.lua b/term/.config/nvim/lua/plugins/treesitter.lua index 11accda..4cf3b55 100644 --- a/term/.config/nvim/lua/plugins/treesitter.lua +++ b/term/.config/nvim/lua/plugins/treesitter.lua @@ -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, }