diff --git a/etc/soft/nvim/+ftplugin/haskell.vim b/etc/soft/nvim/+ftplugin/haskell.vim index 6af0832..3223120 100644 --- a/etc/soft/nvim/+ftplugin/haskell.vim +++ b/etc/soft/nvim/+ftplugin/haskell.vim @@ -1,63 +1,4 @@ set makeprg=ghc\ %\ -o\ %< " Компилятор -set foldexpr=HaskellFold(v:lnum) -set foldmethod=expr - -" ============================================================================= -" Descriptions: Provide a function providing folding information for haskell -" files. -" Maintainer: Vincent B (twinside@gmail.com) -" Warning: Assume the presence of type signatures on top of your functions to -" work well. -" Usage: drop in ~/vimfiles/plugin or ~/.vim/plugin -" Version: 1.0 -" Changelog: - 1.0 : initial version -" ============================================================================= -if exists("g:__HASKELLFOLD_VIM__") - finish -endif -let g:__HASKELLFOLD_VIM__ = 1 - -" Top level bigdefs -fun! s:HaskellFoldMaster( line ) "{{{ - return a:line =~ '^data\s' - \ || a:line =~ '^type\s' - \ || a:line =~ '^newdata\s' - \ || a:line =~ '^class\s' - \ || a:line =~ '^instance\s' - \ || a:line =~ '^[^:]\+\s*::' -endfunction "}}} - -" Top Level one line shooters. -fun! s:HaskellSnipGlobal(line) "{{{ - return a:line =~ '^module' - \ || a:line =~ '^import' - \ || a:line =~ '^infix[lr]\s' -endfunction "}}} - -" The real folding function -fun! HaskellFold( lineNum ) "{{{ - let line = getline( a:lineNum ) - - " Beginning of comment - if line =~ '^\s*--' - return 2 - endif - - if s:HaskellSnipGlobal( line ) - return 0 - endif - - if line =~ '^\s*$' - let nextline = getline(a:lineNum + 1) - if s:HaskellFoldMaster( nextline ) > 0 || s:HaskellSnipGlobal( nextline ) > 0 - \ || nextline =~ "^--" - return 0 - else - return -1 - endif - endif - - return 1 -endfunction "}}} +call SetHaskellFolding() diff --git a/etc/soft/nvim/+plugins/haskell-vim b/etc/soft/nvim/+plugins/haskell-vim new file mode 160000 index 0000000..b1ac468 --- /dev/null +++ b/etc/soft/nvim/+plugins/haskell-vim @@ -0,0 +1 @@ +Subproject commit b1ac46807835423c4a4dd063df6d5b613d89c731 diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/README.md b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/README.md new file mode 100644 index 0000000..04c3a31 --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/README.md @@ -0,0 +1,147 @@ +## Vim Haskell Conceal+ + +This bundle provides extended Haskell Conceal feature for Vim. The feature +is used to display unicode operators in Haskell code without changing the +underlying file. + +This package offers more (and, more importantly, configurable) features +than the +[baseline vim-haskellConcealbundle](https://github.com/Twinside/vim-haskellConceal). +The baseline bundle has numerous forks, which is possible to combine, so +everyone is welcome to share, improve or contribute new notations to this +Conceal Plus package. + +GitHub: https://github.com/enomsg/vim-haskellConcealPlus + +### Why Concealing + +- Using things like '->' instead real arrows '→' was never a deliberate + choice, but a choice made due to limitations of teletypewriters and + input inconvenience. + +- With concealing you don't have to deal with cumbersome unicode-input + methods, yet you can enjoy proper notation. + +- It is not only about aesthetics. Excess of multi-character functions may + create visual noise, which negatively affects readability. Using special + symbols and true arrows, together with colors and bold/italic face seems + to improve the situation. The image shows Vim with and without + concealing, both running in a plain terminal emulator: + +![demo](https://github.com/enomsg/vim-haskellConcealPlus/raw/master/demo.png) + +- Using concealing instead of *-unicode* versions of packages also has + some advantages. Mainly, concealing does not require any changes to the + source code, it is backwards-compatible with idiomatic code. Secondly, + with concealing no special input methods are needed. Plus, currently + some features are hardly possible without editor's concealing (e.g. + power superscripts). + +### Installation + +Using Vim built-in `pack` support: + +``` +$ mkdir -p ~/.vim/pack/vim-haskellConcealPlus/start +$ cd ~/.vim/pack/vim-haskellConcealPlus/start +$ git clone https://github.com/enomsg/vim-haskellConcealPlus +$ echo "syn on" >> ~/.vimrc # If not already in .vimrc +$ echo "setlocal conceallevel=2" >> ~/.vimrc # If not already in .vimrc +$ echo "set concealcursor=nciv" >> ~/.vimrc # Optional +``` + +### Available Options + + 'q' option to disable concealing of scientific constants (e.g. π) + '℘' option to disable concealing of powerset function + '𝐒' option to disable String type to 𝐒 concealing + '𝐓' option to disable Text type to 𝐓 concealing + '𝐄' option to disable Either/Right/Left to 𝐄/𝑅/𝐿 concealing + '𝐌' option to disable Maybe/Just/Nothing to 𝐌/𝐽/𝑁 concealing + 'A' option to not try to preserve indentation + 's' option to disable space consumption after ∑,∏,√ and ¬ functions + '*' option to enable concealing of asterisk with '⋅' sign + 'x' option to disable default concealing of asterisk with '×' sign + 'E' option to enable ellipsis concealing with ‥ (two dot leader) + 'e' option to disable ellipsis concealing with … (ellipsis sign) + '⇒' option to disable `implies` concealing with ⇒ + '⇔' option to disable `iff` concealing with ⇔ + 'r' option to disable return (η) and join (µ) concealing + 'b' option to disable bind (left and right) concealing + 'f' option to enable formal (★) right bind concealing + 'c' option to enable encircled b/d (ⓑ/ⓓ) for right and left binds + 'h' option to enable partial concealing of binds (e.g. »=) + 'C' option to enable encircled 'm' letter ⓜ concealing for fmap + 'l' option to disable fmap/lift concealing with ↥ + '↱' option to disable mapM/forM concealing with ↱/↰ + 'w' option to disable 'where' concealing with "due to"/∵ symbol + '-' option to disable subtract/(-) concealing with ⊟ + 'I' option to enable alternative ':+' concealing with with ⨢ + 'i' option to disable default concealing of ':+' with ⅈ + 'R' option to disable realPart/imagPart concealing with ℜ/ℑ + 'T' option to enable True/False constants concealing with bold 𝐓/𝐅 + 't' option to disable True/False constants concealing with italic 𝑇/𝐹 + 'B' option to disable Bool type to 𝔹 concealing + 'Q' option to disable Rational type to ℚ concealing + 'Z' option to disable Integer type to ℤ concealing + 'N' option to disable Natural, Nat types to ℕ concealing + 'D' option to disable Double type to 𝔻 concealing + 'C' option to disable Complex type to ℂ concealing + '1' option to disable numeric superscripts concealing, e.g. x² + 'a' option to disable alphabet superscripts concealing, e.g. xⁿ + +The flags can be specified via hscoptions variable. For example, *let +hscoptions="fc"* in your *~/.vimrc*. + +### Known Issues and Hints: + +- Concealing may seriously mess up indentation. By default the bundle + tries to preserve spaces for commonly troublesome symbols (e.g. ->, <- + and => arrows). But to be sure about indentation, you still have to see + the non-concealed code. *set conceallevel=0* might be handy in these + cases. + +- *set concealcursor=nciv* seem to not play well with Vim matchparen + feature (which is enabled by default). You can either disable concealing + under the cursor, or disable matchparen by adding *let + loaded_matchparen=1* at the very top of your *~/.vimrc*. + +- With *set concealcursor=nciv* navigation through concealed parts of code + might be somewhat irritating because the cursor behaves a bit + differently. It becomes less of an issue if you are used to Vim's *w/b* + commands (word forward/backward). You can also try *set + concealcursor=ncv* instead. + +- Finding proper fonts might be a pain. Most of modern, so called + programming fonts (*Inconsolata*, *Anonymous Pro*, etc.) often lack + decent unicode support. As a recommendation, try *DejaVu Sans Mono*. + + **Update**: thanks to [monospacifier](https://github.com/cpitclaudel/monospacifier) + package, fonts are no longer a problem. Pick your favourite font, then in + addition download one of the "monospacified" fallback fonts, save into + `~/.fonts`, and adjust fontconfig, e.g. + `~/.config/fontconfig/fonts.conf`: + + ``` + + + ~/.fonts + + monospace + + TeX Gyre Schola Math monospacified for DejaVu Sans Mono + + + + ``` + +- Most of the terminal emulators have one or more issues with regard to the + unicode characters handling. Emulators that don't have problems with unicode + might be pretty slow. As a recommendation, try xst, or *evilvte* (it has weird + configuration, but draws things correctly) or *lxterminal* (seems to be quite + capable, but limited configurability) or any other terminal emulator that + happened to work for you. + + [xst](https://github.com/gnotclub/xst) is known to work well with DejaVu Sans + Mono, plus [monospacified](https://github.com/cpitclaudel/monospacifier) fonts + as a fallback. diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/after/syntax/haskell.vim b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/after/syntax/haskell.vim new file mode 100644 index 0000000..693af6a --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/after/syntax/haskell.vim @@ -0,0 +1,483 @@ +" vim: sw=4 +"============================================================================= +" What Is This: Add some conceal operator for your haskell files +" File: haskell.vim (conceal enhancement) +" Last Change: 2011-09-07 +" Version: 1.3.2 +" Require: +" set nocompatible +" somewhere on your .vimrc +" +" Vim 7.3 or Vim compiled with conceal patch. +" Use --with-features=big or huge in order to compile it in. +" +" Usage: +" Drop this file in your +" ~/.vim/after/syntax folder (Linux/MacOSX/BSD...) +" ~/vimfiles/after/syntax folder (Windows) +" +" For this script to work, you have to set the encoding +" to utf-8 :set enc=utf-8 +" +" Additional: +" * if you want to avoid the loading, add the following +" line in your .vimrc : +" let g:no_haskell_conceal = 1 +" Changelog: +" - 1.3.1: putting undefined in extra conceal, not appearing on windows +" - 1.3: adding new arrow characters used by GHC in Unicode extension. +" - 1.2: Fixing conceal level to be local (thx Erlend Hamberg) +" - 1.1: Better handling of non utf-8 systems, and avoid some +" concealing operations on windows on some fonts +" + +" Cf - check a flag. Return true if the flag is specified. +function! Cf(flag) + return exists('g:hscoptions') && stridx(g:hscoptions, a:flag) >= 0 +endfunction + +if exists('g:no_haskell_conceal') || !has('conceal') || &enc != 'utf-8' + finish +endif + +" vim: set fenc=utf-8: +syntax match hsNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ + +" 'q' option to disable concealing of scientific constants (e.g. π). +if !Cf('q') + syntax match hsNiceOperator "\" conceal cchar=π + syntax match hsNiceOperator "\" conceal cchar=τ + syntax match hsNiceOperator "\" conceal cchar=ℎ + syntax match hsNiceOperator "\" conceal cchar=ℏ +endif + +syntax match hsNiceOperator "==" conceal cchar=≡ +syntax match hsNiceOperator "\/=" conceal cchar=≢ + +let s:extraConceal = 1 +" 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 hsNiceOperator "\" conceal cchar=⊥ + + " Match greater than and lower than w/o messing with Kleisli composition + syntax match hsNiceOperator "<=\ze[^<]" conceal cchar=≤ + syntax match hsNiceOperator ">=\ze[^>]" conceal cchar=≥ + + " Redfining to get proper '::' concealing + syntax match hs_DeclareFunction /^[a-z_(]\S*\(\s\|\n\)*::/me=e-2 nextgroup=hsNiceOperator contains=hs_FunctionName,hs_OpFunctionName + + syntax match hsNiceoperator "!!" conceal cchar=‼ + syntax match hsNiceoperator "++\ze[^+]" conceal cchar=⧺ + syntax match hsNiceOperator "\" conceal cchar=∀ + syntax match hsNiceOperator "-<" conceal cchar=↢ + syntax match hsNiceOperator ">-" conceal cchar=↣ + syntax match hsNiceOperator "-<<" conceal cchar=⤛ + syntax match hsNiceOperator ">>-" conceal cchar=⤜ + " the star does not seem so good... + " syntax match hsNiceOperator "*" conceal cchar=★ + syntax match hsNiceOperator "`div`" conceal cchar=÷ + + " Only replace the dot, avoid taking spaces around. + syntax match hsNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘ + + syntax match hsQQEnd "|\]" contained conceal cchar=〛 + " sy match hsQQEnd "|\]" contained conceal=〚 + + syntax match hsNiceOperator "`elem`" conceal cchar=∈ + syntax match hsNiceOperator "`notElem`" conceal cchar=∉ + syntax match hsNiceOperator "`isSubsetOf`" conceal cchar=⊆ + syntax match hsNiceOperator "`union`" conceal cchar=∪ + syntax match hsNiceOperator "`intersect`" conceal cchar=∩ + syntax match hsNiceOperator "\\\\\ze[[:alpha:][:space:]_([]" conceal cchar=∖ + + syntax match hsNiceOperator "||\ze[[:alpha:][:space:]_([]" conceal cchar=∨ + syntax match hsNiceOperator "&&\ze[[:alpha:][:space:]_([]" conceal cchar=∧ + + syntax match hsNiceOperator "<\*>" conceal cchar=⊛ + syntax match hsNiceOperator "`mappend`" conceal cchar=⊕ + syntax match hsNiceOperator "\" conceal cchar=⊕ + syntax match hsNiceOperator "<>" conceal cchar=⊕ + syntax match hsNiceOperator "\" conceal cchar=∅ + syntax match hsNiceOperator "\" conceal cchar=∅ + syntax match hsNiceOperator "\" conceal cchar=∅ +endif + +hi link hsNiceOperator Operator +hi! link Conceal Operator +setlocal conceallevel=2 + +" '℘' option to disable concealing of powerset function +if !Cf('℘') + syntax match hsNiceOperator "\" conceal cchar=℘ +endif + +" '𝐒' option to disable String type to 𝐒 concealing +if !Cf('𝐒') + syntax match hsNiceOperator "\" conceal cchar=𝐒 +endif + +" '𝐓' option to disable Text type to 𝐓 concealing +if !Cf('𝐓') + syntax match hsNiceOperator "\" conceal cchar=𝐓 +endif + +" '𝐄' option to disable Either/Right/Left to 𝐄/𝑅/𝐿 concealing +if !Cf('𝐄') + syntax match hsNiceOperator "\" conceal cchar=𝐄 + syntax match hsNiceOperator "\" conceal cchar=𝑅 + syntax match hsNiceOperator "\" conceal cchar=𝐿 +endif + +" '𝐌' option to disable Maybe/Just/Nothing to 𝐌/𝐽/𝑁 concealing +if !Cf('𝐌') + syntax match hsNiceOperator "\" conceal cchar=𝐌 + syntax match hsNiceOperator "\" conceal cchar=𝐽 + syntax match hsNiceOperator "\" conceal cchar=𝑁 +endif + +" 'A' option to not try to preserve indentation. +if Cf('A') + syntax match hsNiceOperator "<-" conceal cchar=← + syntax match hsNiceOperator "->" conceal cchar=→ + syntax match hsNiceOperator "=>" conceal cchar=⇒ + syntax match hsNiceOperator "\:\:" conceal cchar=∷ +else + syntax match hsLRArrowHead contained ">" conceal cchar= + syntax match hsLRArrowTail contained "-" conceal cchar=→ + syntax match hsLRArrowFull "->" contains=hsLRArrowHead,hsLRArrowTail + + syntax match hsRLArrowHead contained "<" conceal cchar=← + syntax match hsRLArrowTail contained "-" conceal cchar= + syntax match hsRLArrowFull "<-" contains=hsRLArrowHead,hsRLArrowTail + + syntax match hsLRDArrowHead contained ">" conceal cchar= + syntax match hsLRDArrowTail contained "=" conceal cchar=⇒ + syntax match hsLRDArrowFull "=>" contains=hsLRDArrowHead,hsLRDArrowTail +endif + +" 's' option to disable space consumption after ∑,∏,√ and ¬ functions. +if Cf('s') + syntax match hsNiceOperator "\" conceal cchar=∑ + syntax match hsNiceOperator "\" conceal cchar=∏ + syntax match hsNiceOperator "\" conceal cchar=√ + syntax match hsNiceOperator "\" conceal cchar=¬ +else + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∑ + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∏ + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=√ + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=¬ +endif + +" '*' option to enable concealing of asterisk with '⋅' sign. +if Cf('*') + syntax match hsNiceOperator "*" conceal cchar=⋅ +" 'x' option to disable default concealing of asterisk with '×' sign. +elseif !Cf('x') + syntax match hsNiceOperator "*" conceal cchar=× +endif + +" 'E' option to enable ellipsis concealing with ‥ (two dot leader). +if Cf('E') + " The two dot leader is not guaranteed to be at the bottom. So, it + " will break on some fonts. + syntax match hsNiceOperator "\.\." conceal cchar=‥ +" 'e' option to disable ellipsis concealing with … (ellipsis sign). +elseif !Cf('e') + syntax match hsNiceOperator "\.\." conceal cchar=… +end + +" '⇒' option to disable `implies` concealing with ⇒ +if !Cf('⇒') + " Easily distinguishable from => keyword since the keyword can only be + " used in type signatures. + syntax match hsNiceOperator "`implies`" conceal cchar=⇒ +endif + +" '⇔' option to disable `iff` concealing with ⇔ +if !Cf('⇔') + syntax match hsNiceOperator "`iff`" conceal cchar=⇔ +endif + +" 'r' option to disable return (η) and join (µ) concealing. +if !Cf('r') + syntax match hsNiceOperator "\" conceal cchar=η + syntax match hsNiceOperator "\" conceal cchar=µ +endif + +" 'b' option to disable bind (left and right) concealing +if Cf('b') + " Vim has some issues concealing with composite symbols like '«̳', and + " unfortunately there is no other common short notation for both + " binds. So 'b' option to disable bind concealing altogether. +" 'f' option to enable formal (★) right bind concealing +elseif Cf('f') + syntax match hsNiceOperator ">>=" conceal cchar=★ +" 'c' option to enable encircled b/d (ⓑ/ⓓ) for right and left binds. +elseif Cf('c') + syntax match hsNiceOperator ">>=" conceal cchar=ⓑ + syntax match hsNiceOperator "=<<" conceal cchar=ⓓ +" 'h' option to enable partial concealing of binds (e.g. »=). +elseif Cf('h') + syntax match hsNiceOperator ">>" conceal cchar=» + syntax match hsNiceOperator "<<" conceal cchar=« + syntax match hsNiceOperator "=\zs<<" conceal cchar=« +" Left and right arrows with hooks are the default option for binds. +else + syntax match hsNiceOperator ">>=\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↪ + syntax match hsNiceOperator "=<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↩ +endif + +if !Cf('h') + syntax match hsNiceOperator ">>\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=» + syntax match hsNiceOperator "<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=« +endif + +" 'C' option to enable encircled 'm' letter ⓜ concealing for fmap. +if Cf('C') + syntax match hsNiceOperator "<$>" conceal cchar=ⓜ + syntax match hsNiceOperator "`fmap`" conceal cchar=ⓜ +" 'l' option to disable fmap/lift concealing with ↥. +elseif !Cf('l') + syntax match hsNiceOperator "`liftM`" conceal cchar=↥ + syntax match hsNiceOperator "`liftA`" conceal cchar=↥ + syntax match hsNiceOperator "`fmap`" conceal cchar=↥ + syntax match hsNiceOperator "<$>" conceal cchar=↥ + + syntax match LIFTQ contained "`" conceal + syntax match LIFTQl contained "l" conceal cchar=↥ + syntax match LIFTl contained "l" conceal cchar=↥ + syntax match LIFTi contained "i" conceal + syntax match LIFTf contained "f" conceal + syntax match LIFTt contained "t" conceal + syntax match LIFTA contained "A" conceal + syntax match LIFTM contained "M" conceal + syntax match LIFT2 contained "2" conceal cchar=² + syntax match LIFT3 contained "3" conceal cchar=³ + syntax match LIFT4 contained "4" conceal cchar=⁴ + syntax match LIFT5 contained "5" conceal cchar=⁵ + + syntax match hsNiceOperator "`liftM2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2 + syntax match hsNiceOperator "`liftM3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3 + syntax match hsNiceOperator "`liftM4`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4 + syntax match hsNiceOperator "`liftM5`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5 + syntax match hsNiceOperator "`liftA2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2 + syntax match hsNiceOperator "`liftA3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3 + + syntax match FMAPf contained "f" conceal cchar=↥ + syntax match FMAPm contained "m" conceal + syntax match FMAPa contained "a" conceal + syntax match FMAPp contained "p" conceal + syntax match FMAPSPC contained " " conceal + syntax match hsNiceOperator "\\s*" contains=FMAPf,FMAPm,FMAPa,FMAPp,FMAPSPC + + syntax match LIFTSPC contained " " conceal + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFTSPC + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2,LIFTSPC + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3,LIFTSPC + + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFTSPC + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2,LIFTSPC + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3,LIFTSPC + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4,LIFTSPC + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5,LIFTSPC + + " TODO: Move liftIO to its own flag? + syntax match LIFTIOL contained "l" conceal + syntax match LIFTI contained "I" conceal cchar=i + syntax match LIFTO contained "O" conceal cchar=o + syntax match hsNiceOperator "\" contains=LIFTIOl,LIFTi,LIFTf,LIFTt,LIFTI,LIFTO +endif + +" '↱' option to disable mapM/forM concealing with ↱/↰ +if !Cf('↱') + syntax match MAPMQ contained "`" conceal + syntax match MAPMm contained "m" conceal cchar=↱ + syntax match MAPMmQ contained "m" conceal cchar=↰ + syntax match MAPMa contained "a" conceal + syntax match MAPMp contained "p" conceal + syntax match MAPMM contained "M" conceal + syntax match MAPMM contained "M" conceal + syntax match MAPMU contained "_" conceal cchar=_ + syntax match SPC contained " " conceal + syntax match hsNiceOperator "`mapM_`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM,MAPMU + syntax match hsNiceOperator "`mapM`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM + syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,SPC + syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,MAPMU,SPC + + syntax match FORMQ contained "`" conceal + syntax match FORMfQ contained "f" conceal cchar=↱ + syntax match FORMf contained "f" conceal cchar=↰ + syntax match FORMo contained "o" conceal + syntax match FORMr contained "r" conceal + syntax match FORMM contained "M" conceal + syntax match FORMU contained "_" conceal cchar=_ + + syntax match hsNiceOperator "`forM`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM + syntax match hsNiceOperator "`forM_`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM,FORMU + + syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,SPC + syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,FORMU,SPC +endif + +" 'w' option to disable 'where' concealing with "due to"/∵ symbol. +if !Cf('w') + " ∵ means "because/since/due to." With quite a stretch this can be + " used for 'where'. We preserve spacing, otherwise it breaks indenting + " in a major way. + syntax match WS contained "w" conceal cchar=∵ + syntax match HS contained "h" conceal cchar= + syntax match ES contained "e" conceal cchar= + syntax match RS contained "r" conceal cchar= + syntax match hsNiceOperator "\" contains=WS,HS,ES,RS,ES +endif + +" '-' option to disable subtract/(-) concealing with ⊟. +if !Cf('-') + " Minus is a special syntax construct in Haskell. We use squared minus to + " tell the syntax from the binary function. + syntax match hsNiceOperator "(-)" conceal cchar=⊟ + syntax match hsNiceOperator "`subtract`" conceal cchar=⊟ +endif + +" 'I' option to enable alternative ':+' concealing with with ⨢. +if Cf('I') + " With some fonts might look better than ⅈ. + syntax match hsNiceOperator ":+" conceal cchar=⨢ +" 'i' option to disable default concealing of ':+' with ⅈ. +elseif !Cf('i') + syntax match COLON contained ":" conceal cchar=+ + syntax match PLUS contained "+" conceal cchar= + syntax match SPACE contained " " conceal cchar=ⅈ + syntax match hsNiceOperator ":+ " contains=COLON,PLUS,SPACE + "syntax match hsNiceOperator ":+" conceal cchar=ⅈ +endif + +" 'R' option to disable realPart/imagPart concealing with ℜ/ℑ. +if !Cf('R') + syntax match hsNiceOperator "\" conceal cchar=ℜ + syntax match hsNiceOperator "\" conceal cchar=ℑ +endif + +" 'T' option to enable True/False constants concealing with bold 𝐓/𝐅. +if Cf('T') + syntax match hsNiceSpecial "\" conceal cchar=𝐓 + syntax match hsNiceSpecial "\" conceal cchar=𝐅 +" 't' option to disable True/False constants concealing with italic 𝑇/𝐹. +elseif !Cf('t') + syntax match hsNiceSpecial "\" conceal cchar=𝑇 + syntax match hsNiceSpecial "\" conceal cchar=𝐹 +endif + +" 'B' option to disable Bool type to 𝔹 concealing +if !Cf('B') + " Not an official notation ttbomk. But at least + " http://www.haskell.org/haskellwiki/Unicode-symbols mentions it. + syntax match hsNiceOperator "\" conceal cchar=𝔹 +endif + +" 'Q' option to disable Rational type to ℚ concealing. +if !Cf('Q') + syntax match hsNiceOperator "\" conceal cchar=ℚ +endif + +" 'Z' option to disable Integer type to ℤ concealing. +if !Cf('Z') + syntax match hsNiceOperator "\" conceal cchar=ℤ + syntax match hsNiceOperator "\" conceal cchar=ℤ +endif + +" 'N' option to disable Natural, Nat types to ℕ concealing. +if !Cf('N') + syntax match hsNiceOperator "\" conceal cchar=ℕ + syntax match hsNiceOperator "\" conceal cchar=ℕ +endif + +" 'D' option to disable Double type to 𝔻 concealing +if !Cf('D') + syntax match hsNiceOperator "\" conceal cchar=𝔻 +endif + +" 'C' option to disable Complex type to ℂ concealing +if !Cf('C') + syntax match hasNiceOperator "\" conceal cchar=ℂ +endif + +" '1' option to disable numeric superscripts concealing, e.g. x². +if !Cf('1') + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)0\ze\_W" conceal cchar=⁰ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)1\ze\_W" conceal cchar=¹ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)2\ze\_W" conceal cchar=² + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)3\ze\_W" conceal cchar=³ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)4\ze\_W" conceal cchar=⁴ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)5\ze\_W" conceal cchar=⁵ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)6\ze\_W" conceal cchar=⁶ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)7\ze\_W" conceal cchar=⁷ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)8\ze\_W" conceal cchar=⁸ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)9\ze\_W" conceal cchar=⁹ +endif + +" 'a' option to disable alphabet superscripts concealing, e.g. xⁿ. +if !Cf('a') + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)a\ze\_W" conceal cchar=ᵃ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)b\ze\_W" conceal cchar=ᵇ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)c\ze\_W" conceal cchar=ᶜ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)d\ze\_W" conceal cchar=ᵈ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)e\ze\_W" conceal cchar=ᵉ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)f\ze\_W" conceal cchar=ᶠ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)g\ze\_W" conceal cchar=ᵍ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)h\ze\_W" conceal cchar=ʰ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)i\ze\_W" conceal cchar=ⁱ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)j\ze\_W" conceal cchar=ʲ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)k\ze\_W" conceal cchar=ᵏ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)l\ze\_W" conceal cchar=ˡ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)m\ze\_W" conceal cchar=ᵐ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)n\ze\_W" conceal cchar=ⁿ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)o\ze\_W" conceal cchar=ᵒ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)p\ze\_W" conceal cchar=ᵖ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)r\ze\_W" conceal cchar=ʳ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)s\ze\_W" conceal cchar=ˢ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)t\ze\_W" conceal cchar=ᵗ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)u\ze\_W" conceal cchar=ᵘ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)v\ze\_W" conceal cchar=ᵛ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)w\ze\_W" conceal cchar=ʷ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)x\ze\_W" conceal cchar=ˣ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)y\ze\_W" conceal cchar=ʸ + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)z\ze\_W" conceal cchar=ᶻ +endif + +" Not really Haskell, but quite handy for writing proofs in pseudo-code. +if Cf('∴') + syntax match hsNiceOperator "\" conceal cchar=∴ + syntax match hsNiceOperator "\" conceal cchar=∃ + syntax match hsNiceOperator "\" conceal cchar=∄ + syntax match hsNiceOperator ":=" conceal cchar=≝ +endif + +" TODO: +" See Basic Syntax Extensions - School of Haskell | FP Complete +" intersection = (∩) +" +" From the Data.IntMap.Strict.Unicode +" notMember = (∉) = flip (∌) +" member = (∈) = flip (∋) +" isProperSubsetOf = (⊂) = flip (⊃) +" +" From Data.Sequence.Unicode +" (<|) = (⊲ ) +" (|>) = (⊳ ) +" (><) = (⋈ ) diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/after/syntax/lhaskell.vim b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/after/syntax/lhaskell.vim new file mode 100644 index 0000000..f6edcfb --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/after/syntax/lhaskell.vim @@ -0,0 +1,477 @@ +" vim: sw=4 +"============================================================================= +" What Is This: Add some conceal operator for your literate haskell files +" File: lhaskell.vim (conceal enhancement) +" Last Change: 2015-11-13 +" Version: 1.3.3 +" Require: +" set nocompatible +" somewhere on your .vimrc +" +" Vim 7.3 or Vim compiled with conceal patch. +" Use --with-features=big or huge in order to compile it in. +" +" Usage: +" Drop this file in your +" ~/.vim/after/syntax folder (Linux/MacOSX/BSD...) +" ~/vimfiles/after/syntax folder (Windows) +" +" For this script to work, you have to set the encoding +" to utf-8 :set enc=utf-8 +" +" Additional: +" * if you want to avoid the loading, add the following +" line in your .vimrc : +" let g:no_haskell_conceal = 1 +" Changelog: +" - 1.3.3: lhaskell.vim added, only concealing inside code (\begin, >>) tags. +" - 1.3.1: putting undefined in extra conceal, not appearing on windows +" - 1.3: adding new arrow characters used by GHC in Unicode extension. +" - 1.2: Fixing conceal level to be local (thx Erlend Hamberg) +" - 1.1: Better handling of non utf-8 systems, and avoid some +" concealing operations on windows on some fonts +" + + +" Cf - check a flag. Return true if the flag is specified. +function! Cf(flag) + return exists('g:hscoptions') && stridx(g:hscoptions, a:flag) >= 0 +endfunction + +if exists('g:no_haskell_conceal') || !has('conceal') || &enc != 'utf-8' + finish +endif + +syntax cluster haskellTop add=hsNiceOperator + +" vim: set fenc=utf-8: +syntax match hsNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ contained + +" 'q' option to disable concealing of scientific constants (e.g. π). +if !Cf('q') + syntax match hsNiceOperator "\" conceal cchar=π contained + syntax match hsNiceOperator "\" conceal cchar=τ contained + syntax match hsNiceOperator "\" conceal cchar=ℎ contained + syntax match hsNiceOperator "\" conceal cchar=ℏ contained +endif + +syntax match hsNiceOperator "==" conceal cchar=≡ contained +syntax match hsNiceOperator "\/=" conceal cchar=≢ contained + +let s:extraConceal = 1 +" 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 hsNiceOperator "\" conceal cchar=⊥ contained + + " Match greater than and lower than w/o messing with Kleisli composition + syntax match hsNiceOperator "<=\ze[^<]" conceal cchar=≤ contained + syntax match hsNiceOperator ">=\ze[^>]" conceal cchar=≥ contained + + " Redfining to get proper '::' concealing + syntax match hs_DeclareFunction /^[a-z_(]\S*\(\s\|\n\)*::/me=e-2 nextgroup=hsNiceOperator contains=hs_FunctionName,hs_OpFunctionName contained + + syntax match hsNiceoperator "!!" conceal cchar=‼ contained + syntax match hsNiceoperator "++\ze[^+]" conceal cchar=⧺ contained + syntax match hsNiceOperator "\" conceal cchar=∀ contained + syntax match hsNiceOperator "-<" conceal cchar=↢ contained + syntax match hsNiceOperator ">-" conceal cchar=↣ contained + syntax match hsNiceOperator "-<<" conceal cchar=⤛ contained + syntax match hsNiceOperator ">>-" conceal cchar=⤜ contained + " the star does not seem so good... + " syntax match hsNiceOperator "*" conceal cchar=★ + syntax match hsNiceOperator "`div`" conceal cchar=÷ contained + + " Only replace the dot, avoid taking spaces around. + syntax match hsNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘ contained + + syntax match hsQQEnd "|\]" contained conceal cchar=〛 contained + " sy match hsQQEnd "|\]" contained conceal=〚 + + syntax match hsNiceOperator "`elem`" conceal cchar=∈ contained + syntax match hsNiceOperator "`notElem`" conceal cchar=∉ contained + syntax match hsNiceOperator "`isSubsetOf`" conceal cchar=⊆ contained + syntax match hsNiceOperator "`union`" conceal cchar=∪ contained + syntax match hsNiceOperator "`intersect`" conceal cchar=∩ contained + syntax match hsNiceOperator "\\\\\ze[[:alpha:][:space:]_([]" conceal cchar=∖ contained + + syntax match hsNiceOperator "||\ze[[:alpha:][:space:]_([]" conceal cchar=∨ contained + syntax match hsNiceOperator "&&\ze[[:alpha:][:space:]_([]" conceal cchar=∧ contained + + syntax match hsNiceOperator "<\*>" conceal cchar=⊛ contained + syntax match hsNiceOperator "`mappend`" conceal cchar=⊕ contained + syntax match hsNiceOperator "\" conceal cchar=⊕ + syntax match hsNiceOperator "<>" conceal cchar=⊕ contained + syntax match hsNiceOperator "\" conceal cchar=∅ contained + syntax match hsNiceOperator "\" conceal cchar=∅ contained + syntax match hsNiceOperator "\" conceal cchar=∅ contained +endif + +hi link hsNiceOperator Operator +hi! link Conceal Operator +setlocal conceallevel=2 + +" '℘' option to disable concealing of powerset function +if !Cf('℘') + syntax match hsNiceOperator "\" conceal cchar=℘ contained +endif + +" '𝐒' option to disable String type to 𝐒 concealing +if !Cf('𝐒') + syntax match hsNiceOperator "\" conceal cchar=𝐒 contained +endif + +" '𝐓' option to disable Text type to 𝐓 concealing +if !Cf('𝐓') + syntax match hsNiceOperator "\" conceal cchar=𝐓 contained +endif + +" '𝐄' option to disable Either/Right/Left to 𝐄/𝑅/𝐿 concealing +if !Cf('𝐄') + syntax match hsNiceOperator "\" conceal cchar=𝐄 contained + syntax match hsNiceOperator "\" conceal cchar=𝑅 contained + syntax match hsNiceOperator "\" conceal cchar=𝐿 contained +endif + +" '𝐌' option to disable Maybe/Just/Nothing to 𝐌/𝐽/𝑁 concealing +if !Cf('𝐌') + syntax match hsNiceOperator "\" conceal cchar=𝐌 contained + syntax match hsNiceOperator "\" conceal cchar=𝐽 contained + syntax match hsNiceOperator "\" conceal cchar=𝑁 contained +endif + +" 'A' option to not try to preserve indentation. +if Cf('A') + syntax match hsNiceOperator "<-" conceal cchar=← contained + syntax match hsNiceOperator "->" conceal cchar=→ contained + syntax match hsNiceOperator "=>" conceal cchar=⇒ contained + syntax match hsNiceOperator "\:\:" conceal cchar=∷ contained +else + syntax match hsLRArrowHead contained ">" conceal cchar= contained + syntax match hsLRArrowTail contained "-" conceal cchar=→ contained + syntax match hsLRArrowFull "->" contains=hsLRArrowHead,hsLRArrowTail contained + + syntax match hsRLArrowHead contained "<" conceal cchar=← contained + syntax match hsRLArrowTail contained "-" conceal cchar= contained + syntax match hsRLArrowFull "<-" contains=hsRLArrowHead,hsRLArrowTail contained + + syntax match hsLRDArrowHead contained ">" conceal cchar= contained + syntax match hsLRDArrowTail contained "=" conceal cchar=⇒ contained + syntax match hsLRDArrowFull "=>" contains=hsLRDArrowHead,hsLRDArrowTail contained +endif + +" 's' option to disable space consumption after ∑,∏,√ and ¬ functions. +if Cf('s') + syntax match hsNiceOperator "\" conceal cchar=∑ contained + syntax match hsNiceOperator "\" conceal cchar=∏ contained + syntax match hsNiceOperator "\" conceal cchar=√ contained + syntax match hsNiceOperator "\" conceal cchar=¬ contained +else + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∑ contained + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=∏ contained + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=√ contained + syntax match hsNiceOperator "\\(\ze\s*[.$]\|\s*\)" conceal cchar=¬ contained +endif + +" '*' option to enable concealing of asterisk with '⋅' sign. +if Cf('*') + syntax match hsNiceOperator "*" conceal cchar=⋅ contained +" 'x' option to disable default concealing of asterisk with '×' sign. +elseif !Cf('x') + syntax match hsNiceOperator "*" conceal cchar=× contained +endif + +" 'E' option to enable ellipsis concealing with ‥ (two dot leader). +if Cf('E') + " The two dot leader is not guaranteed to be at the bottom. So, it + " will break on some fonts. + syntax match hsNiceOperator "\.\." conceal cchar=‥ contained +" 'e' option to disable ellipsis concealing with … (ellipsis sign). +elseif !Cf('e') + syntax match hsNiceOperator "\.\." conceal cchar=… contained +end + +" '⇒' option to disable `implies` concealing with ⇒ +if !Cf('⇒') + " Easily distinguishable from => keyword since the keyword can only be + " used in type signatures. + syntax match hsNiceOperator "`implies`" conceal cchar=⇒ contained +endif + +" '⇔' option to disable `iff` concealing with ⇔ +if !Cf('⇔') + syntax match hsNiceOperator "`iff`" conceal cchar=⇔ contained +endif + +" 'r' option to disable return (η) and join (µ) concealing. +if !Cf('r') + syntax match hsNiceOperator "\" conceal cchar=η contained + syntax match hsNiceOperator "\" conceal cchar=µ contained +endif + +" 'b' option to disable bind (left and right) concealing +if Cf('b') + " Vim has some issues concealing with composite symbols like '«̳', and + " unfortunately there is no other common short notation for both + " binds. So 'b' option to disable bind concealing altogether. +" 'f' option to enable formal (★) right bind concealing +elseif Cf('f') + syntax match hsNiceOperator ">>=" conceal cchar=★ contained +" 'c' option to enable encircled b/d (ⓑ/ⓓ) for right and left binds. +elseif Cf('c') + syntax match hsNiceOperator ">>=" conceal cchar=ⓑ contained + syntax match hsNiceOperator "=<<" conceal cchar=ⓓ contained +" 'h' option to enable partial concealing of binds (e.g. »=). +elseif Cf('h') + syntax match hsNiceOperator ">>" conceal cchar=» contained + syntax match hsNiceOperator "<<" conceal cchar=« contained + syntax match hsNiceOperator "=\zs<<" conceal cchar=« contained +" Left and right arrows with hooks are the default option for binds. +else + syntax match hsNiceOperator ">>=\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↪ contained + syntax match hsNiceOperator "=<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=↩ contained +endif + +if !Cf('h') + syntax match hsNiceOperator ">>\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=» contained + syntax match hsNiceOperator "<<\ze\_[[:alpha:][:space:]_()[\]]" conceal cchar=« contained +endif + +" 'C' option to enable encircled 'm' letter ⓜ concealing for fmap. +if Cf('C') + syntax match hsNiceOperator "<$>" conceal cchar=ⓜ contained + syntax match hsNiceOperator "`fmap`" conceal cchar=ⓜ contained +" 'l' option to disable fmap/lift concealing with ↥. +elseif !Cf('l') + syntax match hsNiceOperator "`liftM`" conceal cchar=↥ contained + syntax match hsNiceOperator "`liftA`" conceal cchar=↥ contained + syntax match hsNiceOperator "`fmap`" conceal cchar=↥ contained + syntax match hsNiceOperator "<$>" conceal cchar=↥ contained + + syntax match LIFTQ contained "`" conceal contained + syntax match LIFTQl contained "l" conceal cchar=↥ contained + syntax match LIFTl contained "l" conceal cchar=↥ contained + syntax match LIFTi contained "i" conceal contained + syntax match LIFTf contained "f" conceal contained + syntax match LIFTt contained "t" conceal contained + syntax match LIFTA contained "A" conceal contained + syntax match LIFTM contained "M" conceal contained + syntax match LIFT2 contained "2" conceal cchar=² contained + syntax match LIFT3 contained "3" conceal cchar=³ contained + syntax match LIFT4 contained "4" conceal cchar=⁴ contained + syntax match LIFT5 contained "5" conceal cchar=⁵ contained + + syntax match hsNiceOperator "`liftM2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2 contained + syntax match hsNiceOperator "`liftM3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3 contained + syntax match hsNiceOperator "`liftM4`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4 contained + syntax match hsNiceOperator "`liftM5`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5 contained + syntax match hsNiceOperator "`liftA2`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2 contained + syntax match hsNiceOperator "`liftA3`" contains=LIFTQ,LIFTQl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3 contained + + syntax match FMAPf contained "f" conceal cchar=↥ contained + syntax match FMAPm contained "m" conceal contained + syntax match FMAPa contained "a" conceal contained + syntax match FMAPp contained "p" conceal contained + syntax match FMAPSPC contained " " conceal contained + syntax match hsNiceOperator "\\s*" contains=FMAPf,FMAPm,FMAPa,FMAPp,FMAPSPC contained + + syntax match LIFTSPC contained " " conceal contained + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFTSPC contained + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT2,LIFTSPC contained + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTA,LIFT3,LIFTSPC contained + + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFTSPC contained + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT2,LIFTSPC contained + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT3,LIFTSPC contained + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT4,LIFTSPC contained + syntax match hsNiceOperator "\\s*" contains=LIFTl,LIFTi,LIFTf,LIFTt,LIFTM,LIFT5,LIFTSPC contained + + " TODO: Move liftIO to its own flag? + syntax match LIFTIOL contained "l" conceal contained + syntax match LIFTI contained "I" conceal cchar=i contained + syntax match LIFTO contained "O" conceal cchar=o contained + syntax match hsNiceOperator "\" contains=LIFTIOl,LIFTi,LIFTf,LIFTt,LIFTI,LIFTO contained +endif + +" '↱' option to disable mapM/forM concealing with ↱/↰ +if !Cf('↱') + syntax match MAPMQ contained "`" conceal contained + syntax match MAPMm contained "m" conceal cchar=↱ contained + syntax match MAPMmQ contained "m" conceal cchar=↰ contained + syntax match MAPMa contained "a" conceal contained + syntax match MAPMp contained "p" conceal contained + syntax match MAPMM contained "M" conceal contained + syntax match MAPMM contained "M" conceal contained + syntax match MAPMU contained "_" conceal cchar=_ contained + syntax match SPC contained " " conceal contained + syntax match hsNiceOperator "`mapM_`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM,MAPMU contained + syntax match hsNiceOperator "`mapM`" contains=MAPMQ,MAPMmQ,MAPMa,MAPMp,MAPMM contained + syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,SPC contained + syntax match hsNiceOperator "\\s*" contains=MAPMm,MAPMa,MAPMp,MAPMM,MAPMU,SPC contained + + syntax match FORMQ contained "`" conceal contained + syntax match FORMfQ contained "f" conceal cchar=↱ contained + syntax match FORMf contained "f" conceal cchar=↰ contained + syntax match FORMo contained "o" conceal contained + syntax match FORMr contained "r" conceal contained + syntax match FORMM contained "M" conceal contained + syntax match FORMU contained "_" conceal cchar=_ contained + + syntax match hsNiceOperator "`forM`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM contained + syntax match hsNiceOperator "`forM_`" contains=FORMQ,FORMfQ,FORMo,FORMr,FORMM,FORMU contained + + syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,SPC contained + syntax match hsNiceOperator "\\s*" contains=FORMf,FORMo,FORMr,FORMM,FORMU,SPC contained +endif + +" 'w' option to disable 'where' concealing with "due to"/∵ symbol. +if !Cf('w') + " ∵ means "because/since/due to." With quite a stretch this can be + " used for 'where'. We preserve spacing, otherwise it breaks indenting + " in a major way. + syntax match WS contained "w" conceal cchar=∵ contained + syntax match HS contained "h" conceal cchar= contained + syntax match ES contained "e" conceal cchar= contained + syntax match RS contained "r" conceal cchar= contained + syntax match hsNiceOperator "\" contains=WS,HS,ES,RS,ES contained +endif + +" '-' option to disable subtract/(-) concealing with ⊟. +if !Cf('-') + " Minus is a special syntax construct in Haskell. We use squared minus to + " tell the syntax from the binary function. + syntax match hsNiceOperator "(-)" conceal cchar=⊟ contained + syntax match hsNiceOperator "`subtract`" conceal cchar=⊟ contained +endif + +" 'I' option to enable alternative ':+' concealing with with ⨢. +if Cf('I') + " With some fonts might look better than ⅈ. + syntax match hsNiceOperator ":+" conceal cchar=⨢ contained +" 'i' option to disable default concealing of ':+' with ⅈ. +elseif !Cf('i') + syntax match hsNiceOperator ":+" conceal cchar=ⅈ contained +endif + +" 'R' option to disable realPart/imagPart concealing with ℜ/ℑ. +if !Cf('R') + syntax match hsNiceOperator "\" conceal cchar=ℜ contained + syntax match hsNiceOperator "\" conceal cchar=ℑ contained +endif + +" 'T' option to enable True/False constants concealing with bold 𝐓/𝐅. +if Cf('T') + syntax match hsNiceSpecial "\" conceal cchar=𝐓 contained + syntax match hsNiceSpecial "\" conceal cchar=𝐅 contained +" 't' option to disable True/False constants concealing with italic 𝑇/𝐹. +elseif !Cf('t') + syntax match hsNiceSpecial "\" conceal cchar=𝑇 contained + syntax match hsNiceSpecial "\" conceal cchar=𝐹 contained +endif + +" 'B' option to disable Bool type to 𝔹 concealing +if !Cf('B') + " Not an official notation ttbomk. But at least + " http://www.haskell.org/haskellwiki/Unicode-symbols mentions it. + syntax match hsNiceOperator "\" conceal cchar=𝔹 contained +endif + +" 'Q' option to disable Rational type to ℚ concealing. +if !Cf('Q') + syntax match hsNiceOperator "\" conceal cchar=ℚ +endif + +" 'Z' option to disable Integer type to ℤ concealing. +if !Cf('Z') + syntax match hsNiceOperator "\" conceal cchar=ℤ contained +endif + +" 'N' option to disable Natural, Nat types to ℕ concealing. +if !Cf('N') + syntax match hsNiceOperator "\" conceal cchar=ℕ contained + syntax match hsNiceOperator "\" conceal cchar=ℕ contained +endif + +" '𝔻' option to disable Double type to 𝔻 concealing +if !Cf('𝔻') + syntax match hsNiceOperator "\" conceal cchar=𝔻 contained +endif + +" '1' option to disable numeric superscripts concealing, e.g. x². +if !Cf('1') + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)0\ze\_W" conceal cchar=⁰ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)1\ze\_W" conceal cchar=¹ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)2\ze\_W" conceal cchar=² contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)3\ze\_W" conceal cchar=³ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)4\ze\_W" conceal cchar=⁴ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)5\ze\_W" conceal cchar=⁵ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)6\ze\_W" conceal cchar=⁶ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)7\ze\_W" conceal cchar=⁷ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)8\ze\_W" conceal cchar=⁸ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)9\ze\_W" conceal cchar=⁹ contained +endif + +" 'a' option to disable alphabet superscripts concealing, e.g. xⁿ. +if !Cf('a') + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)a\ze\_W" conceal cchar=ᵃ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)b\ze\_W" conceal cchar=ᵇ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)c\ze\_W" conceal cchar=ᶜ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)d\ze\_W" conceal cchar=ᵈ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)e\ze\_W" conceal cchar=ᵉ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)f\ze\_W" conceal cchar=ᶠ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)g\ze\_W" conceal cchar=ᵍ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)h\ze\_W" conceal cchar=ʰ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)i\ze\_W" conceal cchar=ⁱ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)j\ze\_W" conceal cchar=ʲ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)k\ze\_W" conceal cchar=ᵏ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)l\ze\_W" conceal cchar=ˡ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)m\ze\_W" conceal cchar=ᵐ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)n\ze\_W" conceal cchar=ⁿ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)o\ze\_W" conceal cchar=ᵒ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)p\ze\_W" conceal cchar=ᵖ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)r\ze\_W" conceal cchar=ʳ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)s\ze\_W" conceal cchar=ˢ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)t\ze\_W" conceal cchar=ᵗ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)u\ze\_W" conceal cchar=ᵘ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)v\ze\_W" conceal cchar=ᵛ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)w\ze\_W" conceal cchar=ʷ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)x\ze\_W" conceal cchar=ˣ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)y\ze\_W" conceal cchar=ʸ contained + syntax match hsNiceOperator "\(\*\*\|\^\|\^\^\)z\ze\_W" conceal cchar=ᶻ contained +endif + +" Not really Haskell, but quite handy for writing proofs in pseudo-code. +if Cf('∴') + syntax match hsNiceOperator "\" conceal cchar=∴ contained + syntax match hsNiceOperator "\" conceal cchar=∃ contained + syntax match hsNiceOperator "\" conceal cchar=∄ contained + syntax match hsNiceOperator ":=" conceal cchar=≝ contained +endif + +" TODO: +" See Basic Syntax Extensions - School of Haskell | FP Complete +" intersection = (∩) +" +" From the Data.IntMap.Strict.Unicode +" notMember = (∉) = flip (∌) +" member = (∈) = flip (∋) +" isProperSubsetOf = (⊂) = flip (⊃) +" +" From Data.Sequence.Unicode +" (<|) = (⊲ ) +" (|>) = (⊳ ) +" (><) = (⋈ ) diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.hs b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.hs new file mode 100644 index 0000000..932b643 --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.hs @@ -0,0 +1,46 @@ +{-# LANGUAGE ExistentialQuantification, RankNTypes #-} +import Control.Applicative +import Data.Monoid +import Control.Monad.ST.Lazy +import Control.Monad +import Numeric +import Data.Complex +import Data.List + +factorial :: Integer -> Integer +factorial n = product as + where as = [n, n-1..1] + +integral :: (Num a, Enum a) => (a -> a) -> a -> (a,a) -> a +integral f dx (a,b) = sum ((\x -> f(x)*dx) <$> ab) + where ab = [a,a+dx..b-dx] + +isValid :: Integer -> Bool -> Bool -> Bool +isValid a b c = (a >= 0 && a <= 10) || (b && not c) + +rs :: forall a. (forall s. ST s a) -> a +rs = runST + +main :: IO () +main = do + let tau = 2*pi + putSL $ showF 2 $ integral sin 0.001 (pi,tau) + print $ unsafe [pi,tau] + print $ factorial <$> [1..13`div`2] + print $ texNum . showF 2 <$> (mag <$> [1,2] <*> [3,4]) + print $ Just True >>= (\x -> return $ x `elem` [True, False, False]) + >>= (\x -> if x /= True + then Nothing + else return True) + >>= (\x -> return $ isValid 1 True x) + print $ [1,2] `union` [3,4] == [-9,-8..4] `intersect` [1,2..9] + print $ (++"il") <$> (Just "fa" >> guard False >> return undefined) + print $ realPart(4:+2) == imagPart(2:+4) + print $ liftM3 (\x y z -> x+y+z) [1] [2] [39] + putSL $ "Hask" <> "ell" + where + mag a b = sqrt(a^2 + b^2) + showF n f = showFFloat (Just n) f empty + unsafe xs = (xs!!0,xs!!1) + texNum num = "$\\num{" ++ num ++ "}$" + putSL = putStrLn diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.lhs b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.lhs new file mode 100644 index 0000000..ca75204 --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.lhs @@ -0,0 +1,90 @@ +{-# LANGUAGE ExistentialQuantification, RankNTypes #-} +import Control.Applicative +>> import Control.Applicative +import Data.Monoid +>> import Data.Monoid +import Control.Monad.ST.Lazy +>> import Control.Monad.ST.Lazy +import Control.Monad +>> import Control.Monad +import Numeric +>> import Numeric +import Data.Complex +>> import Data.Complex +import Data.List +>> import Data.List + +factorial :: Integer -> Integer +factorial n = product as + where as = [n, n-1..1] + +>> factorial :: Integer -> Integer +>> factorial n = product as +>> where as = [n, n-1..1] + +integral :: (Num a, Enum a) => (a -> a) -> a -> (a,a) -> a +integral f dx (a,b) = sum ((\x -> f(x)*dx) <$> ab) + where ab = [a,a+dx..b-dx] + +>> integral :: (Num a, Enum a) => (a -> a) -> a -> (a,a) -> a +>> integral f dx (a,b) = sum ((\x -> f(x)*dx) <$> ab) +>> where ab = [a,a+dx..b-dx] + +isValid :: Integer -> Bool -> Bool -> Bool +isValid a b c = (a >= 0 && a <= 10) || (b && not c) + +>> isValid :: Integer -> Bool -> Bool -> Bool +>> isValid a b c = (a >= 0 && a <= 10) || (b && not c) + +rs :: forall a. (forall s. ST s a) -> a +rs = runST +>> rs :: forall a. (forall s. ST s a) -> a +>> rs = runST + +main :: IO () +main = do + let tau = 2*pi + putSL $ showF 2 $ integral sin 0.001 (pi,tau) + print $ unsafe [pi,tau] + print $ factorial <$> [1..13`div`2] + print $ texNum . showF 2 <$> (mag <$> [1,2] <*> [3,4]) + print $ Just True >>= (\x -> return $ x `elem` [True, False, False]) + >>= (\x -> if x /= True + then Nothing + else return True) + >>= (\x -> return $ isValid 1 True x) + print $ [1,2] `union` [3,4] == [-9,-8..4] `intersect` [1,2..9] + print $ (++"il") <$> (Just "fa" >> guard False >> return undefined) + print $ realPart(4:+2) == imagPart(2:+4) + print $ liftM3 (\x y z -> x+y+z) [1] [2] [39] + putSL $ "Hask" <> "ell" + where + mag a b = sqrt(a^2 + b^2) + showF n f = showFFloat (Just n) f empty + unsafe xs = (xs!!0,xs!!1) + texNum num = "$\\num{" ++ num ++ "}$" + putSL = putStrLn + +>> main :: IO () +>> main = do +>> let tau = 2*pi +>> putSL $ showF 2 $ integral sin 0.001 (pi,tau) +>> print $ unsafe [pi,tau] +>> print $ factorial <$> [1..13`div`2] +>> print $ texNum . showF 2 <$> (mag <$> [1,2] <*> [3,4]) +>> print $ Just True >>= (\x -> return $ x `elem` [True, False, False]) +>> >>= (\x -> if x /= True +>> then Nothing +>> else return True) +>> >>= (\x -> return $ isValid 1 True x) +>> print $ [1,2] `union` [3,4] == [-9,-8..4] `intersect` [1,2..9] +>> print $ (++"il") <$> (Just "fa" >> guard False >> return undefined) +>> print $ realPart(4:+2) == imagPart(2:+4) +>> print $ liftM3 (\x y z -> x+y+z) [1] [2] [39] +>> putSL $ "Hask" <> "ell" +>> where +>> mag a b = sqrt(a^2 + b^2) +>> showF n f = showFFloat (Just n) f empty +>> unsafe xs = (xs!!0,xs!!1) +>> texNum num = "$\\num{" ++ num ++ "}$" +>> putSL = putStrLn diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.png b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.png new file mode 100644 index 0000000..9d898cc Binary files /dev/null and b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/demo.png differ diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/gendemo.sh b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/gendemo.sh new file mode 100755 index 0000000..38fb02b --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/gendemo.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +rm s{l,r}.png +convert -crop 490x685+0+35 l.png sl.png +convert -crop 640x685+0+35 r.png sr.png +convert sl.png sr.png +append demo.png diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/tests/test-with-pack.sh b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/tests/test-with-pack.sh new file mode 100755 index 0000000..2c048bb --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/tests/test-with-pack.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -e + +tag=test + +docker build -t "$tag" - << EOF_DOCKERFILE +from debian:buster + +run apt-get update + +run apt-get install -y locales +run echo en_US.UTF-8 UTF-8 > /etc/locale.gen +run dpkg-reconfigure locales --frontend=noninteractive + +run apt-get install -y vim +run apt-get install -y git +run apt-get install -y screen + +run useradd -m -s /bin/bash user +env SHELL /bin/bash +env LANG en_US.UTF-8 +env LC_CTYPE en_US.UTF8 + +user user +run mkdir -p ~/.vim/pack/vim-haskellConcealPlus/start && \ + cd ~/.vim/pack/vim-haskellConcealPlus/start && \ + git clone https://github.com/enomsg/vim-haskellConcealPlus +run echo "syn on\nsetlocal conceallevel=2\nset concealcursor=nciv" > ~/.vimrc +# Run in screen as it handles terminal capabilities better than most of the raw +# terminals. +cmd screen vim ~/.vim/pack/vim-haskellConcealPlus/start/vim-haskellConcealPlus/demo.hs +#cmd bash +EOF_DOCKERFILE + +docker run \ + -e TERM="$TERM" \ + -w /home/user \ + -it "$tag" "$@" diff --git a/etc/soft/nvim/+plugins/vim-haskellConcealPlus/tests/test-with-pathogen.sh b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/tests/test-with-pathogen.sh new file mode 100755 index 0000000..385a118 --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellConcealPlus/tests/test-with-pathogen.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -e + +tag=test + +docker build -t "$tag" - << EOF_DOCKERFILE +from debian:buster + +run apt-get update + +run apt-get install -y locales +run echo en_US.UTF-8 UTF-8 > /etc/locale.gen +run dpkg-reconfigure locales --frontend=noninteractive + +run apt-get install -y vim +run apt-get install -y vim-pathogen +run apt-get install -y git +run apt-get install -y screen + +run useradd -m -s /bin/bash user +env SHELL /bin/bash +env LANG en_US.UTF-8 +env LC_CTYPE en_US.UTF8 + +user user +run mkdir -p ~/.vim/bundle && cd ~/.vim/bundle && git clone https://github.com/enomsg/vim-haskellConcealPlus +run echo "execute pathogen#infect()\nsyn on\nsetlocal conceallevel=2\nset concealcursor=nciv" > ~/.vimrc +# Run in screen as it handles terminal capabilities better than most of the raw +# terminals. +cmd screen vim ~/.vim/bundle/vim-haskellConcealPlus/demo.hs +#cmd bash +EOF_DOCKERFILE + +docker run \ + -e TERM="$TERM" \ + -w /home/user \ + -it "$tag" "$@" diff --git a/etc/soft/nvim/+plugins/vim-haskellfold/README.md b/etc/soft/nvim/+plugins/vim-haskellfold/README.md new file mode 100644 index 0000000..6c32307 --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellfold/README.md @@ -0,0 +1,14 @@ +# haskellFold + +Provide a better folding for haskell file. The folded lines are transformed +to display the type signature (if any) of the function, providing a great +overview of your file content. + +You can get a shorter version of the foldtext (only the first relevant line) +by setting `g:haskellFold_ShortText = 1` + +# Installation + +Drop the file in ~/.vim/plugin or ~/vimfiles/plugin folder, or if you +use pathogen into the ~/.vim/bundle/vim-haskellFold or +~/vimfiles/bundle/vim-haskellFold diff --git a/etc/soft/nvim/+plugins/vim-haskellfold/autoload/haskellFold.vim b/etc/soft/nvim/+plugins/vim-haskellfold/autoload/haskellFold.vim new file mode 100644 index 0000000..492040f --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellfold/autoload/haskellFold.vim @@ -0,0 +1,121 @@ +" ============================================================================= +" Descriptions: Provide a function providing folding information for haskell +" files. +" Maintainer: Vincent B (twinside@gmail.com) +" Warning: Assume the presence of type signatures on top of your functions to +" work well. +" Usage: drop in ~/vimfiles/plugin or ~/.vim/plugin +" Version: 1.2 +" Changelog: - 1.2 : Reacting to file type instead of file extension. +" - 1.1 : Adding foldtext to bet more information. +" - 1.0 : initial version +" ============================================================================= +" Top level bigdefs +fun! s:HaskellFoldMaster( line ) "{{{ + return a:line =~# '^data\s' + \ || a:line =~# '^type\s' + \ || a:line =~# '^newtype\s' + \ || a:line =~# '^class\s' + \ || a:line =~# '^instance\s' + \ || a:line =~ '^[^:]\+\s*::' +endfunction "}}} + +" Top Level one line shooters. +fun! s:HaskellSnipGlobal(line) "{{{ + return a:line =~# '^module' + \ || a:line =~# '^import' + \ || a:line =~# '^infix[lr]\s' +endfunction "}}} + +" The real folding function +fun! haskellFold#HaskellFold( lineNum ) "{{{ + let line = getline( a:lineNum ) + + " Beginning of comment + if line =~ '^\s*--' || line =~ '^\s*{-' + return 2 + endif + + if line =~ '^import' + return 2 + endif + + if s:HaskellSnipGlobal( line ) + return 0 + endif + + if line =~ '^\s*$' + let nextline = getline(a:lineNum + 1) + if s:HaskellFoldMaster( nextline ) > 0 || s:HaskellSnipGlobal( nextline ) > 0 + \ || nextline =~ "^--" || nextline =~ "^{-" + return 0 + else + return -1 + endif + endif + + return 1 +endfunction "}}} + +" This function skim over function definitions +" skiping comments line : +" -- .... +" and merging lines without first non space element, to +" catch the full type expression. +fun! haskellFold#HaskellFoldText() "{{{ + let i = v:foldstart + let retVal = '' + let began = 0 + + let commentOnlyLine = '^\s*--.*$' + let monoLineComment = '\s*--.*$' + let nonEmptyLine = '^\s\+\S' + let emptyLine = '^\s*$' + let multilineCommentBegin = '^\s*{-' + let multilineCommentEnd = '-}' + + let short = get(g:, 'haskellFold_ShortText', 0) + let isMultiLine = 0 + + let line = getline(i) + while i <= v:foldend + + if isMultiLine + if line =~ multilineCommentEnd + let isMultiLine = 0 + let line = substitute(line, '.*-}', '', '') + + if line =~ emptyLine + let i = i + 1 + let line = getline(i) + end + else + let i = i + 1 + let line = getline(i) + end + else + if line =~ multilineCommentBegin + let isMultiLine = 1 + continue + elseif began == 0 && !(line =~ commentOnlyLine) + let retVal = substitute(line, monoLineComment, ' ','') + let began = 1 + elseif began != 0 && line =~ nonEmptyLine && !short + let tempVal = substitute( line, '\s\+\(.*\)$', ' \1', '' ) + let retVal = retVal . substitute(tempVal, '\s\+--.*', ' ','') + elseif began != 0 + break + endif + + let i = i + 1 + let line = getline(i) + endif + endwhile + + if retVal == '' + " We didn't found any meaningfull text + return foldtext() + endif + + return retVal +endfunction "}}} diff --git a/etc/soft/nvim/+plugins/vim-haskellfold/ftplugin/haskell.vim b/etc/soft/nvim/+plugins/vim-haskellfold/ftplugin/haskell.vim new file mode 100644 index 0000000..eb5daee --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellfold/ftplugin/haskell.vim @@ -0,0 +1 @@ +call SetHaskellFolding() diff --git a/etc/soft/nvim/+plugins/vim-haskellfold/plugin/haskellFold.vim b/etc/soft/nvim/+plugins/vim-haskellfold/plugin/haskellFold.vim new file mode 100644 index 0000000..74f19ba --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-haskellfold/plugin/haskellFold.vim @@ -0,0 +1,11 @@ +if exists("g:__HASKELLFOLD_VIM__") + finish +endif + +let g:__HASKELLFOLD_VIM__ = 1 + +fun! SetHaskellFolding() "{{{ + setlocal foldexpr=haskellFold#HaskellFold(v:lnum) + setlocal foldtext=haskellFold#HaskellFoldText() + setlocal foldmethod=expr +endfunction "}}} diff --git a/etc/soft/nvim/+plugins/vim-haskellConceal/README b/etc/soft/nvim/+plugins_disabled/vim-haskellConceal/README similarity index 100% rename from etc/soft/nvim/+plugins/vim-haskellConceal/README rename to etc/soft/nvim/+plugins_disabled/vim-haskellConceal/README diff --git a/etc/soft/nvim/+plugins/vim-haskellConceal/after/syntax/haskell.vim b/etc/soft/nvim/+plugins_disabled/vim-haskellConceal/after/syntax/haskell.vim similarity index 100% rename from etc/soft/nvim/+plugins/vim-haskellConceal/after/syntax/haskell.vim rename to etc/soft/nvim/+plugins_disabled/vim-haskellConceal/after/syntax/haskell.vim diff --git a/etc/soft/nvim/ftdetect/detect.vim b/etc/soft/nvim/ftdetect/detect.vim index 14e4519..471cb67 100644 --- a/etc/soft/nvim/ftdetect/detect.vim +++ b/etc/soft/nvim/ftdetect/detect.vim @@ -1,6 +1,3 @@ -au BufNewFile,BufRead *.hs set foldexpr=HaskellFold(v:lnum) -au BufNewFile,BufRead *.hs set foldmethod=expr - au BufNewFile,BufRead *.test set filetype=tcl au BufNewFile,BufRead *.txt set textwidth=80 au BufNewFile,BufRead *.txt set filetype=txt @@ -11,7 +8,7 @@ au BufRead,BufNewFile *.xpt.vim set filetype=xpt.vim au BufRead,BufNewFile *.xpt.vim set filetype=xpt.vim au BufRead,BufNewFile *.vim set filetype=vim au BufRead,BufNewFile *.mutt set filetype=muttrc -au BufRead,BufNewFile *rtorrent.rc* set filetype=rtorrent +au BufRead,BufNewFile *rtorrent.rc* set filetype=rtorrent au BufRead,BufNewFile *.gv set filetype=graphviz au BufRead,BufNewFile *.r set filetype=rebol au BufRead,BufNewFile rfc* set filetype=rfc @@ -21,9 +18,9 @@ au BufWinEnter,BufRead,BufNewFile *.wiki set nocursorline au BufRead,BufNewFile *.timelog set filetype=timelog au BufRead,BufNewFile *.rkt set filetype=racket -au BufRead,BufNewFile *.scm runtime plugin/RainbowParenthsis.vim -au BufRead,BufNewFile *.lisp runtime plugin/RainbowParenthsis.vim -au BufRead,BufNewFile *.rkt runtime plugin/RainbowParenthsis.vim +au BufRead,BufNewFile *.scm runtime plugin/RainbowParenthsis.vim +au BufRead,BufNewFile *.lisp runtime plugin/RainbowParenthsis.vim +au BufRead,BufNewFile *.rkt runtime plugin/RainbowParenthsis.vim au BufRead,BufNewFile *.scm set lisp au BufRead,BufNewFile *.lisp set lisp diff --git a/etc/soft/nvim/syntax/haskell.vim b/etc/soft/nvim/syntax/haskell.vim deleted file mode 100644 index b8df3bf..0000000 --- a/etc/soft/nvim/syntax/haskell.vim +++ /dev/null @@ -1,577 +0,0 @@ -" Vim syntax file -" Language: Haskell -" Maintainer: Rui Carlos A. Goncalves -" Yang Zhang -" Last Change: July 31, 2010 -" -" Version: 1.3 -" Url: http://www.rcg-pt.net/programacao/haskell.vim.gz -" -" Original Author: John Williams - -" Remove any old syntax stuff hanging around -if version < 600 - syn clear -elseif exists("b:current_syntax") - finish -endif - - -" (Qualified) identifiers (no default highlighting) -syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" -syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" - - -" Infix operators--most punctuation characters and any (qualified) identifier -" enclosed in `backquotes`. An operator starting with : is a constructor, -" others are variables (e.g. functions). -syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*" -syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*" -syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`" -syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`" - - -" Reserved symbols--cannot be overloaded. -syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|_\|{\|}" - - -" Strings and constants -syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" -syn match hsSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)" -syn match hsSpecialCharError contained "\\&\|'''\+" -syn region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar -syn match hsCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError -syn match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError -syn match hsNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>" -syn match hsFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" - - -" Keyword definitions. These must be patters instead of keywords -" because otherwise they would match as keywords at the start of a -" "literate" comment (see lhs.vim). -syn match hsModule "\" -syn match hsImport "\.*"he=s+6 contains=hsImportMod -syn match hsImportMod contained "\<\(as\|qualified\|hiding\)\>" -syn match hsInfix "\<\(infix\|infixl\|infixr\)\>" -syn match hsStructure "\<\(class\|data\|deriving\|instance\|default\|where\)\>" -syn match hsTypedef "\<\(type\|newtype\)\>" -syn match hsStatement "\<\(do\|return\|case\|of\|let\|in\)\>" -syn match hsConditional "\<\(if\|then\|else\)\>" - - -" Types -syn keyword hsType Array -syn keyword hsType Bool BufferMode -syn keyword hsType CalendarTime Char ClockTime Complex Complex -syn keyword hsType Day Double -syn keyword hsType Either ExitCode -syn keyword hsType FilePath Float -syn keyword hsType Handle HandlePosn -syn keyword hsType Int Integer IO IOError IOMode -syn keyword hsType Maybe Month -syn keyword hsType Ordering -syn keyword hsType Permissions -syn keyword hsType Ratio Rational Rational Read ReadS -syn keyword hsType SeekMode Show ShowS StdGen String -syn keyword hsType TimeDiff TimeLocale - - -" Classes from the standard prelude -syn keyword hsCls Bounded -syn keyword hsCls Enum Eq -syn keyword hsCls Floating Fractional Functor -syn keyword hsCls Integral Ix -syn keyword hsCls Monad MonadPlus -syn keyword hsCls Num -syn keyword hsCls Ord -syn keyword hsCls Random RandomGen Read Real RealFloat RealFrac -syn keyword hsCls Show - - -" Functions -syn keyword hsFunc abs -syn keyword hsFunc accum -syn keyword hsFunc accumArray -syn keyword hsFunc acos -syn keyword hsFunc acosh -syn keyword hsFunc addToClockTime -syn keyword hsFunc all -syn keyword hsFunc and -syn keyword hsFunc any -syn keyword hsFunc ap -syn keyword hsFunc appendFile -syn keyword hsFunc approxRational -syn keyword hsFunc array -syn keyword hsFunc asin -syn keyword hsFunc asinh -syn keyword hsFunc assocs -syn keyword hsFunc asTypeOf -syn keyword hsFunc atan -syn keyword hsFunc atan2 -syn keyword hsFunc atanh - -syn keyword hsFunc bounds -syn keyword hsFunc bracket -syn keyword hsFunc bracket_ -syn keyword hsFunc break - -syn keyword hsFunc calendarTimeToString -syn keyword hsFunc catch -syn keyword hsFunc catMaybes -syn keyword hsFunc ceiling -syn keyword hsFunc chr -syn keyword hsFunc cis -syn keyword hsFunc compare -syn keyword hsFunc concat -syn keyword hsFunc concatMap -syn keyword hsFunc conjugate -syn keyword hsFunc const -syn keyword hsFunc cos -syn keyword hsFunc cosh -syn keyword hsFunc cpuTimePrecision -syn keyword hsFunc createDirectory -syn keyword hsFunc curry -syn keyword hsFunc cycle - -syn keyword hsFunc decodeFloat -syn keyword hsFunc defaultTimeLocale -syn keyword hsFunc delete -syn keyword hsFunc deleteBy -syn keyword hsFunc denominator -syn keyword hsFunc diffClockTimes -syn keyword hsFunc digitToInt -syn keyword hsFunc div -syn keyword hsFunc divMod -syn keyword hsFunc doesDirectoryExist -syn keyword hsFunc doesFileExist -syn keyword hsFunc drop -syn keyword hsFunc dropWhile - -syn keyword hsFunc either -syn keyword hsFunc elem -syn keyword hsFunc elemIndex -syn keyword hsFunc elemIndices -syn keyword hsFunc elems -syn keyword hsFunc encodeFloat -syn keyword hsFunc enumFrom -syn keyword hsFunc enumFromThen -syn keyword hsFunc enumFromThenTo -syn keyword hsFunc enumFromTo -syn keyword hsFunc error -syn keyword hsFunc even -syn keyword hsFunc executable -syn keyword hsFunc exitFailure -syn keyword hsFunc exitWith -syn keyword hsFunc exp -syn keyword hsFunc exponent - -syn keyword hsFunc fail -syn keyword hsFunc filter -syn keyword hsFunc filterM -syn keyword hsFunc find -syn keyword hsFunc findIndex -syn keyword hsFunc findIndices -syn keyword hsFunc flip -syn keyword hsFunc floatDigits -syn keyword hsFunc floatRadix -syn keyword hsFunc floatRange -syn keyword hsFunc floatToDigits -syn keyword hsFunc floor -syn keyword hsFunc fmap -syn keyword hsFunc foldl -syn keyword hsFunc foldl1 -syn keyword hsFunc foldM -syn keyword hsFunc foldr -syn keyword hsFunc foldr1 -syn keyword hsFunc formatCalendarTime -syn keyword hsFunc fromEnum -syn keyword hsFunc fromInteger -syn keyword hsFunc fromIntegral -syn keyword hsFunc fromJust -syn keyword hsFunc fromMaybe -syn keyword hsFunc fromRat -syn keyword hsFunc fromRational -syn keyword hsFunc fst - -syn keyword hsFunc gcd -syn keyword hsFunc genericDrop -syn keyword hsFunc genericIndex -syn keyword hsFunc genericLength -syn keyword hsFunc genericReplicate -syn keyword hsFunc genericSplitAt -syn keyword hsFunc genericTake -syn keyword hsFunc getArgs -syn keyword hsFunc getChar -syn keyword hsFunc getClockTime -syn keyword hsFunc getContents -syn keyword hsFunc getCPUTime -syn keyword hsFunc getCurrentDirectory -syn keyword hsFunc getDirectoryContents -syn keyword hsFunc getEnv -syn keyword hsFunc getLine -syn keyword hsFunc getModificationTime -syn keyword hsFunc getPermissions -syn keyword hsFunc getProgName -syn keyword hsFunc getStdGen -syn keyword hsFunc getStdRandom -syn keyword hsFunc group -syn keyword hsFunc groupBy -syn keyword hsFunc guard - -syn keyword hsFunc hClose -syn keyword hsFunc head -syn keyword hsFunc hFileSize -syn keyword hsFunc hFlush -syn keyword hsFunc hGetBuffering -syn keyword hsFunc hGetChar -syn keyword hsFunc hGetContents -syn keyword hsFunc hGetLine -syn keyword hsFunc hGetPosn -syn keyword hsFunc hIsClosed -syn keyword hsFunc hIsEOF -syn keyword hsFunc hIsOpen -syn keyword hsFunc hIsReadable -syn keyword hsFunc hIsSeekable -syn keyword hsFunc hIsWritable -syn keyword hsFunc hLookAhead -syn keyword hsFunc hPrint -syn keyword hsFunc hPutChar -syn keyword hsFunc hPutStr -syn keyword hsFunc hPutStrLn -syn keyword hsFunc hReady -syn keyword hsFunc hSeek -syn keyword hsFunc hSetBuffering -syn keyword hsFunc hSetPosn -syn keyword hsFunc hWaitForInput - -syn keyword hsFunc id -syn keyword hsFunc imagPart -syn keyword hsFunc index -syn keyword hsFunc indices -syn keyword hsFunc init -syn keyword hsFunc inits -syn keyword hsFunc inRange -syn keyword hsFunc insert -syn keyword hsFunc insertBy -syn keyword hsFunc interact -syn keyword hsFunc intersect -syn keyword hsFunc intersectBy -syn keyword hsFunc intersperse -syn keyword hsFunc intToDigit -syn keyword hsFunc ioeGetErrorString -syn keyword hsFunc ioeGetFileName -syn keyword hsFunc ioeGetHandle -syn keyword hsFunc ioError -syn keyword hsFunc isAlpha -syn keyword hsFunc isAlphaNum -syn keyword hsFunc isAlreadyExistsError -syn keyword hsFunc isAlreadyInUseError -syn keyword hsFunc isAscii -syn keyword hsFunc isControl -syn keyword hsFunc isDenormalized -syn keyword hsFunc isDigit -syn keyword hsFunc isDoesNotExistError -syn keyword hsFunc isEOF -syn keyword hsFunc isEOFError -syn keyword hsFunc isFullError -syn keyword hsFunc isHexDigit -syn keyword hsFunc isIEEE -syn keyword hsFunc isIllegalOperation -syn keyword hsFunc isInfinite -syn keyword hsFunc isJust -syn keyword hsFunc isLatin1 -syn keyword hsFunc isLower -syn keyword hsFunc isNaN -syn keyword hsFunc isNegativeZero -syn keyword hsFunc isNothing -syn keyword hsFunc isOctDigit -syn keyword hsFunc isPermissionError -syn keyword hsFunc isPrefixOf -syn keyword hsFunc isPrint -syn keyword hsFunc isSpace -syn keyword hsFunc isSuffixOf -syn keyword hsFunc isUpper -syn keyword hsFunc isUserError -syn keyword hsFunc iterate -syn keyword hsFunc ixmap - -syn keyword hsFunc join - -syn keyword hsFunc last -syn keyword hsFunc lcm -syn keyword hsFunc length -syn keyword hsFunc lex -syn keyword hsFunc lexDigits -syn keyword hsFunc lexLitChar -syn keyword hsFunc liftM -syn keyword hsFunc liftM2 -syn keyword hsFunc liftM3 -syn keyword hsFunc liftM4 -syn keyword hsFunc liftM5 -syn keyword hsFunc lines -syn keyword hsFunc listArray -syn keyword hsFunc listToMaybe -syn keyword hsFunc log -syn keyword hsFunc logBase -syn keyword hsFunc lookup - -syn keyword hsFunc magnitude -syn keyword hsFunc map -syn keyword hsFunc mapAccumL -syn keyword hsFunc mapAccumR -syn keyword hsFunc mapAndUnzipM -syn keyword hsFunc mapM -syn keyword hsFunc mapM_ -syn keyword hsFunc mapMaybe -syn keyword hsFunc max -syn keyword hsFunc maxBound -syn keyword hsFunc maximum -syn keyword hsFunc maximumBy -syn keyword hsFunc maybe -syn keyword hsFunc maybeToList -syn keyword hsFunc min -syn keyword hsFunc minBound -syn keyword hsFunc minimum -syn keyword hsFunc minimumBy -syn keyword hsFunc mkPolar -syn keyword hsFunc mkStdGen -syn keyword hsFunc mod -syn keyword hsFunc msum - -syn keyword hsFunc negate -syn keyword hsFunc newStdGen -syn keyword hsFunc next -syn keyword hsFunc not -syn keyword hsFunc notElem -syn keyword hsFunc nub -syn keyword hsFunc nubBy -syn keyword hsFunc null -syn keyword hsFunc numerator - -syn keyword hsFunc odd -syn keyword hsFunc openFile -syn keyword hsFunc or -syn keyword hsFunc ord -syn keyword hsFunc otherwise - -syn keyword hsFunc partition -syn keyword hsFunc phase -" syn keyword hsFunc pi -syn keyword hsFunc polar -syn keyword hsFunc pred -syn keyword hsFunc print -" syn keyword hsFunc product -syn keyword hsFunc properFraction -syn keyword hsFunc putChar -syn keyword hsFunc putStr -syn keyword hsFunc putStrLn - -syn keyword hsFunc quot -syn keyword hsFunc quotRem - -syn keyword hsFunc random -syn keyword hsFunc randomIO -syn keyword hsFunc randomR -syn keyword hsFunc randomRIO -syn keyword hsFunc randomRs -syn keyword hsFunc randoms -syn keyword hsFunc range -syn keyword hsFunc rangeSize -syn keyword hsFunc read -syn keyword hsFunc readable -syn keyword hsFunc readDec -syn keyword hsFunc readFile -syn keyword hsFunc readFloat -syn keyword hsFunc readHex -syn keyword hsFunc readInt -syn keyword hsFunc readIO -syn keyword hsFunc readList -syn keyword hsFunc readLitChar -syn keyword hsFunc readLn -syn keyword hsFunc readOct -syn keyword hsFunc readParen -syn keyword hsFunc reads -syn keyword hsFunc readSigned -syn keyword hsFunc readsPrec -syn keyword hsFunc realPart -syn keyword hsFunc realToFrac -syn keyword hsFunc recip -syn keyword hsFunc rem -syn keyword hsFunc removeDirectory -syn keyword hsFunc removeFile -syn keyword hsFunc renameDirectory -syn keyword hsFunc renameFile -syn keyword hsFunc repeat -syn keyword hsFunc replicate -syn keyword hsFunc return -syn keyword hsFunc reverse -syn keyword hsFunc round - -syn keyword hsFunc scaleFloat -syn keyword hsFunc scanl -syn keyword hsFunc scanl1 -syn keyword hsFunc scanr -syn keyword hsFunc scanr1 -syn keyword hsFunc searchable -syn keyword hsFunc seq -syn keyword hsFunc sequence -syn keyword hsFunc sequence_ -syn keyword hsFunc setCurrentDirectory -syn keyword hsFunc setPermissions -syn keyword hsFunc setStdGen -syn keyword hsFunc show -syn keyword hsFunc showChar -syn keyword hsFunc showEFloat -syn keyword hsFunc showFFloat -syn keyword hsFunc showFloat -syn keyword hsFunc showGFloat -syn keyword hsFunc showInt -syn keyword hsFunc showList -syn keyword hsFunc showLitChar -syn keyword hsFunc showParen -syn keyword hsFunc shows -syn keyword hsFunc showSigned -syn keyword hsFunc showsPrec -syn keyword hsFunc showString -syn keyword hsFunc significand -syn keyword hsFunc signum -syn keyword hsFunc sin -syn keyword hsFunc sinh -syn keyword hsFunc snd -syn keyword hsFunc sort -syn keyword hsFunc sortBy -syn keyword hsFunc split -syn keyword hsFunc splitAt -" syn keyword hsFunc sqrt -syn keyword hsFunc stderr -syn keyword hsFunc stdin -syn keyword hsFunc stdout -syn keyword hsFunc subtract -syn keyword hsFunc succ -" syn keyword hsFunc sum -syn keyword hsFunc system - -syn keyword hsFunc tail -syn keyword hsFunc tails -syn keyword hsFunc take -syn keyword hsFunc takeWhile -syn keyword hsFunc tan -syn keyword hsFunc tanh -syn keyword hsFunc toCalendarTime -syn keyword hsFunc toClockTime -syn keyword hsFunc toEnum -syn keyword hsFunc toInteger -syn keyword hsFunc toLower -syn keyword hsFunc toRational -syn keyword hsFunc toUpper -syn keyword hsFunc toUTCTime -syn keyword hsFunc transpose -syn keyword hsFunc truncate -syn keyword hsFunc try - -syn keyword hsFunc uncurry -syn keyword hsFunc undefined -syn keyword hsFunc unfoldr -syn keyword hsFunc union -syn keyword hsFunc unionBy -syn keyword hsFunc unless -syn keyword hsFunc unlines -syn keyword hsFunc until -syn keyword hsFunc unwords -syn keyword hsFunc unzip -syn keyword hsFunc unzip3 -syn keyword hsFunc unzip4 -syn keyword hsFunc unzip5 -syn keyword hsFunc unzip6 -syn keyword hsFunc unzip7 -syn keyword hsFunc userError - -syn keyword hsFunc when -syn keyword hsFunc words -syn keyword hsFunc writable -syn keyword hsFunc writeFile - -syn keyword hsFunc zip -syn keyword hsFunc zip3 -syn keyword hsFunc zip4 -syn keyword hsFunc zip5 -syn keyword hsFunc zip6 -syn keyword hsFunc zip7 -syn keyword hsFunc zipWith -syn keyword hsFunc zipWith3 -syn keyword hsFunc zipWith4 -syn keyword hsFunc zipWith5 -syn keyword hsFunc zipWith6 -syn keyword hsFunc zipWith7 -syn keyword hsFunc zipWithM -syn keyword hsFunc zipWithM_ - - -" Constants -syn match hsBoolean "\<\(True\|False\)\>" -syn match hsMaybe "\<\(Nothing\|Just\)\>" -syn match hsConstant "\<\(Left\|Right\)\>" -syn match hsOrdering "\<\(LT\|EQ\|GT\)\>" - - -" Comments -syn match hsLineComment "--.*" -syn region hsBlockComment start="{-" end="-}" contains=hsBlockComment -syn region hsPragma start="{-#" end="#-}" - -" Literate comments--any line not starting with '>' is a comment. -if exists("b:hs_literate_comments") - syn region hsLiterateComment start="^" end="^>" -endif - - -if !exists("hs_minlines") - let hs_minlines = 50 -endif -exec "syn sync lines=" . hs_minlines - -if version >= 508 || !exists("did_hs_syntax_inits") - if version < 508 - let did_hs_syntax_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - hi link hsModule hsStructure - hi link hsImport Include - hi link hsImportMod hsImport - hi link hsInfix PreProc - hi link hsStructure Structure - hi link hsStatement Statement - hi link hsConditional Conditional - hi link hsSpecialChar SpecialChar - hi link hsTypedef Typedef - hi link hsVarSym hsOperator - hi link hsConSym hsOperator - hi link hsOperator Operator - hi link hsSpecialCharError Error - hi link hsString String - hi link hsCharacter Character - hi link hsNumber Number - hi link hsFloat Float - hi link hsConditional Conditional - hi link hsLiterateComment hsComment - hi link hsBlockComment hsComment - hi link hsLineComment hsComment - hi link hsComment Comment - hi link hsPragma SpecialComment - hi link hsBoolean Boolean - hi link hsType Type - hi link hsFunc Function - hi link hsMaybe hsEnumConst - hi link hsOrdering hsEnumConst - hi link hsEnumConst Constant - hi link hsConstant Constant - hi link hsDebug Debug - hi link hsCls Debug - - delcommand HiLink -endif - -let b:current_syntax = "haskell" diff --git a/etc/soft/nvim/vimrc b/etc/soft/nvim/vimrc index a90fe8c..c65db22 100644 --- a/etc/soft/nvim/vimrc +++ b/etc/soft/nvim/vimrc @@ -97,6 +97,8 @@ set iminsert=0 " Раскладка по умолчанию - английс "match ErrorMsg '\%>80v.\+' " Подсветка выхода за 80-й символ +match ErrorMsg /\s\+\%#\@> ) -set listchars=tab:>.,trail:+,extends:#,nbsp:. " Показывать табуляцию и висящие пробелы + +" Показывать табуляцию и висящие пробелы +set listchars=tab:▸·,space:·,nbsp:␣,trail:+,eol:¶,precedes:«,extends:» " }}}--------------------------------------------------------------------------- @@ -434,7 +438,7 @@ cnoremap " Редактирование макросов ("X,@") nn @ :='let @'.v:register.' = - \ '.string(getreg(v:register)) + \ '.string(getreg(v:register)) " Редактирование окружений (cib/dap/...) {{{ " Редактирование СЛЕДУЮЩЕГО окружения" @@ -803,20 +807,20 @@ nnoremap n :NnnPicker '%:p:h' " Floating window (neovim) function! s:layout() - let buf = nvim_create_buf(v:false, v:true) + let buf = nvim_create_buf(v:false, v:true) - let height = &lines - (float2nr(&lines / 3)) - let width = float2nr(&columns - (&columns * 2 / 3)) + let height = &lines - (float2nr(&lines / 3)) + let width = float2nr(&columns - (&columns * 2 / 3)) - let opts = { - \ 'relative': 'editor', - \ 'row': 2, - \ 'col': 8, - \ 'width': width, - \ 'height': height - \ } + let opts = { + \ 'relative': 'editor', + \ 'row': 2, + \ 'col': 8, + \ 'width': width, + \ 'height': height + \ } - call nvim_open_win(buf, v:true, opts) + call nvim_open_win(buf, v:true, opts) endfunction let g:nnn#layout = 'call ' . string(function('layout')) . '()' @@ -848,7 +852,7 @@ let g:CheatSheetUrlGetterIdFlag='-b' " cheat sheet base url let g:CheatSheetBaseUrl='https://cht.sh' -" cheat sheet settings do not include style settings neiter comments, +" cheat sheet settings do not include style settings neiter comments, " see other options below let g:CheatSheetUrlSettings='q' @@ -876,7 +880,7 @@ let g:CheatSheetDefaultMode=0 let g:CheatSheetFrameworks = {} imap