Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
`haskell-vim` has an opinionated highlighting. If you do not like that you can switch to
a more traditional mode by setting `g:haskell_classic_highlighting` to `1`.

Disabling Template Haskell and Quasiquoting syntax is possible by setting
`g:haskell_disable_TH` to `1`.

### Indentation

To configure indentation in `haskell-vim` you can use the following variables to change indentation depth, just add the according line to your `.vimrc`.
Expand Down
5 changes: 5 additions & 0 deletions doc/haskell-vim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ the according variable to 1 in the `.vimrc`.
* |haskell-vim-enable-typeroles|
* |haskell-vim-enable-static-pointers|
* |haskell-vim-classic-highlighting|
* |haskell-vim-disable-TH|

*haskell-vim-enable-quantification*
`g:haskell_enable_quantification` Enables highlighting of `forall`.
Expand All @@ -65,6 +66,10 @@ the according variable to 1 in the `.vimrc`.
switch to a more traditional mode by setting `g:haskell_classic_highlighting`
to 1.

*haskell-vim-disable-TH*
Disabling Template Haskell and Quasiquoting syntax is possible by setting
`g:haskell_disable_TH` to `1`.

===============================================================================
INDENTATION *haskell-vim-indentation*

Expand Down
14 changes: 10 additions & 4 deletions syntax/haskell.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ elseif exists("b:current_syntax")
finish
endif

if !exists('g:haskell_disable_TH')
let g:haskell_disable_TH = 0
endif

syn spell notoplevel
syn match haskellRecordField contained containedin=haskellBlock
\ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)"
Expand Down Expand Up @@ -92,14 +96,16 @@ syn region haskellBlockComment start="{-" end="-}"
\ haskellTodo,
\ @Spell
syn region haskellPragma start="{-#" end="#-}"
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
syn match haskellPreProc "^#.*$"
syn keyword haskellTodo TODO FIXME contained
" Treat a shebang line at the start of the file as a comment
syn match haskellShebang "\%^#!.*$"
if exists('g:haskell_disable_TH') && g:haskell_disable_TH == 0
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
endif
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
syn keyword haskellTypeRoles phantom representational nominal contained
syn region haskellTypeRoleBlock matchgroup=haskellTypeRoles start="type\s\+role" end="$" keepend
Expand Down