vim: Stop loading C++-specific syntax highlighting in non-C++ files.

I also figured out why the autocommand wasn't running on the first file:
my local setup for directory-specific vimrc files runs inside an
autocommand, and it runs autocommands recursively inside an autocommand,
and it runs only autocommands inside a 'LocalVimrc' autocommand group to
ensure infinite regress (autocommands running multiple times in
practice). And I'd forgotten this 'feature' of my vimrc setup by the
time I set this up for Mu.
This commit is contained in:
Kartik K. Agaram 2016-10-23 17:00:24 -07:00
parent d803b68769
commit a9817844ae
1 changed files with 4 additions and 3 deletions

View File

@ -38,9 +38,10 @@ function! HighlightTangledFile()
syntax match muPendingScenario "^pending-scenario\>" | highlight link muPendingScenario SpecialChar
syntax match muData "^type\>\|^container\>\|^exclusive-container\>" | highlight muData ctermfg=226
endfunction
call HighlightTangledFile()
autocmd BufRead,BufNewFile *.mu set ft=mu
autocmd BufRead,BufNewFile [0-9]* call HighlightTangledFile()
augroup LocalVimrc
autocmd BufRead,BufNewFile *.mu set ft=mu
autocmd BufRead,BufNewFile *.cc call HighlightTangledFile()
augroup END
" Scenarios considered:
" opening or starting vim with a new or existing file without an extension (should interpret as C++)