Skip to content

Commit e6f3093

Browse files
authored
Merge pull request #87 from alx741/disable_TH
add haskell_disable_TH configuration variable for Template Haskell disabling
2 parents cf2f339 + 0ee95b3 commit e6f3093

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
5757
`haskell-vim` has an opinionated highlighting. If you do not like that you can switch to
5858
a more traditional mode by setting `g:haskell_classic_highlighting` to `1`.
5959

60+
Disabling Template Haskell and Quasiquoting syntax is possible by setting
61+
`g:haskell_disable_TH` to `1`.
62+
6063
### Indentation
6164

6265
To configure indentation in `haskell-vim` you can use the following variables to change indentation depth, just add the according line to your `.vimrc`.

doc/haskell-vim.txt

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ the according variable to 1 in the `.vimrc`.
3939
* |haskell-vim-enable-typeroles|
4040
* |haskell-vim-enable-static-pointers|
4141
* |haskell-vim-classic-highlighting|
42+
* |haskell-vim-disable-TH|
4243

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

69+
*haskell-vim-disable-TH*
70+
Disabling Template Haskell and Quasiquoting syntax is possible by setting
71+
`g:haskell_disable_TH` to `1`.
72+
6873
===============================================================================
6974
INDENTATION *haskell-vim-indentation*
7075

syntax/haskell.vim

+10-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ elseif exists("b:current_syntax")
1111
finish
1212
endif
1313

14+
if !exists('g:haskell_disable_TH')
15+
let g:haskell_disable_TH = 0
16+
endif
17+
1418
syn spell notoplevel
1519
syn match haskellRecordField contained containedin=haskellBlock
1620
\ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)"
@@ -92,14 +96,16 @@ syn region haskellBlockComment start="{-" end="-}"
9296
\ haskellTodo,
9397
\ @Spell
9498
syn region haskellPragma start="{-#" end="#-}"
95-
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
96-
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
97-
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
98-
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
9999
syn match haskellPreProc "^#.*$"
100100
syn keyword haskellTodo TODO FIXME contained
101101
" Treat a shebang line at the start of the file as a comment
102102
syn match haskellShebang "\%^#!.*$"
103+
if exists('g:haskell_disable_TH') && g:haskell_disable_TH == 0
104+
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
105+
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
106+
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
107+
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
108+
endif
103109
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
104110
syn keyword haskellTypeRoles phantom representational nominal contained
105111
syn region haskellTypeRoleBlock matchgroup=haskellTypeRoles start="type\s\+role" end="$" keepend

0 commit comments

Comments
 (0)