Vim Airline interpreting .h files as cpp, not c

541 views Asked by At

Whenever I create a .h file, Airline interprets it as a cpp file (in the filetype section). How do I set it to c?

I couldn't find an answer online, and I don't know in where to change the source code of Airline to do what I want.

2

There are 2 answers

0
Matt On BEST ANSWER

Filetype is set by standard Vim ftplugin. To change the default

let g:c_syntax_for_h = 1

See :h c.vim for more options.

2
Jossnix On

Try adding the line to the vimrc

au BufRead,BufNewFile *.h set filetype=c