Try to manually detect if .h files are c or cpp

This commit is contained in:
Maxime Coste 2015-09-22 18:50:05 +01:00
parent 40ca1fc754
commit 7750df787a

View File

@ -3,11 +3,21 @@ hook global BufCreate .*\.(cc|cpp|cxx|C|hh|hpp|hxx|H)$ %{
set buffer mimetype ''
}
hook global BufCreate .*\.(c|h)$ %{
hook global BufCreate .*\.c$ %{
set buffer filetype c
set buffer mimetype ''
}
hook global BufCreate .*\.h$ %{
try %{
exec %{%s\b::\b|\btemplate\h*<lt>|\bclass\h+\w+|\b(typename|namespace)\b|\b(public|private|protected)\h*:<ret>}
set buffer filetype cpp
} catch %{
set buffer filetype c
}
set buffer mimetype ''
}
hook global BufSetOption mimetype=text/x-c %{
set buffer filetype c
}