diff --git a/lua/autocmds.lua b/lua/autocmds.lua index 27e9c8b..b177413 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -25,6 +25,12 @@ 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/settings.lua b/lua/settings.lua index 66ba0b8..c744ed7 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -81,6 +81,8 @@ vim.opt.tabstop = 4 -- Display tabs as 4 spaces vim.opt.shiftwidth = 4 -- Indent by 4 vim.opt.softtabstop = 4 -- Backspace removes 4 spaces vim.opt.expandtab = true -- Use spaces by default (overridden per-filetype) +vim.opt.autoindent = true -- Copy indent from current line when starting new line +vim.opt.smartindent = true -- Smart autoindenting (C-like programs, PHP, etc.) -- Persistent undo vim.opt.undofile = true -- Enable persistent undo