diff options
author | CodingCellist <teh6@st-andrews.ac.uk> | 2020-09-05 21:37:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-05 21:37:11 +0200 |
commit | 3baafd5c336d18d87898ae87f16df7cd76bc8d65 (patch) | |
tree | 3bd6787bde3c5713fd5cfc7c962d60ac4b3dac50 /autoload/polyglot.vim | |
parent | b0124dc88082f5ed8c96faa16d3b334d38f5949f (diff) | |
download | vim-polyglot-3baafd5c336d18d87898ae87f16df7cd76bc8d65.tar.gz vim-polyglot-3baafd5c336d18d87898ae87f16df7cd76bc8d65.zip |
Add support for Idris2, closes #534 (#535)
Diffstat (limited to 'autoload/polyglot.vim')
-rw-r--r-- | autoload/polyglot.vim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim index 3753dc8e..eca7e304 100644 --- a/autoload/polyglot.vim +++ b/autoload/polyglot.vim @@ -212,6 +212,50 @@ func! polyglot#DetectReFiletype() endfor endfunc +func! polyglot#DetectIdrFiletype() + for lnum in range(1, min([line("$"), 5])) + let line = getline(lnum) + if line =~# '^\s*--.*[Ii]dris \=1' + setf idris | return + endif + if line =~# '^\s*--.*[Ii]dris \=2' + setf idris2 | return + endif + endfor + for lnum in range(1, min([line("$"), 30])) + let line = getline(lnum) + if line =~# '^pkgs =.*' + setf idris | return + endif + if line =~# '^depends =.*' + setf idris2 | return + endif + if line =~# '^%language \(TypeProviders\|ElabReflection\)' + setf idris | return + endif + if line =~# '^%language PostfixProjections' + setf idris2 | return + endif + if line =~# '^%access .*' + setf idris | return + endif + if exists("g:filetype_idr") + exe "setf " . g:filetype_idr | return + endif + endfor + setf idris2 | return +endfunc + +func! polyglot#DetectLidrFiletype() + for lnum in range(1, min([line("$"), 200])) + let line = getline(lnum) + if line =~# '^>\s*--.*[Ii]dris \=1' + setf lidris | return + endif + endfor + setf lidris2 | return +endfunc + " Restore 'cpoptions' let &cpo = s:cpo_save unlet s:cpo_save |