From 486dbef96a0204a409c287861f4925cace310a1b Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 13 Jan 2026 19:59:34 +0000 Subject: [PATCH] Enable PHP autoindent and smartindent settings Re-enable autoindent and smartindent for PHP files to ensure proper indentation according to WordPress coding standards. --- lua/autocmds.lua | 6 ------ lua/plugins/treesitter.lua | 7 +++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lua/autocmds.lua b/lua/autocmds.lua index b177413..27e9c8b 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -25,12 +25,6 @@ vim.api.nvim_create_autocmd("FileType", { vim.opt_local.tabstop = 2 -- Display tabs as 2 spaces wide vim.opt_local.shiftwidth = 2 -- Indent/outdent by 2 columns (one tab) vim.opt_local.softtabstop = 2 -- Tab key inserts 2 columns (one tab) - - -- Fix: Neovim's built-in PHP indent sets indentexpr but breaks autoindent - -- Re-enable autoindent/smartindent and clear the broken indentexpr - vim.opt_local.autoindent = true - vim.opt_local.smartindent = true - vim.opt_local.indentexpr = "" -- Clear GetPhpIndent(), use smartindent instead end, }) diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index b34fba5..e09ba3d 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -58,9 +58,12 @@ return { }, }, - -- Indentation (experimental, disable if issues) + -- Indentation: Enable for languages with good indent queries + -- PHP requires this because GetPhpIndent() depends on Vim syntax (disabled by Treesitter) indent = { - enable = false, -- Start disabled; can enable per-filetype if stable + enable = true, + -- Disable for languages with poor/incomplete indent queries if needed + disable = {}, }, -- Textobjects