about summary refs log tree commit diff stats
path: root/vimrc.vim
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-23 17:00:24 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-23 17:00:24 -0700
commita9817844aea80b5d07baecb55e214775cf0f6c9e (patch)
treefb59424330fb4a6560b520f06eb962adc16a9681 /vimrc.vim
parentd803b68769947a419ef176d5c80446fcba5e9ee3 (diff)
downloadmu-a9817844aea80b5d07baecb55e214775cf0f6c9e.tar.gz
3566
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.
Diffstat (limited to 'vimrc.vim')
-rw-r--r--vimrc.vim7
1 files changed, 4 insertions, 3 deletions
diff --git a/vimrc.vim b/vimrc.vim
index 5008b415..83cc29b8 100644
--- a/vimrc.vim
+++ b/vimrc.vim
@@ -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++)