I'm still very new to vim but I've noticed that files with -*- mode: {lang} -*-
as the first or second line turn on the syntax highlighting for that language. It's tough searching for -*- when Google ignores punctuation but after a couple hours, I was able to find out what it's called in emacs. (Major-modes)
So far it's worked great when using mode:python
on python files without .py but I can't seem to get mode:javascript
working for javascript files without a .js extension. I've searched the vim docs but was unable to find a way to embed the syntax mode in a file like the major-mode does for emacs.
I was able to find this post about setting an override in the .vimrc but I'd like the highlighting to stay with the file and not rely on my .vimrc.
Any help is appreciated. Thanks!
It's called modeline. See :help modeline
for details.