Enable autoindent and smartindent for PHP and general use

This change re-enables autoindent and smartindent options in
both PHP and general settings to improve code formatting
and maintain consistency across file types.
This commit is contained in:
Ray Elliott 2026-01-13 19:54:44 +00:00
parent 341236833d
commit e450617eb6
2 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,12 @@ vim.api.nvim_create_autocmd("FileType", {
vim.opt_local.tabstop = 2 -- Display tabs as 2 spaces wide 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.shiftwidth = 2 -- Indent/outdent by 2 columns (one tab)
vim.opt_local.softtabstop = 2 -- Tab key inserts 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, end,
}) })

View File

@ -81,6 +81,8 @@ vim.opt.tabstop = 4 -- Display tabs as 4 spaces
vim.opt.shiftwidth = 4 -- Indent by 4 vim.opt.shiftwidth = 4 -- Indent by 4
vim.opt.softtabstop = 4 -- Backspace removes 4 spaces vim.opt.softtabstop = 4 -- Backspace removes 4 spaces
vim.opt.expandtab = true -- Use spaces by default (overridden per-filetype) 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 -- Persistent undo
vim.opt.undofile = true -- Enable persistent undo vim.opt.undofile = true -- Enable persistent undo