From f05dea8dd765b0ce5b6c6ea92b049a5ae7547180 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 9 Jun 2021 14:23:57 +0200 Subject: Disable languages also from heuristics, fixes #673 --- autoload/polyglot/detect.vim | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'autoload') diff --git a/autoload/polyglot/detect.vim b/autoload/polyglot/detect.vim index b1b5d6d7..cac826cf 100644 --- a/autoload/polyglot/detect.vim +++ b/autoload/polyglot/detect.vim @@ -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(...) -- cgit v1.2.3