How to get MacVim to autoload ~/.vim/syntax

Solution 1:

In addition to relying on the detected filetype, which may be incorrect, there are at least two alternative ways to force loading of a particular syntax file.

  1. Manually run the command :set ft=lesscss

  2. Add the previous setting to a modeline near the beginning or ending of the file. See :help modeline.

Solution 2:

Figured it out. It seems like files in $VIMRUNTIME/syntax are loaded based on the detected filetype when the actual file is loaded.

http://vimdoc.sourceforge.net/htmldoc/syntax.html#syntax-loading

So I just renamed the file to the detected filetype, lesscss, and it loaded fine.