tags:

views:

48

answers:

1

How do I make vim use syntax=cpp for *.h *.H *.C files? What line(s) should I add to vimrc?

+1  A: 

Try something like:

if has("autocmd")
    " Enable file type detection
    filetype on
    autocmd BufNewFile,BufRead *.h,*.c setfiletype cpp
endif

I am not sure if file extension is case sensitive (I am using Windows).

Grzegorz Gierlik
The `:setf` is useless as it is already done by vim. The `:filetype on` is required though.
Luc Hermitte