Sometimes, apparently at random, Vim decides not to figure out what filetype we’ve opened. I’m not sure why, so please excuse my vague question.
Any idea why it happens and how to mitigate it? I’m opening a .php file.
I’ve set filetype to on in my vimrc.
Vim doesn’t itself recognize filetypes, plugins for various languages do that for you, specifically ftplugins. Generally they will have an autocommand defined within them, eg.)
Such a file is placed under ftplugin directory and generally named .vim. Although it can vary and can be complicated in certain circumstances, but you should get the general idea from the simple example.
So for files VIM doesn’t recognize or there isn’t a ftplugin for that type, it will be empty.