Try to manually detect if .h files are c or cpp
This commit is contained in:
parent
40ca1fc754
commit
7750df787a
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user