As per the accepted answer to this question, I'm attempting to use modelines in vim to force filetype detection in some files.
For example, at the top of a file named gitconfig
(note there is no leading .
), I have the following line:
# vim: set filetype=gitconfig :
modeline
is enabled on my system. However, when I open the file in vim, set filetype?
returns conf
, rather than the expected gitconfig
.
Is it possible that other parts of my vim configuration (e.g. filetype.vim) are causing this strange behaviour?
Edited in response to comments:
set compatible?
returns nocompatible
set modeline?
returns modeline
verbose set filetype?
returns:
filetype=conf
Last set from /usr/share/vim/vim73/filetype.vim
I don't understand why the system wide filetype plugin would be overriding what I have set in the file itself.
One final note: this is the version of Vim 7.3 shipped with OSX.
The latest version of MacVim running on the same system using the same .vimrc
behaves as expected, with set ft?
returning filetype=gitconfig
.
set modeline?
does not printnomodeline
?compatible
is set. That would be worth checking too.