diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-01 23:02:36 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-01 23:02:36 +0200 |
commit | f2ef4cedecf554c0c9f0694f93df1d53a57bf70c (patch) | |
tree | ee95ac48f56aee9607aa3c92fe478cf63f9c26b7 /autoload | |
parent | 45c1923f43f2bb2e626fe910654d4395a0e50a04 (diff) | |
download | vim-polyglot-4.7.1.tar.gz vim-polyglot-4.7.1.zip |
Fix reason filetype detection, closes #532v4.7.1
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/polyglot.vim | 10 |
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 |