summaryrefslogtreecommitdiffstats
path: root/autoload/polyglot.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-09-06 23:37:24 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-09-06 23:37:24 +0200
commit46040f3ffd35c4a981ca1f3713934f55b58bb525 (patch)
treea562dbf2edce5657e648f6c6a69856ea30985d27 /autoload/polyglot.vim
parent48254ec7adc9cbbc2ff15c606faf062d23d7f200 (diff)
downloadvim-polyglot-46040f3ffd35c4a981ca1f3713934f55b58bb525.tar.gz
vim-polyglot-46040f3ffd35c4a981ca1f3713934f55b58bb525.zip
Add heuristics for .h extension
Diffstat (limited to 'autoload/polyglot.vim')
-rw-r--r--autoload/polyglot.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim
index ffb3c43f..1ed71826 100644
--- a/autoload/polyglot.vim
+++ b/autoload/polyglot.vim
@@ -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]))