summaryrefslogtreecommitdiffstats
path: root/autoload/polyglot/detect.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2021-06-09 14:23:57 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2021-06-09 14:23:57 +0200
commitf05dea8dd765b0ce5b6c6ea92b049a5ae7547180 (patch)
treefa6b1381d5eb99e24d177e4ffd73697bb944e8f1 /autoload/polyglot/detect.vim
parente3ad29ce799fd94e7e3e5617443761c1e24b37de (diff)
downloadvim-polyglot-f05dea8dd765b0ce5b6c6ea92b049a5ae7547180.tar.gz
vim-polyglot-f05dea8dd765b0ce5b6c6ea92b049a5ae7547180.zip
Disable languages also from heuristics, fixes #673
Diffstat (limited to 'autoload/polyglot/detect.vim')
-rw-r--r--autoload/polyglot/detect.vim22
1 files changed, 17 insertions, 5 deletions
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(...)