It used to work by adding following line into a file even it has no suffix .vim
, my vim version is v8.0.1500
, on OS X 10.13.3
" vim:ft=vim
UPDATE:
I tried adding following two lines to $MYVIMRC, after filetype plugin indent on
set modeline
set modelines=5
And changed
" vim:ft=vim
to
" vim:set ft=vim
Still doesn't work :(
Here is my .vimrc for reference, and for example, this file couldn't be detected as a vim file.
SOLUTION
- Add following two lines to $MYVIMRC, after
filetype plugin indent on
set modeline set modelines=5
- use
" vim:ft=vim
or" vim:set ft=vim:
instead of" vim:set ft=vim
filetype plugin on
in your vimrc?nomodifiable
. This way you can isolate whether the problem is with yourfiletype
settings or your modeline detection.nomodifiable
in your modeline to be sure that the modeline is working. But I see from your update that Wang Shidong's answer was what you were looking for :)