I was writing some filetype-specific vim scripts, c.vim
and cpp.vim
, when I noticed that for C++ files, both c.vim
and cpp.vim
were being executed. This makes a lot of sense, since C++ is a superset of C. But my question is this: where is the logic that makes this happen?
That is, is something baked in when vim is compiled that tells it that C++ files are also C files, or is there some file in the .vim directory that controls this behavior? Or something else entirely?
It might be interesting to note that checking the filetype vim has assigned to my C++ files (using :set ft?
) returns cpp
, not something like c.cpp
, as discussed in this question.