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

macvimterminal

This might be something quirky about MacVim, so I'll ask here.

I put a syntax file in ~/.vim/syntax, but it doesn't load. I have syntax on in my .vimrc.

When I open the editor, :scriptnames doesn't include the syntax file.

Is there anything else I need to do to make sure it loads?

Best Answer

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.