Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.