Add heuristics for .h extension

This commit is contained in:
Adam Stankiewicz
2020-09-06 23:37:24 +02:00
parent 48254ec7ad
commit 46040f3ffd
8 changed files with 107 additions and 25 deletions

View File

@@ -154,6 +154,25 @@ func! polyglot#DetectAspFiletype()
setf aspvbs | return
endfunc
func! polyglot#DetectHFiletype()
for lnum in range(1, min([line("$"), 200]))
let line = getline(lnum)
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
if exists("g:c_syntax_for_h")
setf objc | return
endif
setf objcpp | return
endif
endfor
if exists("g:c_syntax_for_h")
setf c | return
endif
if exists("g:ch_syntax_for_h")
setf ch | return
endif
setf cpp | return
endfunc
func! polyglot#DetectMFiletype()
let saw_comment = 0
for lnum in range(1, min([line("$"), 100]))