Fix reason filetype detection, closes #532

This commit is contained in:
Adam Stankiewicz
2020-09-01 23:02:36 +02:00
parent 45c1923f43
commit f2ef4cedec
7 changed files with 44 additions and 10 deletions

View File

@@ -202,6 +202,16 @@ func! polyglot#DetectFsFiletype()
setf forth | return
endfunc
func! polyglot#DetectReFiletype()
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
setf cpp | return
endif
setf reason | return
endfor
endfunc
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save