When I open a PHP file, Neovim sets nosmartindent
and indentexpr=GetPhpIndent()
.
This is a bummer, because GetPhpIndent()
is completely broken and makes the editing experience a nightmare where I have to constantly fix the indentation of every line I type.
I created a file $RUNTIME/after/ftplugin/php.lua
with this content inside:
vim.bo.indentexpr = nil
vim.bo.smartindent = true
print("I APPLIED SOME SETTINGS!")
I added the print statement just to confirm it gets loaded, and it does. Every time I open my PHP file, I see the text printed.
HOWEVER, my settings are unchanged. The settings are still being set by the runtime:
So it it because my lua file doesn't work? NOPE, if I source it after opening the file, my settings are updated correctly.
So it seems like Nvim's default settings are applied after my ftplugin file, in which case what the heck is the point of ftplugin?
Help!