diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 10:14:37 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 10:14:37 +0100 |
commit | 63922a1d1ea22c58be758d188068f33491411c0c (patch) | |
tree | 41c1f4b4ee2c35e0d78c59a616cf7423a5a14637 /after/syntax | |
parent | 0cd0b7f8942a42bf8cb24affb18ac5bedae5aa48 (diff) | |
download | vim-polyglot-63922a1d1ea22c58be758d188068f33491411c0c.tar.gz vim-polyglot-63922a1d1ea22c58be758d188068f33491411c0c.zip |
Add idris support, closes #265
Diffstat (limited to 'after/syntax')
-rw-r--r-- | after/syntax/idris.vim | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/after/syntax/idris.vim b/after/syntax/idris.vim new file mode 100644 index 00000000..bef36f62 --- /dev/null +++ b/after/syntax/idris.vim @@ -0,0 +1,82 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'idris') != -1 + finish +endif + +" This script allows for unicode concealing of certain characters +" For instance -> goes to → +" +" It needs vim >= 7.3, set nocompatible, set enc=utf-8 +" +" If you want to turn this on, let g:idris_conceal = 1 + +if !exists('g:idris_conceal') || !has('conceal') || &enc != 'utf-8' + finish +endif + +" vim: set fenc=utf-8: +syntax match idrNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ +syntax match idrNiceOperator "<-" conceal cchar=← +syntax match idrNiceOperator "->" conceal cchar=→ +syntax match idrNiceOperator "\<sum\>" conceal cchar=∑ +syntax match idrNiceOperator "\<product\>" conceal cchar=∏ +syntax match idrNiceOperator "\<sqrt\>" conceal cchar=√ +syntax match idrNiceOperator "\<pi\>" conceal cchar=π +syntax match idrNiceOperator "==" conceal cchar=≡ +syntax match idrNiceOperator "\/=" conceal cchar=≠ + + +let s:extraConceal = 1 + +let s:doubleArrow = 1 +" Set this to 0 to use the more technically correct arrow from bar + +" Some windows font don't support some of the characters, +" so if they are the main font, we don't load them :) +if has("win32") + let s:incompleteFont = [ 'Consolas' + \ , 'Lucida Console' + \ , 'Courier New' + \ ] + let s:mainfont = substitute( &guifont, '^\([^:,]\+\).*', '\1', '') + for s:fontName in s:incompleteFont + if s:mainfont ==? s:fontName + let s:extraConceal = 0 + break + endif + endfor +endif + +if s:extraConceal + syntax match idrNiceOperator "Void" conceal cchar=⊥ + + " Match greater than and lower than w/o messing with Kleisli composition + syntax match idrNiceOperator "<=\ze[^<]" conceal cchar=≤ + syntax match idrNiceOperator ">=\ze[^>]" conceal cchar=≥ + + if s:doubleArrow + syntax match idrNiceOperator "=>" conceal cchar=⇒ + else + syntax match idrNiceOperator "=>" conceal cchar=↦ + endif + + syntax match idrNiceOperator "=\zs<<" conceal cchar=« + + syntax match idrNiceOperator "++" conceal cchar=⧺ + syntax match idrNiceOperator "::" conceal cchar=∷ + syntax match idrNiceOperator "-<" conceal cchar=↢ + syntax match idrNiceOperator ">-" conceal cchar=↣ + syntax match idrNiceOperator "-<<" conceal cchar=⤛ + syntax match idrNiceOperator ">>-" conceal cchar=⤜ + + " Only replace the dot, avoid taking spaces around. + syntax match idrNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘ + syntax match idrNiceOperator "\.\." conceal cchar=‥ + + syntax match idrNiceOperator "`elem`" conceal cchar=∈ + syntax match idrNiceOperator "`notElem`" conceal cchar=∉ +endif + +hi link idrNiceOperator Operator +hi! link Conceal Operator +setlocal conceallevel=2 + |