22 changed files with 1657 additions and 776 deletions
@ -1,63 +1,4 @@ |
|||||||
set makeprg=ghc\ %\ -o\ %< " Компилятор |
set makeprg=ghc\ %\ -o\ %< " Компилятор |
||||||
|
|
||||||
set foldexpr=HaskellFold(v:lnum) |
call SetHaskellFolding() |
||||||
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 "}}} |
|
||||||
|
|
||||||
|
@ -0,0 +1 @@ |
|||||||
|
Subproject commit b1ac46807835423c4a4dd063df6d5b613d89c731 |
@ -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: |
||||||
|
|
||||||
|
 |
||||||
|
|
||||||
|
- 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`: |
||||||
|
|
||||||
|
``` |
||||||
|
<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"> |
||||||
|
<fontconfig> |
||||||
|
<dir>~/.fonts</dir> |
||||||
|
<alias> |
||||||
|
<family>monospace</family> |
||||||
|
<prefer> |
||||||
|
<family>TeX Gyre Schola Math monospacified for DejaVu Sans Mono</family> |
||||||
|
</prefer> |
||||||
|
</alias> |
||||||
|
</fontconfig> |
||||||
|
``` |
||||||
|
|
||||||
|
- 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. |
@ -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 |
@ -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 |
After Width: | Height: | Size: 181 KiB |
@ -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 |
@ -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" "$@" |
@ -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" "$@" |
@ -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 |
@ -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 "}}} |
@ -0,0 +1 @@ |
|||||||
|
call SetHaskellFolding() |
@ -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 "}}} |
@ -1,577 +0,0 @@ |
|||||||
" Vim syntax file |
|
||||||
" Language: Haskell |
|
||||||
" Maintainer: Rui Carlos A. Goncalves <rcgoncalves.pt@gmail.com> |
|
||||||
" Yang Zhang <treblih.divad@gmail.com> |
|
||||||
" Last Change: July 31, 2010 |
|
||||||
" |
|
||||||
" Version: 1.3 |
|
||||||
" Url: http://www.rcg-pt.net/programacao/haskell.vim.gz |
|
||||||
" |
|
||||||
" Original Author: John Williams <jrw@pobox.com> |
|
||||||
|
|
||||||
" 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 "\<module\>" |
|
||||||
syn match hsImport "\<import\>.*"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 <args> |
|
||||||
else |
|
||||||
command -nargs=+ HiLink hi def link <args> |
|
||||||
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" |
|
Loading…
Reference in new issue