├── .gitmodules
├── README.md
├── vim
├── autoload
│ └── pathogen.vim
├── ftplugin
│ └── haskell.vim
├── snippets
│ └── haskell.snippets
└── syntax
│ ├── alex.vim
│ ├── cabal.vim
│ ├── happy.vim
│ └── haskell.vim
└── vimrc
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "vim/bundle/ghcmod-vim"]
2 | path = vim/bundle/ghcmod-vim
3 | url = https://github.com/eagletmt/ghcmod-vim.git
4 | [submodule "vim/bundle/neco-ghc"]
5 | path = vim/bundle/neco-ghc
6 | url = https://github.com/eagletmt/neco-ghc
7 | [submodule "vim/bundle/ctrlp.vim"]
8 | path = vim/bundle/ctrlp.vim
9 | url = https://github.com/ctrlpvim/ctrlp.vim.git
10 | [submodule "vim/bundle/syntastic"]
11 | path = vim/bundle/syntastic
12 | url = https://github.com/scrooloose/syntastic.git
13 | [submodule "vim/bundle/tlib_vim"]
14 | path = vim/bundle/tlib_vim
15 | url = https://github.com/tomtom/tlib_vim.git
16 | [submodule "vim/bundle/vim-addon-mw-utils"]
17 | path = vim/bundle/vim-addon-mw-utils
18 | url = https://github.com/MarcWeber/vim-addon-mw-utils.git
19 | [submodule "vim/bundle/vim-snipmate"]
20 | path = vim/bundle/vim-snipmate
21 | url = https://github.com/garbas/vim-snipmate.git
22 | [submodule "vim/bundle/nerdtree"]
23 | path = vim/bundle/nerdtree
24 | url = https://github.com/scrooloose/nerdtree.git
25 | [submodule "vim/bundle/nerdcommenter"]
26 | path = vim/bundle/nerdcommenter
27 | url = https://github.com/scrooloose/nerdcommenter.git
28 | [submodule "vim/bundle/tabular"]
29 | path = vim/bundle/tabular
30 | url = https://github.com/godlygeek/tabular.git
31 | [submodule "vim/bundle/supertab"]
32 | path = vim/bundle/supertab
33 | url = https://github.com/ervandew/supertab.git
34 | [submodule "vim/bundle/neocomplete.vim"]
35 | path = vim/bundle/neocomplete.vim
36 | url = https://github.com/Shougo/neocomplete.vim.git
37 | [submodule "vim/bundle/vimproc.vim"]
38 | path = vim/bundle/vimproc.vim
39 | url = https://github.com/Shougo/vimproc.vim.git
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # haskell-vim-proto
2 |
3 | Minimalist starter config for vim and Haskell.
4 |
5 | * **[Article](http://www.stephendiehl.com/posts/vim_2016.html)**
6 |
7 | For a more fully featured setup script see:
8 |
9 | * **[haskell-vim-now]( https://github.com/begriffs/haskell-vim-now)**
10 |
11 | #### Setup
12 |
13 | ```bash
14 | $ git clone --recursive https://github.com/sdiehl/haskell-vim-proto.git
15 | $ cd haskell-vim-proto
16 | $ cp -n vimrc ~/.vimrc # Will not clobber existing config
17 | $ cp -rn vim ~/.vim
18 | ```
19 | Installs the following submodules using pathogen.
20 |
21 | * ghcmod-vim
22 | * neco-ghc
23 | * vim-snipmate
24 | * syntastic
25 | * neocompletee.vim
26 | * ctrlp.vim
27 | * nerdtree
28 | * nerdcommenter
29 | * tabular
30 | * supertab
31 | * neocomplete
32 |
--------------------------------------------------------------------------------
/vim/autoload/pathogen.vim:
--------------------------------------------------------------------------------
1 | " pathogen.vim - path option manipulation
2 | " Maintainer: Tim Pope
3 | " Version: 2.4
4 |
5 | " Install in ~/.vim/autoload (or ~\vimfiles\autoload).
6 | "
7 | " For management of individually installed plugins in ~/.vim/bundle (or
8 | " ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
9 | " .vimrc is the only other setup necessary.
10 | "
11 | " The API is documented inline below.
12 |
13 | if exists("g:loaded_pathogen") || &cp
14 | finish
15 | endif
16 | let g:loaded_pathogen = 1
17 |
18 | " Point of entry for basic default usage. Give a relative path to invoke
19 | " pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
20 | " pathogen#surround(). Curly braces are expanded with pathogen#expand():
21 | " "bundle/{}" finds all subdirectories inside "bundle" inside all directories
22 | " in the runtime path.
23 | function! pathogen#infect(...) abort
24 | for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
25 | if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
26 | call pathogen#surround(path)
27 | elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
28 | call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
29 | call pathogen#surround(path . '/{}')
30 | elseif path =~# '[{}*]'
31 | call pathogen#interpose(path)
32 | else
33 | call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
34 | call pathogen#interpose(path . '/{}')
35 | endif
36 | endfor
37 | call pathogen#cycle_filetype()
38 | if pathogen#is_disabled($MYVIMRC)
39 | return 'finish'
40 | endif
41 | return ''
42 | endfunction
43 |
44 | " Split a path into a list.
45 | function! pathogen#split(path) abort
46 | if type(a:path) == type([]) | return a:path | endif
47 | if empty(a:path) | return [] | endif
48 | let split = split(a:path,'\\\@]','\\&','')
244 | endif
245 | endfunction
246 |
247 | " Like findfile(), but hardcoded to use the runtimepath.
248 | function! pathogen#runtime_findfile(file,count) abort
249 | let rtp = pathogen#join(1,pathogen#split(&rtp))
250 | let file = findfile(a:file,rtp,a:count)
251 | if file ==# ''
252 | return ''
253 | else
254 | return fnamemodify(file,':p')
255 | endif
256 | endfunction
257 |
258 | " Section: Deprecated
259 |
260 | function! s:warn(msg) abort
261 | echohl WarningMsg
262 | echomsg a:msg
263 | echohl NONE
264 | endfunction
265 |
266 | " Prepend all subdirectories of path to the rtp, and append all 'after'
267 | " directories in those subdirectories. Deprecated.
268 | function! pathogen#runtime_prepend_subdirectories(path) abort
269 | call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
270 | return pathogen#surround(a:path . pathogen#slash() . '{}')
271 | endfunction
272 |
273 | function! pathogen#incubate(...) abort
274 | let name = a:0 ? a:1 : 'bundle/{}'
275 | call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
276 | return pathogen#interpose(name)
277 | endfunction
278 |
279 | " Deprecated alias for pathogen#interpose().
280 | function! pathogen#runtime_append_all_bundles(...) abort
281 | if a:0
282 | call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
283 | else
284 | call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
285 | endif
286 | return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
287 | endfunction
288 |
289 | if exists(':Vedit')
290 | finish
291 | endif
292 |
293 | let s:vopen_warning = 0
294 |
295 | function! s:find(count,cmd,file,lcd)
296 | let rtp = pathogen#join(1,pathogen#split(&runtimepath))
297 | let file = pathogen#runtime_findfile(a:file,a:count)
298 | if file ==# ''
299 | return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
300 | endif
301 | if !s:vopen_warning
302 | let s:vopen_warning = 1
303 | let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
304 | else
305 | let warning = ''
306 | endif
307 | if a:lcd
308 | let path = file[0:-strlen(a:file)-2]
309 | execute 'lcd `=path`'
310 | return a:cmd.' '.pathogen#fnameescape(a:file) . warning
311 | else
312 | return a:cmd.' '.pathogen#fnameescape(file) . warning
313 | endif
314 | endfunction
315 |
316 | function! s:Findcomplete(A,L,P)
317 | let sep = pathogen#slash()
318 | let cheats = {
319 | \'a': 'autoload',
320 | \'d': 'doc',
321 | \'f': 'ftplugin',
322 | \'i': 'indent',
323 | \'p': 'plugin',
324 | \'s': 'syntax'}
325 | if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
326 | let request = cheats[a:A[0]].a:A[1:-1]
327 | else
328 | let request = a:A
329 | endif
330 | let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
331 | let found = {}
332 | for path in pathogen#split(&runtimepath)
333 | let path = expand(path, ':p')
334 | let matches = split(glob(path.sep.pattern),"\n")
335 | call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
336 | call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
337 | for match in matches
338 | let found[match] = 1
339 | endfor
340 | endfor
341 | return sort(keys(found))
342 | endfunction
343 |
344 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0)
345 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0)
346 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1)
347 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1)
348 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1)
349 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1)
350 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1)
351 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1)
352 |
353 | " vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
354 |
--------------------------------------------------------------------------------
/vim/ftplugin/haskell.vim:
--------------------------------------------------------------------------------
1 | set expandtab
2 | set shiftwidth=2
3 |
--------------------------------------------------------------------------------
/vim/snippets/haskell.snippets:
--------------------------------------------------------------------------------
1 | snippet case
2 | case ${1} of
3 | ${2:_} -> ${3:undefined}
4 |
5 | snippet do
6 |
7 | do ${1:undefined}
8 | ${2:undefined}
9 |
10 | snippet wh
11 |
12 | where
13 | ${1:fn} = ${2:undefined}
14 |
15 | snippet let
16 | let ${1} = ${2}
17 | in ${3}
18 |
19 | snippet new
20 | newtype ${1:name} = $1 { un$1 :: ${2} }
21 | deriving ($4)
22 |
23 | snippet mod
24 | module ${1} (
25 | ${2},
26 | ) where
27 |
28 | snippet if
29 | if ${1}
30 | then ${2}
31 | else ${3}
32 |
33 | snippet im
34 | import qualified ${1:Data.Text} as ${2:T}
35 |
36 | snippet iq
37 | import qualified ${1:Data.Text} as ${2:T}
38 |
39 | snippet cl
40 | class ${1:Name} where
41 | ${2:name} :: ${3}
42 |
43 | snippet in
44 | instance ${1:Class} ${2:Type} where
45 | ${3}
46 |
47 | snippet rec
48 | data ${1} = ${2}
49 | { ${3} :: ${4:T}
50 | } deriving (${6:classes})
51 |
52 | snippet ff
53 | foreign import ccall safe "${1:cfunction}" ${2:name}
54 | :: ${3:function}
55 |
56 | snippet pra
57 | {-# LANGUAGE ${1} #-}
58 |
59 | snippet case
60 |
61 | case ${1} of
62 | ${2} -> ${3}
63 |
64 |
65 | snippet \
66 | (\ ${1} -> ${2:undefined})
67 |
68 | snippet bar
69 | -------------------------------------------------------------------------------
70 | -- ${1}
71 | -------------------------------------------------------------------------------
72 |
73 | snippet mm
74 | import Control.Monad
75 | import Control.Applicative
76 | import Control.Monad.State
77 | import Control.Monad.Reader
78 | import Control.Monad.Except
79 |
80 | snippet usual
81 | import Data.Maybe
82 | import Data.Functor
83 | import Data.Foldable
84 | import Data.Traversable
85 | import Control.Monad
86 | import Control.Applicative
87 |
88 | snippet fold
89 | import Data.Foldable
90 | import Data.Traversable
91 |
92 | snippet bs
93 | import qualified Data.ByteString as S
94 | import qualified Data.ByteString.Char8 as S8
95 |
96 | snippet containers
97 | import qualified Data.HashMap.Lazy as HashMap
98 | import qualified Data.HashSet as HashSet
99 | import qualified Data.IntMap as IntMap
100 | import qualified Data.IntSet as IntSet
101 | import qualified Data.IxSet as IxSet
102 | import qualified Data.Map as Map
103 | import qualified Data.Sequence as Seq
104 | import qualified Data.Set as Set
105 |
106 | snippet str
107 | {-# LANGUAGE OverloadedStrings #-}
108 |
109 | snippet gadt
110 | {-# LANGUAGE GADTs #-}
111 |
112 | snippet rank
113 | {-# LANGUAGE RankNTypes #-}
114 |
115 | snippet scope
116 | {-# LANGUAGE ScopedTypeVariables #-}
117 |
118 | snippet ffi
119 | {-# LANGUAGE ForeignFunctionInterface #-}
120 |
121 | snippet flex
122 | {-# LANGUAGE FlexibleInstances #-}
123 | {-# LANGUAGE FlexibleContexts #-}
124 | {-# LANGUAGE TypeSynonymInstances #-}
125 |
126 | snippet syn
127 | {-# LANGUAGE TypeSynonymInstances #-}
128 |
129 | snippet mparam
130 | {-# LANGUAGE MultiParamTypeClasses #-}
131 |
132 | snippet bang
133 | {-# LANGUAGE BangPatterns #-}
134 |
135 | snippet gnew
136 | {-# LANGUAGE GeneralizedNewtypeDeriving #-}
137 |
138 | snippet mono
139 | {-# LANGUAGE NoMonomorphismRestriction #-}
140 |
141 | snippet stand
142 | {-# LANGUAGE StandaloneDeriving #-}
143 |
144 | snippet temp
145 | {-# LANGUAGE TemplateHaskell #-}
146 |
147 | snippet derive
148 | {-# LANGUAGE DeriveDataTypeable #-}
149 | {-# LANGUAGE DeriveGeneric #-}
150 | {-# LANGUAGE DeriveFunctor #-}
151 | {-# LANGUAGE DeriveTraversable #-}
152 | {-# LANGUAGE DeriveFoldable #-}
153 |
154 | snippet type
155 | {-# LANGUAGE GADTs #-}
156 | {-# LANGUAGE TypeFamilies #-}
157 | {-# LANGUAGE TypeOperators #-}
158 | {-# LANGUAGE DataKinds #-}
159 | {-# LANGUAGE PolyKinds #-}
160 | {-# LANGUAGE KindSignatures #-}
161 | {-# LANGUAGE FlexibleInstances #-}
162 | {-# LANGUAGE FlexibleContexts #-}
163 | {-# LANGUAGE UndecidableInstances #-}
164 |
165 | import GHC.TypeLits
166 | import Data.Proxy
167 | import Data.Type.Equality
168 | import Data.Reflection
169 | import Data.Constraint
170 | import GHC.Exts (Constraint)
171 | import GHC.Prim (Any, AnyK)
172 |
173 | snippet crazy
174 | {-# LANGUAGE GADTs #-}
175 | {-# LANGUAGE DataKinds #-}
176 | {-# LANGUAGE RankNTypes #-}
177 | {-# LANGUAGE TypeFamilies #-}
178 | {-# LANGUAGE TypeOperators #-}
179 | {-# LANGUAGE KindSignatures #-}
180 | {-# LANGUAGE FlexibleInstances #-}
181 | {-# LANGUAGE FlexibleContexts #-}
182 | {-# LANGUAGE MultiParamTypeClasses #-}
183 | {-# LANGUAGE UndecidableInstances #-}
184 | {-# LANGUAGE ExistentialQuantification #-}
185 |
186 | snippet main
187 | main = return ()
188 |
189 | snippet opt
190 | {-# OPTIONS_GHC ${1} #-}
191 |
192 | snippet wall
193 | {-# OPTIONS_GHC -Wall #-}
194 |
195 | snippet nowarn
196 | {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
197 | {-# OPTIONS_GHC -fno-warn-type-defaults #-}
198 | {-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
199 |
200 | snippet box
201 | --------------------------------------------------------------------
202 | -- |
203 | -- Module :
204 | -- Copyright : (c) 2016
205 | -- License : MIT
206 | -- Maintainer:
207 | -- Stability : experimental
208 | -- Portability: non-portable
209 | --
210 | --------------------------------------------------------------------
211 |
212 | snippet dd
213 | deriving (Eq, Ord, Show, Typeable, Data, Generic)
214 |
215 | snippet inl
216 | {-# INLINE ${1} #-}
217 |
218 | snippet up
219 | {-# UNPACK #-}
220 |
221 | snippet un
222 | undefined
223 | snippet er
224 | error "${1}"
225 |
226 |
--------------------------------------------------------------------------------
/vim/syntax/alex.vim:
--------------------------------------------------------------------------------
1 | " Vim syntax file
2 | " Language: Alex config language
3 | " Maintainer: Nickolay Kudasov
4 | " Last Change: March 16, 2010
5 | "
6 | " Version: 0.2
7 | " Changes: $ and @ are now part of identifier
8 | " so auto complete works well
9 | " haskell directives are now regocnized
10 | " hightlighting fixmes
11 | " hightlighting todos and fixmes in haskell comments
12 |
13 | if exists("b:current_syntax")
14 | finish
15 | endif
16 |
17 | " macro definitions start with $ for sets and @ for regexps
18 | " so we add this symbols to isident to make autocompletion work properly
19 | set isident+=$
20 | set isident+=@
21 |
22 | " Haskell code in alex file
23 | syn match haskell_comment /--.*$/ contained contains=alex_todo,alex_fixme
24 | syn match haskell_char /'[^\\]'\|'\\.'/ contained
25 |
26 | syn region haskell_string start=/"/ skip=/\\"/ end=/"/ contained
27 | syn region haskell_block_comment start=/{-/ end=/-}/ fold contained contains=haskell_block_comment,alex_todo,alex_fixme
28 | syn region haskell_directive start=/{-#/ end=/#-}/ contained
29 | syn region haskell_code start=/{/ skip=/'\\\?}'/ end=/}/ fold contains=haskell_comment,haskell_block_comment,haskell_string,haskell_char,haskell_code,haskell_directive
30 |
31 | " Comments in alex file
32 | syn match alex_comment /--.*$/ contains=alex_todo,alex_fixme
33 | syn match alex_todo /[tT][oO][dD][oO]/ contained
34 | syn match alex_fixme /[fF][iI][xX][mM][eE]/ contained
35 |
36 | " String representing ordered set of characters for regexp matching
37 | syn region alex_string start=/"/ skip=/\\"/ end=/"/
38 |
39 | " Sets of characters
40 | syn match alex_char /\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)/
41 | syn match alex_anychar /\./
42 | syn match alex_range /\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\(-\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\)\?/
43 | syn match alex_set /$[a-zA-Z_][a-zA-Z_\d]*/
44 | syn match alex_setcompl /\~\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)/he=s+1,me=s+1
45 | syn match alex_setcompl /\~\./
46 | syn match alex_setcompl /\~\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\(-\(\\x[\da-fA-F]\+\|\\o[0-7]\+\|\\\?\d\+\|\\.\|[a-zA-Z_]\)\)\?/he=s+1,me=s+1
47 | syn match alex_setcompl /\~$[a-zA-Z_][a-zA-Z_\d]*/he=s+1,me=s+1
48 | syn match alex_setspec /[\^.$]/ contained
49 | syn region alex_sets start="\[" skip="\\]" end="]" contains=alex_char,alex_anychar,alex_range,alex_set,alex_setcompl,alex_sets,alex_setspec
50 |
51 | " Regular expressions
52 | syn match alex_regexp /@[a-zA-Z_][a-zA-Z_\d]*/
53 | syn match alex_rexpspec /[*+?]/
54 | syn match alex_repeat /{\d\+\(\,\d*\)\?}/
55 |
56 | " Keywords
57 | syn keyword alex_keywords wrapper tokens
58 |
59 | hi def link haskell_comment Comment
60 | hi def link haskell_block_comment Comment
61 | hi def link haskell_directive Special
62 | hi def link haskell_char Character
63 | hi def link haskell_string String
64 |
65 | hi def link alex_comment Comment
66 | hi def link alex_todo Todo
67 | hi def link alex_fixme Todo
68 | hi def link alex_string String
69 | hi def link alex_char Character
70 | hi def link alex_range Character
71 | hi def link alex_anychar Special
72 | hi def link alex_setcompl Special
73 | hi def link alex_setspec Special
74 | hi def link alex_rexpspec Special
75 | hi def link alex_repeat Special
76 | hi def link alex_set Identifier
77 | hi def link alex_regexp Function
78 | hi def link alex_keywords Keyword
79 |
80 | " Syntax configuration name
81 | let b:current_syntax = "alex"
82 |
--------------------------------------------------------------------------------
/vim/syntax/cabal.vim:
--------------------------------------------------------------------------------
1 | " Vim syntax file
2 | " Language: Haskell Cabal Build file
3 | " Maintainer: Vincent Berthoux
4 | " File Types: .cabal
5 | " v1.4: Add benchmark support, thanks to Simon Meier
6 | " v1.3: Updated to the last version of cabal
7 | " Added more highlighting for cabal function, true/false
8 | " and version number. Also added missing comment highlighting.
9 | " Cabal known compiler are highlighted too.
10 | "
11 | " V1.2: Added cpp-options which was missing. Feature implemented
12 | " by GHC, found with a GHC warning, but undocumented.
13 | " Whatever...
14 | "
15 | " v1.1: Fixed operator problems and added ftdetect file
16 | " (thanks to Sebastian Schwarz)
17 | "
18 | " v1.0: Cabal syntax in vimball format
19 | " (thanks to Magnus Therning)
20 |
21 | " For version 5.x: Clear all syntax items
22 | " For version 6.x: Quit when a syntax file was already loaded
23 | if version < 600
24 | syntax clear
25 | elseif exists("b:current_syntax")
26 | finish
27 | endif
28 |
29 | syn match cabalCategory "^\c\"
30 | syn match cabalCategory "^\c\"
31 | syn match cabalCategory "^\c\"
32 | syn match cabalCategory "^\c\"
33 | syn match cabalCategory "^\c\"
34 | syn match cabalCategory "^\c\"
35 | syn match cabalCategory "^\c\"
36 | syn match cabalCategory "^\c\"
37 |
38 | syn keyword cabalConditional if else elif
39 | syn match cabalOperator "&&\|||\|!"
40 | syn keyword cabalFunction os arch impl flag
41 | syn match cabalComment /--.*$/
42 | syn match cabalVersion "\(==\|>=\|<=\|<\|>\|\^>=\)\s*\d\+\(\.\(\d\)\+\)*\(\.\*\)\?"
43 |
44 | syn match cabalTruth "\c\"
45 | syn match cabalTruth "\c\"
46 |
47 | syn match cabalCompiler "\c\"
48 | syn match cabalCompiler "\c\"
49 | syn match cabalCompiler "\c\"
50 | syn match cabalCompiler "\c\"
51 | syn match cabalCompiler "\c\"
52 | syn match cabalCompiler "\c\"
53 | syn match cabalCompiler "\c\"
54 | syn match cabalCompiler "\c\"
55 | syn match cabalCompiler "\c\"
56 |
57 | syn keyword cabalOs linux osx windows
58 |
59 | " version and cabal-version are special, we match the number in them
60 | syn match cabalStatement /^\c\s*\=\s*\)\?\d\+\(\.\d\+\)/
61 | syn match cabalStatement /^\c\s*\= 508 || !exists("did_cabal_syn_inits")
400 | if version < 508
401 | let did_cabal_syn_inits = 1
402 | command -nargs=+ HiLink hi link
403 | else
404 | command -nargs=+ HiLink hi def link
405 | endif
406 |
407 | HiLink cabalVersion Number
408 | HiLink cabalTruth Boolean
409 | HiLink cabalComment Comment
410 | HiLink cabalStatement Statement
411 | HiLink cabalXStatement Keyword
412 | HiLink cabalCategory Type
413 | HiLink cabalFunction Function
414 | HiLink cabalConditional Conditional
415 | HiLink cabalOperator Operator
416 | HiLink cabalCompiler Constant
417 | HiLink cabalOs Constant
418 | HiLink cabalLanguage Constant
419 | HiLink cabalType Constant
420 | HiLink cabalExtension Constant
421 |
422 | delcommand HiLink
423 | endif
424 |
425 | let b:current_syntax = "cabal"
426 |
427 | " vim: ts=8
428 |
--------------------------------------------------------------------------------
/vim/syntax/happy.vim:
--------------------------------------------------------------------------------
1 | " Vim syntax file
2 | " Language: Happy file language
3 | " Maintainer: Nickolay Kudasov
4 | " Last Change: 18 March, 2010
5 | "
6 | " Version: 0.2
7 | " Changes: ' is now part of non-terminals
8 | " highlighting todos and fixmes in haskell comments
9 | " highlighting haskell directives
10 |
11 | if exists("b:current_syntax")
12 | finish
13 | endif
14 |
15 | " Keywords (e.g. %name) start with %, so we add it to keyword characters
16 | set iskeyword+=%
17 |
18 | " ' is allowed in non-terminals
19 | set isident+='
20 |
21 | " Haskell code in happy file
22 | syn match haskell_comment /--.*$/ contained contains=happy_todo,happy_fixme
23 | syn match haskell_char /'[^\\]'\|'\\.'/ contained
24 |
25 | syn region haskell_string start=/"/ skip=/\\"/ end=/"/ contained
26 | syn region haskell_block_comment start=/{-/ end=/-}/ fold contained contains=haskell_block_comment,happy_todo,happy_fixme
27 | syn region haskell_directive start=/{-#/ end=/#-}/ contained
28 | syn region haskell_code start=/{/ skip=/'\\\?}'/ end=/}/ fold contains=haskell_comment,haskell_block_comment,haskell_string,haskell_char,haskell_code,haskell_directive
29 |
30 | " Comments in happy file
31 | syn match happy_comment /--.*$/ contains=happy_todo,happy_fixme
32 | syn region happy_block_comment start=/{-/ end=/-}/ fold contains=happy_block_comment,happy_todo,happy_fixme
33 | syn match happy_todo /[tT][oO][dD][oO]/ contained
34 | syn match happy_fixme /[fF][iI][xX][mM][eE]/ contained
35 |
36 | " Module header directives
37 | syn keyword happy_directives %tokentype %partial
38 | syn keyword happy_directives %monad %lexer
39 | syn keyword happy_directives %expect %error
40 | syn keyword happy_directives %attributetype %attribute
41 |
42 | " %name directive
43 | syn match parser_name /[a-zA-Z_][a-zA-Z_\d]*/ contained
44 | syn region happy_names matchgroup=happy_directives start=/%name/ end=/%/me=e-1,he=e-1 contains=happy_name,parser_name,happy_comment
45 |
46 | " %token and association directives
47 | syn match token_name /[a-zA-Z_][a-zA-Z_\d]*/ contained
48 | syn region token_name start=/"/ skip=/\\"/ end=/"/ contained
49 | syn region token_name start=/'/ skip=/\\'/ end=/'/ contained
50 |
51 | syn region happy_tokens matchgroup=happy_directives start=/%token/ end=/%/me=e-1,he=e-1 contains=token_name,haskell_code,happy_comment
52 | syn region happy_assoc matchgroup=happy_directives start=/%left/ end=/%/me=e-1,he=e-1 contains=token_name,haskell_code,happy_comment
53 | syn region happy_assoc matchgroup=happy_directives start=/%right/ end=/%/me=e-1,he=e-1 contains=token_name,haskell_code,happy_comment
54 | syn region happy_assoc matchgroup=happy_directives start=/%nonassoc/ end=/%/me=e-1,he=e-1 contains=token_name,haskell_code,happy_comment
55 |
56 | syn match happy_separator /%%/
57 |
58 | " Happy grammar
59 | syn match non_terminal /[a-zA-Z_][a-zA-Z_\d\']*/
60 | syn region terminal start=/"/ skip=/\\"/ end=/"/
61 | syn region terminal start=/'/ skip=/\\'/ end=/'/
62 |
63 | hi def link haskell_comment Comment
64 | hi def link haskell_block_comment Comment
65 | hi def link haskell_directive Special
66 | hi def link haskell_char Character
67 | hi def link haskell_string String
68 |
69 | hi def link happy_comment Comment
70 | hi def link happy_block_comment Comment
71 | hi def link happy_todo Todo
72 | hi def link happy_fixme Todo
73 | hi def link parser_name Function
74 | hi def link token_name Identifier
75 | hi def link happy_directives Keyword
76 | hi def link happy_separator Special
77 | hi def link non_terminal Identifier
78 | hi def link terminal String
79 |
80 | " Syntax configuration name
81 | let b:current_syntax = "happy"
82 |
--------------------------------------------------------------------------------
/vim/syntax/haskell.vim:
--------------------------------------------------------------------------------
1 | " Vim syntax file
2 | "
3 | " Modification of vims Haskell syntax file:
4 | " - match types using regular expression
5 | " - highlight toplevel functions
6 | " - use "syntax keyword" instead of "syntax match" where appropriate
7 | " - functions and types in import and module declarations are matched
8 | " - removed hs_highlight_more_types (just not needed anymore)
9 | " - enable spell checking in comments and strings only
10 | " - FFI highlighting
11 | " - QuasiQuotation
12 | " - top level Template Haskell slices
13 | " - PackageImport
14 | "
15 | " TODO: find out which vim versions are still supported
16 | "
17 | " From Original file:
18 | " ===================
19 | "
20 | " Language: Haskell
21 | " Maintainer: Haskell Cafe mailinglist
22 | " Last Change: 2010 Feb 21
23 | " Original Author: John Williams
24 | "
25 | " Thanks to Ryan Crumley for suggestions and John Meacham for
26 | " pointing out bugs. Also thanks to Ian Lynagh and Donald Bruce Stewart
27 | " for providing the inspiration for the inclusion of the handling
28 | " of C preprocessor directives, and for pointing out a bug in the
29 | " end-of-line comment handling.
30 | "
31 | " Options-assign a value to these variables to turn the option on:
32 | "
33 | " hs_highlight_delimiters - Highlight delimiter characters--users
34 | " with a light-colored background will
35 | " probably want to turn this on.
36 | " hs_highlight_boolean - Treat True and False as keywords.
37 | " hs_highlight_types - Treat names of primitive types as keywords.
38 | " hs_highlight_debug - Highlight names of debugging functions.
39 | " hs_allow_hash_operator - Don't highlight seemingly incorrect C
40 | " preprocessor directives but assume them to be
41 | " operators
42 | "
43 | "
44 |
45 | if version < 600
46 | syn clear
47 | elseif exists("b:current_syntax")
48 | finish
49 | endif
50 |
51 | "syntax sync fromstart "mmhhhh.... is this really ok to do so?
52 | syntax sync linebreaks=15 minlines=50 maxlines=500
53 |
54 | syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"
55 | 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\)"
56 | syn match hsSpecialCharError contained "\\&\|'''\+"
57 | sy region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar,@Spell
58 | sy match hsCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError
59 | sy match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError
60 |
61 | " (Qualified) identifiers (no default highlighting)
62 | syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>"
63 | syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>"
64 |
65 | " Infix operators--most punctuation characters and any (qualified) identifier
66 | " enclosed in `backquotes`. An operator starting with : is a constructor,
67 | " others are variables (e.g. functions).
68 | syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*"
69 | syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"
70 | syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`"
71 | syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`"
72 |
73 | " Toplevel Template Haskell support
74 | "sy match hsTHTopLevel "^[a-z]\(\(.\&[^=]\)\|\(\n[^a-zA-Z0-9]\)\)*"
75 | sy match hsTHIDTopLevel "^[a-z]\S*"
76 | sy match hsTHTopLevel "^\$(\?" nextgroup=hsTHTopLevelName
77 | sy match hsTHTopLevelName "[a-z]\S*" contained
78 |
79 | " Reserved symbols--cannot be overloaded.
80 | syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|_\|{\|}"
81 |
82 | sy region hsInnerParen start="(" end=")" contained contains=hsInnerParen,hsConSym,hsType,hsVarSym
83 | sy region hs_InfixOpFunctionName start="^(" end=")\s*[^:`]\(\W\&\S\&[^'\"`()[\]{}@]\)\+"re=s
84 | \ contained keepend contains=hsInnerParen,hs_HlInfixOp
85 |
86 | sy match hs_hlFunctionName "[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained
87 | sy match hs_FunctionName "^[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained contains=hs_hlFunctionName
88 | sy match hs_HighliteInfixFunctionName "`[a-z_][^`]*`" contained
89 | sy match hs_InfixFunctionName "^\S[^=]*`[a-z_][^`]*`"me=e-1 contained contains=hs_HighliteInfixFunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
90 | sy match hs_HlInfixOp "\(\W\&\S\&[^`(){}'[\]]\)\+" contained contains=hsString
91 | sy match hs_InfixOpFunctionName "^\(\(\w\|[[\]{}]\)\+\|\(\".*\"\)\|\('.*'\)\)\s*[^:]=*\(\W\&\S\&[^='\"`()[\]{}@]\)\+"
92 | \ contained contains=hs_HlInfixOp,hsCharacter
93 |
94 | sy match hs_OpFunctionName "(\(\W\&[^(),\"]\)\+)" contained
95 | "sy region hs_Function start="^["'a-z_([{]" end="=\(\s\|\n\|\w\|[([]\)" keepend extend
96 | sy region hs_Function start="^["'a-zA-Z_([{]\(\(.\&[^=]\)\|\(\n\s\)\)*=" end="\(\s\|\n\|\w\|[([]\)"
97 | \ contains=hs_OpFunctionName,hs_InfixOpFunctionName,hs_InfixFunctionName,hs_FunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
98 |
99 | sy match hs_DeclareFunction "^[a-z_(]\S*\(\s\|\n\)*::" contains=hs_FunctionName,hs_OpFunctionName
100 |
101 | " hi hs_InfixOpFunctionName guibg=bg
102 | " hi hs_Function guibg=green
103 | " hi hs_InfixFunctionName guibg=red
104 | " hi hs_DeclareFunction guibg=red
105 |
106 | sy keyword hsStructure data family class where instance default deriving
107 | sy keyword hsTypedef type newtype
108 |
109 | sy keyword hsInfix infix infixl infixr
110 | sy keyword hsStatement do case of let in
111 | sy keyword hsConditional if then else
112 |
113 | "if exists("hs_highlight_types")
114 | " Primitive types from the standard prelude and libraries.
115 | sy match hsType "\<[A-Z]\(\S\&[^,.]\)*\>"
116 | sy match hsType "()"
117 | "endif
118 |
119 | " Not real keywords, but close.
120 | if exists("hs_highlight_boolean")
121 | " Boolean constants from the standard prelude.
122 | syn keyword hsBoolean True False
123 | endif
124 |
125 | syn region hsPackageString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
126 | sy match hsModuleName excludenl "\([A-Z]\w*\.\?\)*" contained
127 |
128 | sy match hsImport "\\s\+\(qualified\s\+\)\?\(\<\(\w\|\.\)*\>\)"
129 | \ contains=hsModuleName,hsImportLabel
130 | \ nextgroup=hsImportParams,hsImportIllegal skipwhite
131 | sy keyword hsImportLabel import qualified contained
132 |
133 | sy match hsImportIllegal "\w\+" contained
134 |
135 | sy keyword hsAsLabel as contained
136 | sy keyword hsHidingLabel hiding contained
137 |
138 | sy match hsImportParams "as\s\+\(\w\+\)" contained
139 | \ contains=hsModuleName,hsAsLabel
140 | \ nextgroup=hsImportParams,hsImportIllegal skipwhite
141 | sy match hsImportParams "hiding" contained
142 | \ contains=hsHidingLabel
143 | \ nextgroup=hsImportParams,hsImportIllegal skipwhite
144 | sy match hsImportParams "\(\w\*\)" contained
145 | \ contains=hsBlockComment,hsLineComment,hsType,hsDelimTypeExport,hs_hlFunctionName,hs_OpFunctionName
146 | \ nextgroup=hsImportIllegal skipwhite
147 |
148 | "hi hsImport guibg=red
149 | "hi hsImportParams guibg=bg
150 | "hi hsImportIllegal guibg=bg
151 | "hi hsModuleName guibg=bg
152 |
153 | "sy match hsImport "\\(.\|[^(]\)*\((.*)\)\?"
154 | " \ contains=hsPackageString,hsImportLabel,hsImportMod,hsModuleName,hsImportList
155 | "sy keyword hsImportLabel import contained
156 | "sy keyword hsImportMod as qualified hiding contained
157 | "sy region hsImportListInner start="(" end=")" contained keepend extend contains=hs_OpFunctionName
158 | "sy region hsImportList matchgroup=hsImportListParens start="("rs=s+1 end=")"re=e-1
159 | " \ contained
160 | " \ keepend extend
161 | " \ contains=hsType,hsLineComment,hsBlockComment,hs_hlFunctionName,hsImportListInner
162 |
163 |
164 |
165 | " new module highlighting
166 | syn region hsDelimTypeExport start="\<[A-Z]\(\S\&[^,.]\)*\>(" end=")" contained
167 | \ contains=hsType
168 |
169 | sy keyword hsExportModuleLabel module contained
170 | sy match hsExportModule "\\(\s\|\t\|\n\)*\([A-Z]\w*\.\?\)*" contained contains=hsExportModuleLabel,hsModuleName
171 |
172 | sy keyword hsModuleStartLabel module contained
173 | sy keyword hsModuleWhereLabel where contained
174 |
175 | syn match hsModuleStart "^module\(\s\|\n\)*\(\<\(\w\|\.\)*\>\)\(\s\|\n\)*"
176 | \ contains=hsModuleStartLabel,hsModuleName
177 | \ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel
178 |
179 | syn region hsModuleCommentA start="{-" end="-}"
180 | \ contains=hsModuleCommentA,hsCommentTodo,@Spell contained
181 | \ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel skipwhite skipnl
182 |
183 | syn match hsModuleCommentA "--.*\n"
184 | \ contains=hsCommentTodo,@Spell contained
185 | \ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel skipwhite skipnl
186 |
187 | syn match hsModuleExports "\(\w\*\)" contained
188 | \ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
189 | \ contains=hsBlockComment,hsLineComment,hsType,hsDelimTypeExport,hs_hlFunctionName,hs_OpFunctionName,hsExportModule
190 |
191 | syn match hsModuleCommentB "--.*\n"
192 | \ contains=hsCommentTodo,@Spell contained
193 | \ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
194 |
195 | syn region hsModuleCommentB start="{-" end="-}"
196 | \ contains=hsModuleCommentB,hsCommentTodo,@Spell contained
197 | \ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
198 | " end module highlighting
199 |
200 | " FFI support
201 | sy keyword hsFFIForeign foreign contained
202 | "sy keyword hsFFIImportExport import export contained
203 | sy keyword hsFFIImportExport export contained
204 | sy keyword hsFFICallConvention ccall stdcall contained
205 | sy keyword hsFFISafety safe unsafe contained
206 | sy region hsFFIString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=hsSpecialChar
207 | sy match hsFFI excludenl "\\(.\&[^\"]\)*\"\(.\)*\"\(\s\|\n\)*\(.\)*::"
208 | \ keepend
209 | \ contains=hsFFIForeign,hsFFIImportExport,hsFFICallConvention,hsFFISafety,hsFFIString,hs_OpFunctionName,hs_hlFunctionName
210 |
211 |
212 | sy match hsNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
213 | sy match hsFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
214 |
215 | " Comments
216 | sy keyword hsCommentTodo TODO FIXME XXX TBD contained
217 | sy match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=hsCommentTodo,@Spell
218 | sy region hsBlockComment start="{-" end="-}" contains=hsBlockComment,hsCommentTodo,@Spell
219 | sy region hsPragma start="{-#" end="#-}"
220 |
221 | " QuasiQuotation
222 | sy region hsQQ start="\[\$" end="|\]"me=e-2 keepend contains=hsQQVarID,hsQQContent nextgroup=hsQQEnd
223 | sy region hsQQNew start="\[\(.\&[^|]\&\S\)*|" end="|\]"me=e-2 keepend contains=hsQQVarIDNew,hsQQContent nextgroup=hsQQEnd
224 | sy match hsQQContent ".*" contained
225 | sy match hsQQEnd "|\]" contained
226 | sy match hsQQVarID "\[\$\(.\&[^|]\)*|" contained
227 | sy match hsQQVarIDNew "\[\(.\&[^|]\)*|" contained
228 |
229 | if exists("hs_highlight_debug")
230 | " Debugging functions from the standard prelude.
231 | syn keyword hsDebug undefined error trace
232 | endif
233 |
234 |
235 | " C Preprocessor directives. Shamelessly ripped from c.vim and trimmed
236 | " First, see whether to flag directive-like lines or not
237 | if (!exists("hs_allow_hash_operator"))
238 | syn match cError display "^\s*\(%:\|#\).*$"
239 | endif
240 | " Accept %: for # (C99)
241 | syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCommentError
242 | syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
243 | syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
244 | syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cCppSkip
245 | syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cCppSkip
246 | syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
247 | syn match cIncluded display contained "<[^>]*>"
248 | syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
249 | syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cCppOut,cCppOut2,cCppSkip,cCommentStartError
250 | syn region cDefine matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$"
251 | syn region cPreProc matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend
252 |
253 | syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=cCommentStartError,cSpaceError contained
254 | syntax match cCommentError display "\*/" contained
255 | syntax match cCommentStartError display "/\*"me=e-1 contained
256 | syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
257 |
258 |
259 | if version >= 508 || !exists("did_hs_syntax_inits")
260 | if version < 508
261 | let did_hs_syntax_inits = 1
262 | command -nargs=+ HiLink hi link
263 | else
264 | command -nargs=+ HiLink hi def link
265 | endif
266 |
267 | HiLink hs_hlFunctionName Function
268 | HiLink hs_HighliteInfixFunctionName Function
269 | HiLink hs_HlInfixOp Function
270 | HiLink hs_OpFunctionName Function
271 | HiLink hsTypedef Typedef
272 | HiLink hsVarSym hsOperator
273 | HiLink hsConSym hsOperator
274 | if exists("hs_highlight_delimiters")
275 | " Some people find this highlighting distracting.
276 | HiLink hsDelimiter Delimiter
277 | endif
278 |
279 | HiLink hsModuleStartLabel Structure
280 | HiLink hsExportModuleLabel Keyword
281 | HiLink hsModuleWhereLabel Structure
282 | HiLink hsModuleName Normal
283 |
284 | HiLink hsImportIllegal Error
285 | HiLink hsAsLabel hsImportLabel
286 | HiLink hsHidingLabel hsImportLabel
287 | HiLink hsImportLabel Include
288 | HiLink hsImportMod Include
289 | HiLink hsPackageString hsString
290 |
291 | HiLink hsOperator Operator
292 |
293 | HiLink hsInfix Keyword
294 | HiLink hsStructure Structure
295 | HiLink hsStatement Statement
296 | HiLink hsConditional Conditional
297 |
298 | HiLink hsSpecialCharError Error
299 | HiLink hsSpecialChar SpecialChar
300 | HiLink hsString String
301 | HiLink hsFFIString String
302 | HiLink hsCharacter Character
303 | HiLink hsNumber Number
304 | HiLink hsFloat Float
305 |
306 | HiLink hsLiterateComment hsComment
307 | HiLink hsBlockComment hsComment
308 | HiLink hsLineComment hsComment
309 | HiLink hsModuleCommentA hsComment
310 | HiLink hsModuleCommentB hsComment
311 | HiLink hsComment Comment
312 | HiLink hsCommentTodo Todo
313 | HiLink hsPragma SpecialComment
314 | HiLink hsBoolean Boolean
315 |
316 | if exists("hs_highlight_types")
317 | HiLink hsDelimTypeExport hsType
318 | HiLink hsType Type
319 | endif
320 |
321 | HiLink hsDebug Debug
322 |
323 | HiLink cCppString hsString
324 | HiLink cCommentStart hsComment
325 | HiLink cCommentError hsError
326 | HiLink cCommentStartError hsError
327 | HiLink cInclude Include
328 | HiLink cPreProc PreProc
329 | HiLink cDefine Macro
330 | HiLink cIncluded hsString
331 | HiLink cError Error
332 | HiLink cPreCondit PreCondit
333 | HiLink cComment Comment
334 | HiLink cCppSkip cCppOut
335 | HiLink cCppOut2 cCppOut
336 | HiLink cCppOut Comment
337 |
338 | HiLink hsFFIForeign Keyword
339 | HiLink hsFFIImportExport Structure
340 | HiLink hsFFICallConvention Keyword
341 | HiLink hsFFISafety Keyword
342 |
343 | HiLink hsTHIDTopLevel Macro
344 | HiLink hsTHTopLevelName Macro
345 |
346 | HiLink hsQQVarID Keyword
347 | HiLink hsQQVarIDNew Keyword
348 | HiLink hsQQEnd Keyword
349 | HiLink hsQQContent String
350 |
351 | delcommand HiLink
352 | endif
353 |
354 | let b:current_syntax = "haskell"
355 |
--------------------------------------------------------------------------------
/vimrc:
--------------------------------------------------------------------------------
1 | " https://github.com/sdiehl/haskell-vim-proto
2 | " Each of the sections can be copied into your existing config independent of
3 | " the other ones.
4 |
5 | " == basic ==
6 |
7 | syntax on
8 | filetype plugin indent on
9 |
10 | set nocompatible
11 | set number
12 | set nowrap
13 | set showmode
14 | set tw=80
15 | set smartcase
16 | set smarttab
17 | set smartindent
18 | set autoindent
19 | set softtabstop=2
20 | set shiftwidth=2
21 | set expandtab
22 | set incsearch
23 | set mouse=a
24 | set history=1000
25 | set clipboard=unnamedplus,autoselect
26 |
27 | set completeopt=menuone,menu,longest
28 |
29 | set wildignore+=*\\tmp\\*,*.swp,*.swo,*.zip,.git,.cabal-sandbox
30 | set wildmode=longest,list,full
31 | set wildmenu
32 | set completeopt+=longest
33 |
34 | set t_Co=256
35 |
36 | set cmdheight=1
37 |
38 | execute pathogen#infect()
39 |
40 | " == syntastic ==
41 |
42 | map s :SyntasticToggleMode
43 |
44 | set statusline+=%#warningmsg#
45 | set statusline+=%{SyntasticStatuslineFlag()}
46 | set statusline+=%*
47 |
48 | let g:syntastic_always_populate_loc_list = 1
49 | let g:syntastic_auto_loc_list = 0
50 | let g:syntastic_check_on_open = 0
51 | let g:syntastic_check_on_wq = 0
52 |
53 | " == ghc-mod ==
54 |
55 | map tw :GhcModTypeInsert
56 | map ts :GhcModSplitFunCase
57 | map tq :GhcModType
58 | map te :GhcModTypeClear
59 |
60 | " == supertab ==
61 |
62 | let g:SuperTabDefaultCompletionType = ''
63 |
64 | if has("gui_running")
65 | imap =SuperTabAlternateCompletion("\c-x>\c-o>")
66 | else " no gui
67 | if has("unix")
68 | inoremap =SuperTabAlternateCompletion("\c-x>\c-o>")
69 | endif
70 | endif
71 |
72 | " == neco-ghc ==
73 |
74 | let g:haskellmode_completion_ghc = 1
75 | autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
76 |
77 | " == nerd-tree ==
78 |
79 | map n :NERDTreeToggle
80 |
81 | " == tabular ==
82 |
83 | let g:haskell_tabular = 1
84 |
85 | vmap a= :Tabularize /=
86 | vmap a; :Tabularize /::
87 | vmap a- :Tabularize /->
88 | vmap a, :Tabularize /<-
89 | vmap al :Tabularize /[\[\\|,]
90 |
91 | " == ctrl-p ==
92 |
93 | map t :CtrlP()
94 | noremap b :CtrlPBuffer
95 | let g:ctrlp_custom_ignore = '\v[\/]dist$'
96 |
--------------------------------------------------------------------------------