summaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/polyglot.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim
index 7d5aa867..3753dc8e 100644
--- a/autoload/polyglot.vim
+++ b/autoload/polyglot.vim
@@ -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