├── README.md ├── after └── syntax │ ├── haskell.vim │ └── lhaskell.vim ├── demo.hs ├── demo.lhs ├── demo.png ├── gendemo.sh └── tests ├── test-with-pack.sh └── test-with-pathogen.sh /README.md: -------------------------------------------------------------------------------- 1 | ## Vim Haskell Conceal+ 2 | 3 | This bundle provides extended Haskell Conceal feature for Vim. The feature 4 | is used to display unicode operators in Haskell code without changing the 5 | underlying file. 6 | 7 | This package offers more (and, more importantly, configurable) features 8 | than the 9 | [baseline vim-haskellConcealbundle](https://github.com/Twinside/vim-haskellConceal). 10 | The baseline bundle has numerous forks, which is possible to combine, so 11 | everyone is welcome to share, improve or contribute new notations to this 12 | Conceal Plus package. 13 | 14 | GitHub: https://github.com/enomsg/vim-haskellConcealPlus 15 | 16 | ### Why Concealing 17 | 18 | - Using things like '->' instead real arrows '→' was never a deliberate 19 | choice, but a choice made due to limitations of teletypewriters and 20 | input inconvenience. 21 | 22 | - With concealing you don't have to deal with cumbersome unicode-input 23 | methods, yet you can enjoy proper notation. 24 | 25 | - It is not only about aesthetics. Excess of multi-character functions may 26 | create visual noise, which negatively affects readability. Using special 27 | symbols and true arrows, together with colors and bold/italic face seems 28 | to improve the situation. The image shows Vim with and without 29 | concealing, both running in a plain terminal emulator: 30 | 31 | ![demo](https://github.com/enomsg/vim-haskellConcealPlus/raw/master/demo.png) 32 | 33 | - Using concealing instead of *-unicode* versions of packages also has 34 | some advantages. Mainly, concealing does not require any changes to the 35 | source code, it is backwards-compatible with idiomatic code. Secondly, 36 | with concealing no special input methods are needed. Plus, currently 37 | some features are hardly possible without editor's concealing (e.g. 38 | power superscripts). 39 | 40 | ### Installation 41 | 42 | Using Vim built-in `pack` support: 43 | 44 | ``` 45 | $ mkdir -p ~/.vim/pack/vim-haskellConcealPlus/start 46 | $ cd ~/.vim/pack/vim-haskellConcealPlus/start 47 | $ git clone https://github.com/enomsg/vim-haskellConcealPlus 48 | $ echo "syn on" >> ~/.vimrc # If not already in .vimrc 49 | $ echo "setlocal conceallevel=2" >> ~/.vimrc # If not already in .vimrc 50 | $ echo "set concealcursor=nciv" >> ~/.vimrc # Optional 51 | ``` 52 | 53 | ### Available Options 54 | 55 | 'q' option to disable concealing of scientific constants (e.g. π) 56 | '℘' option to disable concealing of powerset function 57 | '𝐒' option to disable String type to 𝐒 concealing 58 | '𝐓' option to disable Text type to 𝐓 concealing 59 | '𝐄' option to disable Either/Right/Left to 𝐄/𝑅/𝐿 concealing 60 | '𝐌' option to disable Maybe/Just/Nothing to 𝐌/𝐽/𝑁 concealing 61 | 'A' option to not try to preserve indentation 62 | 's' option to disable space consumption after ∑,∏,√ and ¬ functions 63 | '*' option to enable concealing of asterisk with '⋅' sign 64 | 'x' option to disable default concealing of asterisk with '×' sign 65 | 'E' option to enable ellipsis concealing with ‥ (two dot leader) 66 | 'e' option to disable ellipsis concealing with … (ellipsis sign) 67 | '⇒' option to disable `implies` concealing with ⇒ 68 | '⇔' option to disable `iff` concealing with ⇔ 69 | 'r' option to disable return (η) and join (µ) concealing 70 | 'b' option to disable bind (left and right) concealing 71 | 'f' option to enable formal (★) right bind concealing 72 | 'c' option to enable encircled b/d (ⓑ/ⓓ) for right and left binds 73 | 'h' option to enable partial concealing of binds (e.g. »=) 74 | 'C' option to enable encircled 'm' letter ⓜ concealing for fmap 75 | 'l' option to disable fmap/lift concealing with ↥ 76 | '↱' option to disable mapM/forM concealing with ↱/↰ 77 | 'w' option to disable 'where' concealing with "due to"/∵ symbol 78 | '-' option to disable subtract/(-) concealing with ⊟ 79 | 'I' option to enable alternative ':+' concealing with with ⨢ 80 | 'i' option to disable default concealing of ':+' with ⅈ 81 | 'R' option to disable realPart/imagPart concealing with ℜ/ℑ 82 | 'T' option to enable True/False constants concealing with bold 𝐓/𝐅 83 | 't' option to disable True/False constants concealing with italic 𝑇/𝐹 84 | 'B' option to disable Bool type to 𝔹 concealing 85 | 'Q' option to disable Rational type to ℚ concealing 86 | 'Z' option to disable Integer type to ℤ concealing 87 | 'N' option to disable Natural, Nat types to ℕ concealing 88 | 'D' option to disable Double type to 𝔻 concealing 89 | 'C' option to disable Complex type to ℂ concealing 90 | '1' option to disable numeric superscripts concealing, e.g. x² 91 | 'a' option to disable alphabet superscripts concealing, e.g. xⁿ 92 | 93 | The flags can be specified via hscoptions variable. For example, *let 94 | hscoptions="fc"* in your *~/.vimrc*. 95 | 96 | ### Known Issues and Hints: 97 | 98 | - Concealing may seriously mess up indentation. By default the bundle 99 | tries to preserve spaces for commonly troublesome symbols (e.g. ->, <- 100 | and => arrows). But to be sure about indentation, you still have to see 101 | the non-concealed code. *set conceallevel=0* might be handy in these 102 | cases. 103 | 104 | - *set concealcursor=nciv* seem to not play well with Vim matchparen 105 | feature (which is enabled by default). You can either disable concealing 106 | under the cursor, or disable matchparen by adding *let 107 | loaded_matchparen=1* at the very top of your *~/.vimrc*. 108 | 109 | - With *set concealcursor=nciv* navigation through concealed parts of code 110 | might be somewhat irritating because the cursor behaves a bit 111 | differently. It becomes less of an issue if you are used to Vim's *w/b* 112 | commands (word forward/backward). You can also try *set 113 | concealcursor=ncv* instead. 114 | 115 | - Finding proper fonts might be a pain. Most of modern, so called 116 | programming fonts (*Inconsolata*, *Anonymous Pro*, etc.) often lack 117 | decent unicode support. As a recommendation, try *DejaVu Sans Mono*. 118 | 119 | **Update**: thanks to [monospacifier](https://github.com/cpitclaudel/monospacifier) 120 | package, fonts are no longer a problem. Pick your favourite font, then in 121 | addition download one of the "monospacified" fallback fonts, save into 122 | `~/.fonts`, and adjust fontconfig, e.g. 123 | `~/.config/fontconfig/fonts.conf`: 124 | 125 | ``` 126 | 127 | 128 | ~/.fonts 129 | 130 | monospace 131 | 132 | TeX Gyre Schola Math monospacified for DejaVu Sans Mono 133 | 134 | 135 | 136 | ``` 137 | 138 | - Most of the terminal emulators have one or more issues with regard to the 139 | unicode characters handling. Emulators that don't have problems with unicode 140 | might be pretty slow. As a recommendation, try xst, or *evilvte* (it has weird 141 | configuration, but draws things correctly) or *lxterminal* (seems to be quite 142 | capable, but limited configurability) or any other terminal emulator that 143 | happened to work for you. 144 | 145 | [xst](https://github.com/gnotclub/xst) is known to work well with DejaVu Sans 146 | Mono, plus [monospacified](https://github.com/cpitclaudel/monospacifier) fonts 147 | as a fallback. 148 | -------------------------------------------------------------------------------- /after/syntax/haskell.vim: -------------------------------------------------------------------------------- 1 | " vim: sw=4 2 | "============================================================================= 3 | " What Is This: Add some conceal operator for your haskell files 4 | " File: haskell.vim (conceal enhancement) 5 | " Last Change: 2011-09-07 6 | " Version: 1.3.2 7 | " Require: 8 | " set nocompatible 9 | " somewhere on your .vimrc 10 | " 11 | " Vim 7.3 or Vim compiled with conceal patch. 12 | " Use --with-features=big or huge in order to compile it in. 13 | " 14 | " Usage: 15 | " Drop this file in your 16 | " ~/.vim/after/syntax folder (Linux/MacOSX/BSD...) 17 | " ~/vimfiles/after/syntax folder (Windows) 18 | " 19 | " For this script to work, you have to set the encoding 20 | " to utf-8 :set enc=utf-8 21 | " 22 | " Additional: 23 | " * if you want to avoid the loading, add the following 24 | " line in your .vimrc : 25 | " let g:no_haskell_conceal = 1 26 | " Changelog: 27 | " - 1.3.1: putting undefined in extra conceal, not appearing on windows 28 | " - 1.3: adding new arrow characters used by GHC in Unicode extension. 29 | " - 1.2: Fixing conceal level to be local (thx Erlend Hamberg) 30 | " - 1.1: Better handling of non utf-8 systems, and avoid some 31 | " concealing operations on windows on some fonts 32 | " 33 | 34 | " Cf - check a flag. Return true if the flag is specified. 35 | function! Cf(flag) 36 | return exists('g:hscoptions') && stridx(g:hscoptions, a:flag) >= 0 37 | endfunction 38 | 39 | if exists('g:no_haskell_conceal') || !has('conceal') || &enc != 'utf-8' 40 | finish 41 | endif 42 | 43 | " vim: set fenc=utf-8: 44 | syntax match hsNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ 45 | 46 | " 'q' option to disable concealing of scientific constants (e.g. π). 47 | if !Cf('q') 48 | syntax match hsNiceOperator "\" conceal cchar=π 49 | syntax match hsNiceOperator "\" conceal cchar=τ 50 | syntax match hsNiceOperator "\" conceal cchar=ℎ 51 | syntax match hsNiceOperator "\" conceal cchar=ℏ 52 | endif 53 | 54 | syntax match hsNiceOperator "==" conceal cchar=≡ 55 | syntax match hsNiceOperator "\/=" conceal cchar=≢ 56 | 57 | let s:extraConceal = 1 58 | " Some windows font don't support some of the characters, 59 | " so if they are the main font, we don't load them :) 60 | if has("win32") 61 | let s:incompleteFont = [ 'Consolas' 62 | \ , 'Lucida Console' 63 | \ , 'Courier New' 64 | \ ] 65 | let s:mainfont = substitute( &guifont, '^\([^:,]\+\).*', '\1', '') 66 | for s:fontName in s:incompleteFont 67 | if s:mainfont ==? s:fontName 68 | let s:extraConceal = 0 69 | break 70 | endif 71 | endfor 72 | endif 73 | 74 | if s:extraConceal 75 | syntax match hsNiceOperator "\" conceal cchar=⊥ 76 | 77 | " Match greater than and lower than w/o messing with Kleisli composition 78 | syntax match hsNiceOperator "<=\ze[^<]" conceal cchar=≤ 79 | syntax match hsNiceOperator ">=\ze[^>]" conceal cchar=≥ 80 | 81 | " Redfining to get proper '::' concealing 82 | syntax match hs_DeclareFunction /^[a-z_(]\S*\(\s\|\n\)*::/me=e-2 nextgroup=hsNiceOperator contains=hs_FunctionName,hs_OpFunctionName 83 | 84 | syntax match hsNiceoperator "!!" conceal cchar=‼ 85 | syntax match hsNiceoperator "++\ze[^+]" conceal cchar=⧺ 86 | syntax match hsNiceOperator "\" conceal cchar=∀ 87 | syntax match hsNiceOperator "-<" conceal cchar=↢ 88 | syntax match hsNiceOperator ">-" conceal cchar=↣ 89 | syntax match hsNiceOperator "-<<" conceal cchar=⤛ 90 | syntax match hsNiceOperator ">>-" conceal cchar=⤜ 91 | " the star does not seem so good... 92 | " syntax match hsNiceOperator "*" conceal cchar=★ 93 | syntax match hsNiceOperator "`div`" conceal cchar=÷ 94 | 95 | " Only replace the dot, avoid taking spaces around. 96 | syntax match hsNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘ 97 | 98 | syntax match hsQQEnd "|\]" contained conceal cchar=〛 99 | " sy match hsQQEnd "|\]" contained conceal=〚 100 | 101 | syntax match hsNiceOperator "`elem`" conceal cchar=∈ 102 | syntax match hsNiceOperator "`notElem`" conceal cchar=∉ 103 | syntax match hsNiceOperator "`isSubsetOf`" conceal cchar=⊆ 104 | syntax match hsNiceOperator "`union`" conceal cchar=∪ 105 | syntax match hsNiceOperator "`intersect`" conceal cchar=∩ 106 | syntax match hsNiceOperator "\\\\\ze[[:alpha:][:space:]_([]" conceal cchar=∖ 107 | 108 | syntax match hsNiceOperator "||\ze[[:alpha:][:space:]_([]" conceal cchar=∨ 109 | syntax match hsNiceOperator "&&\ze[[:alpha:][:space:]_([]" conceal cchar=∧ 110 | 111 | syntax match hsNiceOperator "<\*>" conceal cchar=⊛ 112 | syntax match hsNiceOperator "`mappend`" conceal cchar=⊕ 113 | syntax match hsNiceOperator "\" conceal cchar=⊕ 114 | syntax match hsNiceOperator "<>" conceal cchar=⊕ 115 | syntax match hsNiceOperator "\" conceal cchar=∅ 116 | syntax match hsNiceOperator "\" conceal cchar=∅ 117 | syntax match hsNiceOperator "\" conceal cchar=∅ 118 | endif 119 | 120 | hi link hsNiceOperator Operator 121 | hi! link Conceal Operator 122 | setlocal conceallevel=2 123 | 124 | " '℘' option to disable concealing of powerset function 125 | if !Cf('℘') 126 | syntax match hsNiceOperator "\" conceal cchar=℘ 127 | endif 128 | 129 | " '𝐒' option to disable String type to 𝐒 concealing 130 | if !Cf('𝐒') 131 | syntax match hsNiceOperator "\" conceal cchar=𝐒 132 | endif 133 | 134 | " '𝐓' option to disable Text type to 𝐓 concealing 135 | if !Cf('𝐓') 136 | syntax match hsNiceOperator "\" conceal cchar=𝐓 137 | endif 138 | 139 | " '𝐄' option to disable Either/Right/Left to 𝐄/𝑅/𝐿 concealing 140 | if !Cf('𝐄') 141 | syntax match hsNiceOperator "\" conceal cchar=𝐄 142 | syntax match hsNiceOperator "\" conceal cchar=𝑅 143 | syntax match hsNiceOperator "\" conceal cchar=𝐿 144 | endif 145 | 146 | " '𝐌' option to disable Maybe/Just/Nothing to 𝐌/𝐽/𝑁 concealing 147 | if !Cf('𝐌') 148 | syntax match hsNiceOperator "\" conceal cchar=𝐌 149 | syntax match hsNiceOperator "\" conceal cchar=𝐽 150 | syntax match hsNiceOperator "\" conceal cchar=𝑁 151 | endif 152 | 153 | " 'A' option to not try to preserve indentation. 154 | if Cf('A') 155 | syntax match hsNiceOperator "<-" conceal cchar=← 156 | syntax match hsNiceOperator "->" conceal cchar=→ 157 | syntax match hsNiceOperator "=>" conceal cchar=⇒ 158 | syntax match hsNiceOperator "\:\:" conceal cchar=∷ 159 | else 160 | syntax match hsLRArrowHead contained ">" conceal cchar= 161 | syntax match hsLRArrowTail contained "-" conceal cchar=→ 162 | syntax match hsLRArrowFull "->" contains=hsLRArrowHead,hsLRArrowTail 163 | 164 | syntax match hsRLArrowHead contained "<" conceal cchar=← 165 | syntax match hsRLArrowTail contained "-" conceal cchar= 166 | syntax match hsRLArrowFull "<-" contains=hsRLArrowHead,hsRLArrowTail 167 | 168 | syntax match hsLRDArrowHead contained ">" conceal cchar= 169 | syntax match hsLRDArrowTail contained "=" conceal cchar=⇒ 170 | syntax match hsLRDArrowFull "=>" contains=hsLRDArrowHead,hsLRDArrowTail 171 | endif 172 | 173 | " 's' option to disable space consumption after ∑,∏,√ and ¬ functions. 174 | if Cf('s') 175 | syntax match hsNiceOperator "\" conceal cchar=∑ 176 | syntax match hsNiceOperator "\" conceal cchar=∏ 177 | syntax match hsNiceOperator "\" conceal cchar=√ 178 | syntax match hsNiceOperator "\" conceal cchar=¬ 179 | else 180 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∑ 181 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∏ 182 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=√ 183 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=¬ 184 | endif 185 | 186 | " '*' option to enable concealing of asterisk with '⋅' sign. 187 | if Cf('*') 188 | syntax match hsNiceOperator "*" conceal cchar=⋅ 189 | " 'x' option to disable default concealing of asterisk with '×' sign. 190 | elseif !Cf('x') 191 | syntax match hsNiceOperator "*" conceal cchar=× 192 | endif 193 | 194 | " 'E' option to enable ellipsis concealing with ‥ (two dot leader). 195 | if Cf('E') 196 | " The two dot leader is not guaranteed to be at the bottom. So, it 197 | " will break on some fonts. 198 | syntax match hsNiceOperator "\.\." conceal cchar=‥ 199 | " 'e' option to disable ellipsis concealing with … (ellipsis sign). 200 | elseif !Cf('e') 201 | syntax match hsNiceOperator "\.\." conceal cchar=… 202 | end 203 | 204 | " '⇒' option to disable `implies` concealing with ⇒ 205 | if !Cf('⇒') 206 | " Easily distinguishable from => keyword since the keyword can only be 207 | " used in type signatures. 208 | syntax match hsNiceOperator "`implies`" conceal cchar=⇒ 209 | endif 210 | 211 | " '⇔' option to disable `iff` concealing with ⇔ 212 | if !Cf('⇔') 213 | syntax match hsNiceOperator "`iff`" conceal cchar=⇔ 214 | endif 215 | 216 | " 'r' option to disable return (η) and join (µ) concealing. 217 | if !Cf('r') 218 | syntax match hsNiceOperator "\" conceal cchar=η 219 | syntax match hsNiceOperator "\" conceal cchar=µ 220 | endif 221 | 222 | " 'b' option to disable bind (left and right) concealing 223 | if Cf('b') 224 | " Vim has some issues concealing with composite symbols like '«̳', and 225 | " unfortunately there is no other common short notation for both 226 | " binds. So 'b' option to disable bind concealing altogether. 227 | " 'f' option to enable formal (★) right bind concealing 228 | elseif Cf('f') 229 | syntax match hsNiceOperator ">>=" conceal cchar=★ 230 | " 'c' option to enable encircled b/d (ⓑ/ⓓ) for right and left binds. 231 | elseif Cf('c') 232 | syntax match hsNiceOperator ">>=" conceal cchar=ⓑ 233 | syntax match hsNiceOperator "=<<" conceal cchar=ⓓ 234 | " 'h' option to enable partial concealing of binds (e.g. »=). 235 | elseif Cf('h') 236 | syntax match hsNiceOperator ">>" conceal cchar=» 237 | syntax match hsNiceOperator "<<" conceal cchar=« 238 | syntax match hsNiceOperator "=\zs<<" conceal cchar=« 239 | " Left and right arrows with hooks are the default option for binds. 240 | else 241 | syntax match hsNiceOperator ">>=\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↪ 242 | syntax match hsNiceOperator "=<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↩ 243 | endif 244 | 245 | if !Cf('h') 246 | syntax match hsNiceOperator ">>\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=» 247 | syntax match hsNiceOperator "<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=« 248 | endif 249 | 250 | " 'C' option to enable encircled 'm' letter ⓜ concealing for fmap. 251 | if Cf('C') 252 | syntax match hsNiceOperator "<$>" conceal cchar=ⓜ 253 | syntax match hsNiceOperator "`fmap`" conceal cchar=ⓜ 254 | " 'l' option to disable fmap/lift concealing with ↥. 255 | elseif !Cf('l') 256 | syntax match hsNiceOperator "`liftM`" conceal cchar=↥ 257 | syntax match hsNiceOperator "`liftA`" conceal cchar=↥ 258 | syntax match hsNiceOperator "`fmap`" conceal cchar=↥ 259 | syntax match hsNiceOperator "<$>" conceal cchar=↥ 260 | 261 | syntax match LIFTQ contained "`" conceal 262 | syntax match LIFTQl contained "l" conceal cchar=↥ 263 | syntax match LIFTl contained "l" conceal cchar=↥ 264 | syntax match LIFTi contained "i" conceal 265 | syntax match LIFTf contained "f" conceal 266 | syntax match LIFTt contained "t" conceal 267 | syntax match LIFTA contained "A" conceal 268 | syntax match LIFTM contained "M" conceal 269 | syntax match LIFT2 contained "2" conceal cchar=² 270 | syntax match LIFT3 contained "3" conceal cchar=³ 271 | syntax match LIFT4 contained "4" conceal cchar=⁴ 272 | syntax match LIFT5 contained "5" conceal cchar=⁵ 273 | 274 | syntax match hsNiceOperator "`liftM2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2 275 | syntax match hsNiceOperator "`liftM3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3 276 | syntax match hsNiceOperator "`liftM4`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4 277 | syntax match hsNiceOperator "`liftM5`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5 278 | syntax match hsNiceOperator "`liftA2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2 279 | syntax match hsNiceOperator "`liftA3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3 280 | 281 | syntax match FMAPf contained "f" conceal cchar=↥ 282 | syntax match FMAPm contained "m" conceal 283 | syntax match FMAPa contained "a" conceal 284 | syntax match FMAPp contained "p" conceal 285 | syntax match FMAPSPC contained " " conceal 286 | syntax match hsNiceOperator "\\s*" contains=FMAPf,FMAPm,FMAPa,FMAPp,FMAPSPC 287 | 288 | syntax match LIFTSPC contained " " conceal 289 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFTSPC 290 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2,LIFTSPC 291 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3,LIFTSPC 292 | 293 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFTSPC 294 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2,LIFTSPC 295 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3,LIFTSPC 296 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4,LIFTSPC 297 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5,LIFTSPC 298 | 299 | " TODO: Move liftIO to its own flag? 300 | syntax match LIFTIOL contained "l" conceal 301 | syntax match LIFTI contained "I" conceal cchar=i 302 | syntax match LIFTO contained "O" conceal cchar=o 303 | syntax match hsNiceOperator "\" contains=LIFTIOl,LIFTi,LIFTf,LIFTt,LIFTI,LIFTO 304 | endif 305 | 306 | " '↱' option to disable mapM/forM concealing with ↱/↰ 307 | if !Cf('↱') 308 | syntax match MAPMQ contained "`" conceal 309 | syntax match MAPMm contained "m" conceal cchar=↱ 310 | syntax match MAPMmQ contained "m" conceal cchar=↰ 311 | syntax match MAPMa contained "a" conceal 312 | syntax match MAPMp contained "p" conceal 313 | syntax match MAPMM contained "M" conceal 314 | syntax match MAPMM contained "M" conceal 315 | syntax match MAPMU contained "_" conceal cchar=_ 316 | syntax match SPC contained " " conceal 317 | syntax match hsNiceOperator "`mapM_`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM,MAPMU 318 | syntax match hsNiceOperator "`mapM`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM 319 | syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,SPC 320 | syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,MAPMU,SPC 321 | 322 | syntax match FORMQ contained "`" conceal 323 | syntax match FORMfQ contained "f" conceal cchar=↱ 324 | syntax match FORMf contained "f" conceal cchar=↰ 325 | syntax match FORMo contained "o" conceal 326 | syntax match FORMr contained "r" conceal 327 | syntax match FORMM contained "M" conceal 328 | syntax match FORMU contained "_" conceal cchar=_ 329 | 330 | syntax match hsNiceOperator "`forM`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM 331 | syntax match hsNiceOperator "`forM_`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM,FORMU 332 | 333 | syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,SPC 334 | syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,FORMU,SPC 335 | endif 336 | 337 | " 'w' option to disable 'where' concealing with "due to"/∵ symbol. 338 | if !Cf('w') 339 | " ∵ means "because/since/due to." With quite a stretch this can be 340 | " used for 'where'. We preserve spacing, otherwise it breaks indenting 341 | " in a major way. 342 | syntax match WS contained "w" conceal cchar=∵ 343 | syntax match HS contained "h" conceal cchar= 344 | syntax match ES contained "e" conceal cchar= 345 | syntax match RS contained "r" conceal cchar= 346 | syntax match hsNiceOperator "\" contains=WS,HS,ES,RS,ES 347 | endif 348 | 349 | " '-' option to disable subtract/(-) concealing with ⊟. 350 | if !Cf('-') 351 | " Minus is a special syntax construct in Haskell. We use squared minus to 352 | " tell the syntax from the binary function. 353 | syntax match hsNiceOperator "(-)" conceal cchar=⊟ 354 | syntax match hsNiceOperator "`subtract`" conceal cchar=⊟ 355 | endif 356 | 357 | " 'I' option to enable alternative ':+' concealing with with ⨢. 358 | if Cf('I') 359 | " With some fonts might look better than ⅈ. 360 | syntax match hsNiceOperator ":+" conceal cchar=⨢ 361 | " 'i' option to disable default concealing of ':+' with ⅈ. 362 | elseif !Cf('i') 363 | syntax match COLON contained ":" conceal cchar=+ 364 | syntax match PLUS contained "+" conceal cchar= 365 | syntax match SPACE contained " " conceal cchar=ⅈ 366 | syntax match hsNiceOperator ":+ " contains=COLON,PLUS,SPACE 367 | "syntax match hsNiceOperator ":+" conceal cchar=ⅈ 368 | endif 369 | 370 | " 'R' option to disable realPart/imagPart concealing with ℜ/ℑ. 371 | if !Cf('R') 372 | syntax match hsNiceOperator "\" conceal cchar=ℜ 373 | syntax match hsNiceOperator "\" conceal cchar=ℑ 374 | endif 375 | 376 | " 'T' option to enable True/False constants concealing with bold 𝐓/𝐅. 377 | if Cf('T') 378 | syntax match hsNiceSpecial "\" conceal cchar=𝐓 379 | syntax match hsNiceSpecial "\" conceal cchar=𝐅 380 | " 't' option to disable True/False constants concealing with italic 𝑇/𝐹. 381 | elseif !Cf('t') 382 | syntax match hsNiceSpecial "\" conceal cchar=𝑇 383 | syntax match hsNiceSpecial "\" conceal cchar=𝐹 384 | endif 385 | 386 | " 'B' option to disable Bool type to 𝔹 concealing 387 | if !Cf('B') 388 | " Not an official notation ttbomk. But at least 389 | " http://www.haskell.org/haskellwiki/Unicode-symbols mentions it. 390 | syntax match hsNiceOperator "\" conceal cchar=𝔹 391 | endif 392 | 393 | " 'Q' option to disable Rational type to ℚ concealing. 394 | if !Cf('Q') 395 | syntax match hsNiceOperator "\" conceal cchar=ℚ 396 | endif 397 | 398 | " 'Z' option to disable Integer type to ℤ concealing. 399 | if !Cf('Z') 400 | syntax match hsNiceOperator "\" conceal cchar=ℤ 401 | endif 402 | 403 | " 'N' option to disable Natural, Nat types to ℕ concealing. 404 | if !Cf('N') 405 | syntax match hsNiceOperator "\" conceal cchar=ℕ 406 | syntax match hsNiceOperator "\" conceal cchar=ℕ 407 | endif 408 | 409 | " 'D' option to disable Double type to 𝔻 concealing 410 | if !Cf('D') 411 | syntax match hsNiceOperator "\" conceal cchar=𝔻 412 | endif 413 | 414 | " 'C' option to disable Complex type to ℂ concealing 415 | if !Cf('C') 416 | syntax match hasNiceOperator "\" conceal cchar=ℂ 417 | endif 418 | 419 | " '1' option to disable numeric superscripts concealing, e.g. x². 420 | if !Cf('1') 421 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)0\ze\_W" conceal cchar=⁰ 422 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)1\ze\_W" conceal cchar=¹ 423 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)2\ze\_W" conceal cchar=² 424 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)3\ze\_W" conceal cchar=³ 425 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)4\ze\_W" conceal cchar=⁴ 426 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)5\ze\_W" conceal cchar=⁵ 427 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)6\ze\_W" conceal cchar=⁶ 428 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)7\ze\_W" conceal cchar=⁷ 429 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)8\ze\_W" conceal cchar=⁸ 430 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)9\ze\_W" conceal cchar=⁹ 431 | endif 432 | 433 | " 'a' option to disable alphabet superscripts concealing, e.g. xⁿ. 434 | if !Cf('a') 435 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)a\ze\_W" conceal cchar=ᵃ 436 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)b\ze\_W" conceal cchar=ᵇ 437 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)c\ze\_W" conceal cchar=ᶜ 438 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)d\ze\_W" conceal cchar=ᵈ 439 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)e\ze\_W" conceal cchar=ᵉ 440 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)f\ze\_W" conceal cchar=ᶠ 441 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)g\ze\_W" conceal cchar=ᵍ 442 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)h\ze\_W" conceal cchar=ʰ 443 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)i\ze\_W" conceal cchar=ⁱ 444 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)j\ze\_W" conceal cchar=ʲ 445 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)k\ze\_W" conceal cchar=ᵏ 446 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)l\ze\_W" conceal cchar=ˡ 447 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)m\ze\_W" conceal cchar=ᵐ 448 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)n\ze\_W" conceal cchar=ⁿ 449 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)o\ze\_W" conceal cchar=ᵒ 450 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)p\ze\_W" conceal cchar=ᵖ 451 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)r\ze\_W" conceal cchar=ʳ 452 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)s\ze\_W" conceal cchar=ˢ 453 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)t\ze\_W" conceal cchar=ᵗ 454 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)u\ze\_W" conceal cchar=ᵘ 455 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)v\ze\_W" conceal cchar=ᵛ 456 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)w\ze\_W" conceal cchar=ʷ 457 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)x\ze\_W" conceal cchar=ˣ 458 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)y\ze\_W" conceal cchar=ʸ 459 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)z\ze\_W" conceal cchar=ᶻ 460 | endif 461 | 462 | " Not really Haskell, but quite handy for writing proofs in pseudo-code. 463 | if Cf('∴') 464 | syntax match hsNiceOperator "\" conceal cchar=∴ 465 | syntax match hsNiceOperator "\" conceal cchar=∃ 466 | syntax match hsNiceOperator "\" conceal cchar=∄ 467 | syntax match hsNiceOperator ":=" conceal cchar=≝ 468 | endif 469 | 470 | " TODO: 471 | " See Basic Syntax Extensions - School of Haskell | FP Complete 472 | " intersection = (∩) 473 | " 474 | " From the Data.IntMap.Strict.Unicode 475 | " notMember = (∉) = flip (∌) 476 | " member = (∈) = flip (∋) 477 | " isProperSubsetOf = (⊂) = flip (⊃) 478 | " 479 | " From Data.Sequence.Unicode 480 | " (<|) = (⊲ ) 481 | " (|>) = (⊳ ) 482 | " (><) = (⋈ ) 483 | -------------------------------------------------------------------------------- /after/syntax/lhaskell.vim: -------------------------------------------------------------------------------- 1 | " vim: sw=4 2 | "============================================================================= 3 | " What Is This: Add some conceal operator for your literate haskell files 4 | " File: lhaskell.vim (conceal enhancement) 5 | " Last Change: 2015-11-13 6 | " Version: 1.3.3 7 | " Require: 8 | " set nocompatible 9 | " somewhere on your .vimrc 10 | " 11 | " Vim 7.3 or Vim compiled with conceal patch. 12 | " Use --with-features=big or huge in order to compile it in. 13 | " 14 | " Usage: 15 | " Drop this file in your 16 | " ~/.vim/after/syntax folder (Linux/MacOSX/BSD...) 17 | " ~/vimfiles/after/syntax folder (Windows) 18 | " 19 | " For this script to work, you have to set the encoding 20 | " to utf-8 :set enc=utf-8 21 | " 22 | " Additional: 23 | " * if you want to avoid the loading, add the following 24 | " line in your .vimrc : 25 | " let g:no_haskell_conceal = 1 26 | " Changelog: 27 | " - 1.3.3: lhaskell.vim added, only concealing inside code (\begin, >>) tags. 28 | " - 1.3.1: putting undefined in extra conceal, not appearing on windows 29 | " - 1.3: adding new arrow characters used by GHC in Unicode extension. 30 | " - 1.2: Fixing conceal level to be local (thx Erlend Hamberg) 31 | " - 1.1: Better handling of non utf-8 systems, and avoid some 32 | " concealing operations on windows on some fonts 33 | " 34 | 35 | 36 | " Cf - check a flag. Return true if the flag is specified. 37 | function! Cf(flag) 38 | return exists('g:hscoptions') && stridx(g:hscoptions, a:flag) >= 0 39 | endfunction 40 | 41 | if exists('g:no_haskell_conceal') || !has('conceal') || &enc != 'utf-8' 42 | finish 43 | endif 44 | 45 | syntax cluster haskellTop add=hsNiceOperator 46 | 47 | " vim: set fenc=utf-8: 48 | syntax match hsNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ contained 49 | 50 | " 'q' option to disable concealing of scientific constants (e.g. π). 51 | if !Cf('q') 52 | syntax match hsNiceOperator "\" conceal cchar=π contained 53 | syntax match hsNiceOperator "\" conceal cchar=τ contained 54 | syntax match hsNiceOperator "\" conceal cchar=ℎ contained 55 | syntax match hsNiceOperator "\" conceal cchar=ℏ contained 56 | endif 57 | 58 | syntax match hsNiceOperator "==" conceal cchar=≡ contained 59 | syntax match hsNiceOperator "\/=" conceal cchar=≢ contained 60 | 61 | let s:extraConceal = 1 62 | " Some windows font don't support some of the characters, 63 | " so if they are the main font, we don't load them :) 64 | if has("win32") 65 | let s:incompleteFont = [ 'Consolas' 66 | \ , 'Lucida Console' 67 | \ , 'Courier New' 68 | \ ] 69 | let s:mainfont = substitute( &guifont, '^\([^:,]\+\).*', '\1', '') 70 | for s:fontName in s:incompleteFont 71 | if s:mainfont ==? s:fontName 72 | let s:extraConceal = 0 73 | break 74 | endif 75 | endfor 76 | endif 77 | 78 | if s:extraConceal 79 | syntax match hsNiceOperator "\" conceal cchar=⊥ contained 80 | 81 | " Match greater than and lower than w/o messing with Kleisli composition 82 | syntax match hsNiceOperator "<=\ze[^<]" conceal cchar=≤ contained 83 | syntax match hsNiceOperator ">=\ze[^>]" conceal cchar=≥ contained 84 | 85 | " Redfining to get proper '::' concealing 86 | syntax match hs_DeclareFunction /^[a-z_(]\S*\(\s\|\n\)*::/me=e-2 nextgroup=hsNiceOperator contains=hs_FunctionName,hs_OpFunctionName contained 87 | 88 | syntax match hsNiceoperator "!!" conceal cchar=‼ contained 89 | syntax match hsNiceoperator "++\ze[^+]" conceal cchar=⧺ contained 90 | syntax match hsNiceOperator "\" conceal cchar=∀ contained 91 | syntax match hsNiceOperator "-<" conceal cchar=↢ contained 92 | syntax match hsNiceOperator ">-" conceal cchar=↣ contained 93 | syntax match hsNiceOperator "-<<" conceal cchar=⤛ contained 94 | syntax match hsNiceOperator ">>-" conceal cchar=⤜ contained 95 | " the star does not seem so good... 96 | " syntax match hsNiceOperator "*" conceal cchar=★ 97 | syntax match hsNiceOperator "`div`" conceal cchar=÷ contained 98 | 99 | " Only replace the dot, avoid taking spaces around. 100 | syntax match hsNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘ contained 101 | 102 | syntax match hsQQEnd "|\]" contained conceal cchar=〛 contained 103 | " sy match hsQQEnd "|\]" contained conceal=〚 104 | 105 | syntax match hsNiceOperator "`elem`" conceal cchar=∈ contained 106 | syntax match hsNiceOperator "`notElem`" conceal cchar=∉ contained 107 | syntax match hsNiceOperator "`isSubsetOf`" conceal cchar=⊆ contained 108 | syntax match hsNiceOperator "`union`" conceal cchar=∪ contained 109 | syntax match hsNiceOperator "`intersect`" conceal cchar=∩ contained 110 | syntax match hsNiceOperator "\\\\\ze[[:alpha:][:space:]_([]" conceal cchar=∖ contained 111 | 112 | syntax match hsNiceOperator "||\ze[[:alpha:][:space:]_([]" conceal cchar=∨ contained 113 | syntax match hsNiceOperator "&&\ze[[:alpha:][:space:]_([]" conceal cchar=∧ contained 114 | 115 | syntax match hsNiceOperator "<\*>" conceal cchar=⊛ contained 116 | syntax match hsNiceOperator "`mappend`" conceal cchar=⊕ contained 117 | syntax match hsNiceOperator "\" conceal cchar=⊕ 118 | syntax match hsNiceOperator "<>" conceal cchar=⊕ contained 119 | syntax match hsNiceOperator "\" conceal cchar=∅ contained 120 | syntax match hsNiceOperator "\" conceal cchar=∅ contained 121 | syntax match hsNiceOperator "\" conceal cchar=∅ contained 122 | endif 123 | 124 | hi link hsNiceOperator Operator 125 | hi! link Conceal Operator 126 | setlocal conceallevel=2 127 | 128 | " '℘' option to disable concealing of powerset function 129 | if !Cf('℘') 130 | syntax match hsNiceOperator "\" conceal cchar=℘ contained 131 | endif 132 | 133 | " '𝐒' option to disable String type to 𝐒 concealing 134 | if !Cf('𝐒') 135 | syntax match hsNiceOperator "\" conceal cchar=𝐒 contained 136 | endif 137 | 138 | " '𝐓' option to disable Text type to 𝐓 concealing 139 | if !Cf('𝐓') 140 | syntax match hsNiceOperator "\" conceal cchar=𝐓 contained 141 | endif 142 | 143 | " '𝐄' option to disable Either/Right/Left to 𝐄/𝑅/𝐿 concealing 144 | if !Cf('𝐄') 145 | syntax match hsNiceOperator "\" conceal cchar=𝐄 contained 146 | syntax match hsNiceOperator "\" conceal cchar=𝑅 contained 147 | syntax match hsNiceOperator "\" conceal cchar=𝐿 contained 148 | endif 149 | 150 | " '𝐌' option to disable Maybe/Just/Nothing to 𝐌/𝐽/𝑁 concealing 151 | if !Cf('𝐌') 152 | syntax match hsNiceOperator "\" conceal cchar=𝐌 contained 153 | syntax match hsNiceOperator "\" conceal cchar=𝐽 contained 154 | syntax match hsNiceOperator "\" conceal cchar=𝑁 contained 155 | endif 156 | 157 | " 'A' option to not try to preserve indentation. 158 | if Cf('A') 159 | syntax match hsNiceOperator "<-" conceal cchar=← contained 160 | syntax match hsNiceOperator "->" conceal cchar=→ contained 161 | syntax match hsNiceOperator "=>" conceal cchar=⇒ contained 162 | syntax match hsNiceOperator "\:\:" conceal cchar=∷ contained 163 | else 164 | syntax match hsLRArrowHead contained ">" conceal cchar= contained 165 | syntax match hsLRArrowTail contained "-" conceal cchar=→ contained 166 | syntax match hsLRArrowFull "->" contains=hsLRArrowHead,hsLRArrowTail contained 167 | 168 | syntax match hsRLArrowHead contained "<" conceal cchar=← contained 169 | syntax match hsRLArrowTail contained "-" conceal cchar= contained 170 | syntax match hsRLArrowFull "<-" contains=hsRLArrowHead,hsRLArrowTail contained 171 | 172 | syntax match hsLRDArrowHead contained ">" conceal cchar= contained 173 | syntax match hsLRDArrowTail contained "=" conceal cchar=⇒ contained 174 | syntax match hsLRDArrowFull "=>" contains=hsLRDArrowHead,hsLRDArrowTail contained 175 | endif 176 | 177 | " 's' option to disable space consumption after ∑,∏,√ and ¬ functions. 178 | if Cf('s') 179 | syntax match hsNiceOperator "\" conceal cchar=∑ contained 180 | syntax match hsNiceOperator "\" conceal cchar=∏ contained 181 | syntax match hsNiceOperator "\" conceal cchar=√ contained 182 | syntax match hsNiceOperator "\" conceal cchar=¬ contained 183 | else 184 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∑ contained 185 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∏ contained 186 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=√ contained 187 | syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=¬ contained 188 | endif 189 | 190 | " '*' option to enable concealing of asterisk with '⋅' sign. 191 | if Cf('*') 192 | syntax match hsNiceOperator "*" conceal cchar=⋅ contained 193 | " 'x' option to disable default concealing of asterisk with '×' sign. 194 | elseif !Cf('x') 195 | syntax match hsNiceOperator "*" conceal cchar=× contained 196 | endif 197 | 198 | " 'E' option to enable ellipsis concealing with ‥ (two dot leader). 199 | if Cf('E') 200 | " The two dot leader is not guaranteed to be at the bottom. So, it 201 | " will break on some fonts. 202 | syntax match hsNiceOperator "\.\." conceal cchar=‥ contained 203 | " 'e' option to disable ellipsis concealing with … (ellipsis sign). 204 | elseif !Cf('e') 205 | syntax match hsNiceOperator "\.\." conceal cchar=… contained 206 | end 207 | 208 | " '⇒' option to disable `implies` concealing with ⇒ 209 | if !Cf('⇒') 210 | " Easily distinguishable from => keyword since the keyword can only be 211 | " used in type signatures. 212 | syntax match hsNiceOperator "`implies`" conceal cchar=⇒ contained 213 | endif 214 | 215 | " '⇔' option to disable `iff` concealing with ⇔ 216 | if !Cf('⇔') 217 | syntax match hsNiceOperator "`iff`" conceal cchar=⇔ contained 218 | endif 219 | 220 | " 'r' option to disable return (η) and join (µ) concealing. 221 | if !Cf('r') 222 | syntax match hsNiceOperator "\" conceal cchar=η contained 223 | syntax match hsNiceOperator "\" conceal cchar=µ contained 224 | endif 225 | 226 | " 'b' option to disable bind (left and right) concealing 227 | if Cf('b') 228 | " Vim has some issues concealing with composite symbols like '«̳', and 229 | " unfortunately there is no other common short notation for both 230 | " binds. So 'b' option to disable bind concealing altogether. 231 | " 'f' option to enable formal (★) right bind concealing 232 | elseif Cf('f') 233 | syntax match hsNiceOperator ">>=" conceal cchar=★ contained 234 | " 'c' option to enable encircled b/d (ⓑ/ⓓ) for right and left binds. 235 | elseif Cf('c') 236 | syntax match hsNiceOperator ">>=" conceal cchar=ⓑ contained 237 | syntax match hsNiceOperator "=<<" conceal cchar=ⓓ contained 238 | " 'h' option to enable partial concealing of binds (e.g. »=). 239 | elseif Cf('h') 240 | syntax match hsNiceOperator ">>" conceal cchar=» contained 241 | syntax match hsNiceOperator "<<" conceal cchar=« contained 242 | syntax match hsNiceOperator "=\zs<<" conceal cchar=« contained 243 | " Left and right arrows with hooks are the default option for binds. 244 | else 245 | syntax match hsNiceOperator ">>=\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↪ contained 246 | syntax match hsNiceOperator "=<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↩ contained 247 | endif 248 | 249 | if !Cf('h') 250 | syntax match hsNiceOperator ">>\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=» contained 251 | syntax match hsNiceOperator "<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=« contained 252 | endif 253 | 254 | " 'C' option to enable encircled 'm' letter ⓜ concealing for fmap. 255 | if Cf('C') 256 | syntax match hsNiceOperator "<$>" conceal cchar=ⓜ contained 257 | syntax match hsNiceOperator "`fmap`" conceal cchar=ⓜ contained 258 | " 'l' option to disable fmap/lift concealing with ↥. 259 | elseif !Cf('l') 260 | syntax match hsNiceOperator "`liftM`" conceal cchar=↥ contained 261 | syntax match hsNiceOperator "`liftA`" conceal cchar=↥ contained 262 | syntax match hsNiceOperator "`fmap`" conceal cchar=↥ contained 263 | syntax match hsNiceOperator "<$>" conceal cchar=↥ contained 264 | 265 | syntax match LIFTQ contained "`" conceal contained 266 | syntax match LIFTQl contained "l" conceal cchar=↥ contained 267 | syntax match LIFTl contained "l" conceal cchar=↥ contained 268 | syntax match LIFTi contained "i" conceal contained 269 | syntax match LIFTf contained "f" conceal contained 270 | syntax match LIFTt contained "t" conceal contained 271 | syntax match LIFTA contained "A" conceal contained 272 | syntax match LIFTM contained "M" conceal contained 273 | syntax match LIFT2 contained "2" conceal cchar=² contained 274 | syntax match LIFT3 contained "3" conceal cchar=³ contained 275 | syntax match LIFT4 contained "4" conceal cchar=⁴ contained 276 | syntax match LIFT5 contained "5" conceal cchar=⁵ contained 277 | 278 | syntax match hsNiceOperator "`liftM2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2 contained 279 | syntax match hsNiceOperator "`liftM3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3 contained 280 | syntax match hsNiceOperator "`liftM4`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4 contained 281 | syntax match hsNiceOperator "`liftM5`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5 contained 282 | syntax match hsNiceOperator "`liftA2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2 contained 283 | syntax match hsNiceOperator "`liftA3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3 contained 284 | 285 | syntax match FMAPf contained "f" conceal cchar=↥ contained 286 | syntax match FMAPm contained "m" conceal contained 287 | syntax match FMAPa contained "a" conceal contained 288 | syntax match FMAPp contained "p" conceal contained 289 | syntax match FMAPSPC contained " " conceal contained 290 | syntax match hsNiceOperator "\\s*" contains=FMAPf,FMAPm,FMAPa,FMAPp,FMAPSPC contained 291 | 292 | syntax match LIFTSPC contained " " conceal contained 293 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFTSPC contained 294 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2,LIFTSPC contained 295 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3,LIFTSPC contained 296 | 297 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFTSPC contained 298 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2,LIFTSPC contained 299 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3,LIFTSPC contained 300 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4,LIFTSPC contained 301 | syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5,LIFTSPC contained 302 | 303 | " TODO: Move liftIO to its own flag? 304 | syntax match LIFTIOL contained "l" conceal contained 305 | syntax match LIFTI contained "I" conceal cchar=i contained 306 | syntax match LIFTO contained "O" conceal cchar=o contained 307 | syntax match hsNiceOperator "\" contains=LIFTIOl,LIFTi,LIFTf,LIFTt,LIFTI,LIFTO contained 308 | endif 309 | 310 | " '↱' option to disable mapM/forM concealing with ↱/↰ 311 | if !Cf('↱') 312 | syntax match MAPMQ contained "`" conceal contained 313 | syntax match MAPMm contained "m" conceal cchar=↱ contained 314 | syntax match MAPMmQ contained "m" conceal cchar=↰ contained 315 | syntax match MAPMa contained "a" conceal contained 316 | syntax match MAPMp contained "p" conceal contained 317 | syntax match MAPMM contained "M" conceal contained 318 | syntax match MAPMM contained "M" conceal contained 319 | syntax match MAPMU contained "_" conceal cchar=_ contained 320 | syntax match SPC contained " " conceal contained 321 | syntax match hsNiceOperator "`mapM_`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM,MAPMU contained 322 | syntax match hsNiceOperator "`mapM`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM contained 323 | syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,SPC contained 324 | syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,MAPMU,SPC contained 325 | 326 | syntax match FORMQ contained "`" conceal contained 327 | syntax match FORMfQ contained "f" conceal cchar=↱ contained 328 | syntax match FORMf contained "f" conceal cchar=↰ contained 329 | syntax match FORMo contained "o" conceal contained 330 | syntax match FORMr contained "r" conceal contained 331 | syntax match FORMM contained "M" conceal contained 332 | syntax match FORMU contained "_" conceal cchar=_ contained 333 | 334 | syntax match hsNiceOperator "`forM`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM contained 335 | syntax match hsNiceOperator "`forM_`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM,FORMU contained 336 | 337 | syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,SPC contained 338 | syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,FORMU,SPC contained 339 | endif 340 | 341 | " 'w' option to disable 'where' concealing with "due to"/∵ symbol. 342 | if !Cf('w') 343 | " ∵ means "because/since/due to." With quite a stretch this can be 344 | " used for 'where'. We preserve spacing, otherwise it breaks indenting 345 | " in a major way. 346 | syntax match WS contained "w" conceal cchar=∵ contained 347 | syntax match HS contained "h" conceal cchar= contained 348 | syntax match ES contained "e" conceal cchar= contained 349 | syntax match RS contained "r" conceal cchar= contained 350 | syntax match hsNiceOperator "\" contains=WS,HS,ES,RS,ES contained 351 | endif 352 | 353 | " '-' option to disable subtract/(-) concealing with ⊟. 354 | if !Cf('-') 355 | " Minus is a special syntax construct in Haskell. We use squared minus to 356 | " tell the syntax from the binary function. 357 | syntax match hsNiceOperator "(-)" conceal cchar=⊟ contained 358 | syntax match hsNiceOperator "`subtract`" conceal cchar=⊟ contained 359 | endif 360 | 361 | " 'I' option to enable alternative ':+' concealing with with ⨢. 362 | if Cf('I') 363 | " With some fonts might look better than ⅈ. 364 | syntax match hsNiceOperator ":+" conceal cchar=⨢ contained 365 | " 'i' option to disable default concealing of ':+' with ⅈ. 366 | elseif !Cf('i') 367 | syntax match hsNiceOperator ":+" conceal cchar=ⅈ contained 368 | endif 369 | 370 | " 'R' option to disable realPart/imagPart concealing with ℜ/ℑ. 371 | if !Cf('R') 372 | syntax match hsNiceOperator "\" conceal cchar=ℜ contained 373 | syntax match hsNiceOperator "\" conceal cchar=ℑ contained 374 | endif 375 | 376 | " 'T' option to enable True/False constants concealing with bold 𝐓/𝐅. 377 | if Cf('T') 378 | syntax match hsNiceSpecial "\" conceal cchar=𝐓 contained 379 | syntax match hsNiceSpecial "\" conceal cchar=𝐅 contained 380 | " 't' option to disable True/False constants concealing with italic 𝑇/𝐹. 381 | elseif !Cf('t') 382 | syntax match hsNiceSpecial "\" conceal cchar=𝑇 contained 383 | syntax match hsNiceSpecial "\" conceal cchar=𝐹 contained 384 | endif 385 | 386 | " 'B' option to disable Bool type to 𝔹 concealing 387 | if !Cf('B') 388 | " Not an official notation ttbomk. But at least 389 | " http://www.haskell.org/haskellwiki/Unicode-symbols mentions it. 390 | syntax match hsNiceOperator "\" conceal cchar=𝔹 contained 391 | endif 392 | 393 | " 'Q' option to disable Rational type to ℚ concealing. 394 | if !Cf('Q') 395 | syntax match hsNiceOperator "\" conceal cchar=ℚ 396 | endif 397 | 398 | " 'Z' option to disable Integer type to ℤ concealing. 399 | if !Cf('Z') 400 | syntax match hsNiceOperator "\" conceal cchar=ℤ contained 401 | endif 402 | 403 | " 'N' option to disable Natural, Nat types to ℕ concealing. 404 | if !Cf('N') 405 | syntax match hsNiceOperator "\" conceal cchar=ℕ contained 406 | syntax match hsNiceOperator "\" conceal cchar=ℕ contained 407 | endif 408 | 409 | " '𝔻' option to disable Double type to 𝔻 concealing 410 | if !Cf('𝔻') 411 | syntax match hsNiceOperator "\" conceal cchar=𝔻 contained 412 | endif 413 | 414 | " '1' option to disable numeric superscripts concealing, e.g. x². 415 | if !Cf('1') 416 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)0\ze\_W" conceal cchar=⁰ contained 417 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)1\ze\_W" conceal cchar=¹ contained 418 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)2\ze\_W" conceal cchar=² contained 419 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)3\ze\_W" conceal cchar=³ contained 420 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)4\ze\_W" conceal cchar=⁴ contained 421 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)5\ze\_W" conceal cchar=⁵ contained 422 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)6\ze\_W" conceal cchar=⁶ contained 423 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)7\ze\_W" conceal cchar=⁷ contained 424 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)8\ze\_W" conceal cchar=⁸ contained 425 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)9\ze\_W" conceal cchar=⁹ contained 426 | endif 427 | 428 | " 'a' option to disable alphabet superscripts concealing, e.g. xⁿ. 429 | if !Cf('a') 430 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)a\ze\_W" conceal cchar=ᵃ contained 431 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)b\ze\_W" conceal cchar=ᵇ contained 432 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)c\ze\_W" conceal cchar=ᶜ contained 433 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)d\ze\_W" conceal cchar=ᵈ contained 434 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)e\ze\_W" conceal cchar=ᵉ contained 435 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)f\ze\_W" conceal cchar=ᶠ contained 436 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)g\ze\_W" conceal cchar=ᵍ contained 437 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)h\ze\_W" conceal cchar=ʰ contained 438 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)i\ze\_W" conceal cchar=ⁱ contained 439 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)j\ze\_W" conceal cchar=ʲ contained 440 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)k\ze\_W" conceal cchar=ᵏ contained 441 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)l\ze\_W" conceal cchar=ˡ contained 442 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)m\ze\_W" conceal cchar=ᵐ contained 443 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)n\ze\_W" conceal cchar=ⁿ contained 444 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)o\ze\_W" conceal cchar=ᵒ contained 445 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)p\ze\_W" conceal cchar=ᵖ contained 446 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)r\ze\_W" conceal cchar=ʳ contained 447 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)s\ze\_W" conceal cchar=ˢ contained 448 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)t\ze\_W" conceal cchar=ᵗ contained 449 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)u\ze\_W" conceal cchar=ᵘ contained 450 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)v\ze\_W" conceal cchar=ᵛ contained 451 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)w\ze\_W" conceal cchar=ʷ contained 452 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)x\ze\_W" conceal cchar=ˣ contained 453 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)y\ze\_W" conceal cchar=ʸ contained 454 | syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)z\ze\_W" conceal cchar=ᶻ contained 455 | endif 456 | 457 | " Not really Haskell, but quite handy for writing proofs in pseudo-code. 458 | if Cf('∴') 459 | syntax match hsNiceOperator "\" conceal cchar=∴ contained 460 | syntax match hsNiceOperator "\" conceal cchar=∃ contained 461 | syntax match hsNiceOperator "\" conceal cchar=∄ contained 462 | syntax match hsNiceOperator ":=" conceal cchar=≝ contained 463 | endif 464 | 465 | " TODO: 466 | " See Basic Syntax Extensions - School of Haskell | FP Complete 467 | " intersection = (∩) 468 | " 469 | " From the Data.IntMap.Strict.Unicode 470 | " notMember = (∉) = flip (∌) 471 | " member = (∈) = flip (∋) 472 | " isProperSubsetOf = (⊂) = flip (⊃) 473 | " 474 | " From Data.Sequence.Unicode 475 | " (<|) = (⊲ ) 476 | " (|>) = (⊳ ) 477 | " (><) = (⋈ ) 478 | -------------------------------------------------------------------------------- /demo.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ExistentialQuantification, RankNTypes #-} 2 | import Control.Applicative 3 | import Data.Monoid 4 | import Control.Monad.ST.Lazy 5 | import Control.Monad 6 | import Numeric 7 | import Data.Complex 8 | import Data.List 9 | 10 | factorial :: Integer -> Integer 11 | factorial n = product as 12 | where as = [n, n-1..1] 13 | 14 | integral :: (Num a, Enum a) => (a -> a) -> a -> (a,a) -> a 15 | integral f dx (a,b) = sum ((\x -> f(x)*dx) <$> ab) 16 | where ab = [a,a+dx..b-dx] 17 | 18 | isValid :: Integer -> Bool -> Bool -> Bool 19 | isValid a b c = (a >= 0 && a <= 10) || (b && not c) 20 | 21 | rs :: forall a. (forall s. ST s a) -> a 22 | rs = runST 23 | 24 | main :: IO () 25 | main = do 26 | let tau = 2*pi 27 | putSL $ showF 2 $ integral sin 0.001 (pi,tau) 28 | print $ unsafe [pi,tau] 29 | print $ factorial <$> [1..13`div`2] 30 | print $ texNum . showF 2 <$> (mag <$> [1,2] <*> [3,4]) 31 | print $ Just True >>= (\x -> return $ x `elem` [True, False, False]) 32 | >>= (\x -> if x /= True 33 | then Nothing 34 | else return True) 35 | >>= (\x -> return $ isValid 1 True x) 36 | print $ [1,2] `union` [3,4] == [-9,-8..4] `intersect` [1,2..9] 37 | print $ (++"il") <$> (Just "fa" >> guard False >> return undefined) 38 | print $ realPart(4:+2) == imagPart(2:+4) 39 | print $ liftM3 (\x y z -> x+y+z) [1] [2] [39] 40 | putSL $ "Hask" <> "ell" 41 | where 42 | mag a b = sqrt(a^2 + b^2) 43 | showF n f = showFFloat (Just n) f empty 44 | unsafe xs = (xs!!0,xs!!1) 45 | texNum num = "$\\num{" ++ num ++ "}$" 46 | putSL = putStrLn 47 | -------------------------------------------------------------------------------- /demo.lhs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ExistentialQuantification, RankNTypes #-} 2 | import Control.Applicative 3 | >> import Control.Applicative 4 | import Data.Monoid 5 | >> import Data.Monoid 6 | import Control.Monad.ST.Lazy 7 | >> import Control.Monad.ST.Lazy 8 | import Control.Monad 9 | >> import Control.Monad 10 | import Numeric 11 | >> import Numeric 12 | import Data.Complex 13 | >> import Data.Complex 14 | import Data.List 15 | >> import Data.List 16 | 17 | factorial :: Integer -> Integer 18 | factorial n = product as 19 | where as = [n, n-1..1] 20 | 21 | >> factorial :: Integer -> Integer 22 | >> factorial n = product as 23 | >> where as = [n, n-1..1] 24 | 25 | integral :: (Num a, Enum a) => (a -> a) -> a -> (a,a) -> a 26 | integral f dx (a,b) = sum ((\x -> f(x)*dx) <$> ab) 27 | where ab = [a,a+dx..b-dx] 28 | 29 | >> integral :: (Num a, Enum a) => (a -> a) -> a -> (a,a) -> a 30 | >> integral f dx (a,b) = sum ((\x -> f(x)*dx) <$> ab) 31 | >> where ab = [a,a+dx..b-dx] 32 | 33 | isValid :: Integer -> Bool -> Bool -> Bool 34 | isValid a b c = (a >= 0 && a <= 10) || (b && not c) 35 | 36 | >> isValid :: Integer -> Bool -> Bool -> Bool 37 | >> isValid a b c = (a >= 0 && a <= 10) || (b && not c) 38 | 39 | rs :: forall a. (forall s. ST s a) -> a 40 | rs = runST 41 | >> rs :: forall a. (forall s. ST s a) -> a 42 | >> rs = runST 43 | 44 | main :: IO () 45 | main = do 46 | let tau = 2*pi 47 | putSL $ showF 2 $ integral sin 0.001 (pi,tau) 48 | print $ unsafe [pi,tau] 49 | print $ factorial <$> [1..13`div`2] 50 | print $ texNum . showF 2 <$> (mag <$> [1,2] <*> [3,4]) 51 | print $ Just True >>= (\x -> return $ x `elem` [True, False, False]) 52 | >>= (\x -> if x /= True 53 | then Nothing 54 | else return True) 55 | >>= (\x -> return $ isValid 1 True x) 56 | print $ [1,2] `union` [3,4] == [-9,-8..4] `intersect` [1,2..9] 57 | print $ (++"il") <$> (Just "fa" >> guard False >> return undefined) 58 | print $ realPart(4:+2) == imagPart(2:+4) 59 | print $ liftM3 (\x y z -> x+y+z) [1] [2] [39] 60 | putSL $ "Hask" <> "ell" 61 | where 62 | mag a b = sqrt(a^2 + b^2) 63 | showF n f = showFFloat (Just n) f empty 64 | unsafe xs = (xs!!0,xs!!1) 65 | texNum num = "$\\num{" ++ num ++ "}$" 66 | putSL = putStrLn 67 | 68 | >> main :: IO () 69 | >> main = do 70 | >> let tau = 2*pi 71 | >> putSL $ showF 2 $ integral sin 0.001 (pi,tau) 72 | >> print $ unsafe [pi,tau] 73 | >> print $ factorial <$> [1..13`div`2] 74 | >> print $ texNum . showF 2 <$> (mag <$> [1,2] <*> [3,4]) 75 | >> print $ Just True >>= (\x -> return $ x `elem` [True, False, False]) 76 | >> >>= (\x -> if x /= True 77 | >> then Nothing 78 | >> else return True) 79 | >> >>= (\x -> return $ isValid 1 True x) 80 | >> print $ [1,2] `union` [3,4] == [-9,-8..4] `intersect` [1,2..9] 81 | >> print $ (++"il") <$> (Just "fa" >> guard False >> return undefined) 82 | >> print $ realPart(4:+2) == imagPart(2:+4) 83 | >> print $ liftM3 (\x y z -> x+y+z) [1] [2] [39] 84 | >> putSL $ "Hask" <> "ell" 85 | >> where 86 | >> mag a b = sqrt(a^2 + b^2) 87 | >> showF n f = showFFloat (Just n) f empty 88 | >> unsafe xs = (xs!!0,xs!!1) 89 | >> texNum num = "$\\num{" ++ num ++ "}$" 90 | >> putSL = putStrLn 91 | -------------------------------------------------------------------------------- /demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enomsg/vim-haskellConcealPlus/d59da33c16966f694b2e4f0bfc57515a935da83f/demo.png -------------------------------------------------------------------------------- /gendemo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm s{l,r}.png 4 | convert -crop 490x685+0+35 l.png sl.png 5 | convert -crop 640x685+0+35 r.png sr.png 6 | convert sl.png sr.png +append demo.png 7 | -------------------------------------------------------------------------------- /tests/test-with-pack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | tag=test 5 | 6 | docker build -t "$tag" - << EOF_DOCKERFILE 7 | from debian:buster 8 | 9 | run apt-get update 10 | 11 | run apt-get install -y locales 12 | run echo en_US.UTF-8 UTF-8 > /etc/locale.gen 13 | run dpkg-reconfigure locales --frontend=noninteractive 14 | 15 | run apt-get install -y vim 16 | run apt-get install -y git 17 | run apt-get install -y screen 18 | 19 | run useradd -m -s /bin/bash user 20 | env SHELL /bin/bash 21 | env LANG en_US.UTF-8 22 | env LC_CTYPE en_US.UTF8 23 | 24 | user user 25 | run mkdir -p ~/.vim/pack/vim-haskellConcealPlus/start && \ 26 | cd ~/.vim/pack/vim-haskellConcealPlus/start && \ 27 | git clone https://github.com/enomsg/vim-haskellConcealPlus 28 | run echo "syn on\nsetlocal conceallevel=2\nset concealcursor=nciv" > ~/.vimrc 29 | # Run in screen as it handles terminal capabilities better than most of the raw 30 | # terminals. 31 | cmd screen vim ~/.vim/pack/vim-haskellConcealPlus/start/vim-haskellConcealPlus/demo.hs 32 | #cmd bash 33 | EOF_DOCKERFILE 34 | 35 | docker run \ 36 | -e TERM="$TERM" \ 37 | -w /home/user \ 38 | -it "$tag" "$@" 39 | -------------------------------------------------------------------------------- /tests/test-with-pathogen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | tag=test 5 | 6 | docker build -t "$tag" - << EOF_DOCKERFILE 7 | from debian:buster 8 | 9 | run apt-get update 10 | 11 | run apt-get install -y locales 12 | run echo en_US.UTF-8 UTF-8 > /etc/locale.gen 13 | run dpkg-reconfigure locales --frontend=noninteractive 14 | 15 | run apt-get install -y vim 16 | run apt-get install -y vim-pathogen 17 | run apt-get install -y git 18 | run apt-get install -y screen 19 | 20 | run useradd -m -s /bin/bash user 21 | env SHELL /bin/bash 22 | env LANG en_US.UTF-8 23 | env LC_CTYPE en_US.UTF8 24 | 25 | user user 26 | run mkdir -p ~/.vim/bundle && cd ~/.vim/bundle && git clone https://github.com/enomsg/vim-haskellConcealPlus 27 | run echo "execute pathogen#infect()\nsyn on\nsetlocal conceallevel=2\nset concealcursor=nciv" > ~/.vimrc 28 | # Run in screen as it handles terminal capabilities better than most of the raw 29 | # terminals. 30 | cmd screen vim ~/.vim/bundle/vim-haskellConcealPlus/demo.hs 31 | #cmd bash 32 | EOF_DOCKERFILE 33 | 34 | docker run \ 35 | -e TERM="$TERM" \ 36 | -w /home/user \ 37 | -it "$tag" "$@" 38 | --------------------------------------------------------------------------------