Disable languages also from heuristics, fixes #673

This commit is contained in:
Adam Stankiewicz
2021-06-09 14:23:57 +02:00
parent e3ad29ce79
commit f05dea8dd7
3 changed files with 31 additions and 20 deletions

View File

@@ -53,16 +53,16 @@ func! polyglot#detect#H(...)
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")
if exists('g:c_syntax_for_h')
set ft=objc | return
endif
set ft=objcpp | return
endif
endfor
if exists("g:c_syntax_for_h")
if exists('g:c_syntax_for_h')
set ft=c | return
endif
if exists("g:ch_syntax_for_h")
if exists('g:ch_syntax_for_h')
set ft=ch | return
endif
set ft=cpp | return
@@ -82,7 +82,14 @@ func! polyglot#detect#M(...)
set ft=objc | return
endif
if line =~# '^\s*%'
set ft=octave | return
if !has_key(g:polyglot_is_disabled, 'octave')
set ft=octave | return
endif
endif
if line =~# '^\s*%'
if has_key(g:polyglot_is_disabled, 'octave')
set ft=matlab | return
endif
endif
if line =~# '^\s*(\*'
set ft=mma | return
@@ -97,7 +104,12 @@ func! polyglot#detect#M(...)
if exists("g:filetype_m")
let &ft = g:filetype_m | return
endif
set ft=octave | return
if !has_key(g:polyglot_is_disabled, 'octave')
set ft=octave | return
endif
if has_key(g:polyglot_is_disabled, 'octave')
set ft=matlab | return
endif
endfunc
func! polyglot#detect#Fs(...)