From ac0ba180fd376d4da205cef1aa43bca42fe0f022 Mon Sep 17 00:00:00 2001 From: Dag Odenhall Date: Sat, 19 May 2012 03:01:51 +0200 Subject: [PATCH] g:haskell_conceal_comments --- autoload/vim2hs/haskell/syntax.vim | 19 ++++++++++++---- syntax/haskell.vim | 36 ++++++++++++++++-------------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/autoload/vim2hs/haskell/syntax.vim b/autoload/vim2hs/haskell/syntax.vim index 7362834..076e02b 100644 --- a/autoload/vim2hs/haskell/syntax.vim +++ b/autoload/vim2hs/haskell/syntax.vim @@ -132,16 +132,27 @@ function! vim2hs#haskell#syntax#strings() " {{{ endfunction " }}} -function! vim2hs#haskell#syntax#comments() " {{{ +function! vim2hs#haskell#syntax#comments(conceal) " {{{ syntax case match syntax keyword hsTodo \ TODO FIXME XXX \ contained - syntax match hsComment - \ /--.*/ - \ contains=hsTodo + if a:conceal + syntax match hsComment + \ /--.*/ + \ contains=hsTodo + \ conceal cchar=ℹ + + syntax match hsComment + \ /^\s*--.*/ + \ contains=hsTodo + else + syntax match hsComment + \ /--.*/ + \ contains=hsTodo + endif syntax region hsBlockComment \ start="{-" end="-}" diff --git a/syntax/haskell.vim b/syntax/haskell.vim index 0435578..82e0f66 100644 --- a/syntax/haskell.vim +++ b/syntax/haskell.vim @@ -1,22 +1,23 @@ syntax clear -call vim2hs#letdefault('g:haskell_haddock' , 0) -call vim2hs#letdefault('g:haskell_ffi' , 1) -call vim2hs#letdefault('g:haskell_cpp' , 1) -call vim2hs#letdefault('g:haskell_th' , 1) -call vim2hs#letdefault('g:haskell_quasi' , 1) -call vim2hs#letdefault('g:haskell_interpolation' , 1) -call vim2hs#letdefault('g:haskell_regex' , 1) -call vim2hs#letdefault('g:haskell_jmacro' , 1) -call vim2hs#letdefault('g:haskell_shqq' , 1) -call vim2hs#letdefault('g:haskell_sql' , 1) -call vim2hs#letdefault('g:haskell_json' , 1) -call vim2hs#letdefault('g:haskell_xml' , 1) -call vim2hs#letdefault('g:haskell_hsp' , 1) -call vim2hs#letdefault('g:haskell_conceal' , 1) -call vim2hs#letdefault('g:haskell_conceal_wide' , 0) -call vim2hs#letdefault('g:haskell_conceal_bad' , 0) +call vim2hs#letdefault('g:haskell_haddock' , 0) +call vim2hs#letdefault('g:haskell_ffi' , 1) +call vim2hs#letdefault('g:haskell_cpp' , 1) +call vim2hs#letdefault('g:haskell_th' , 1) +call vim2hs#letdefault('g:haskell_quasi' , 1) +call vim2hs#letdefault('g:haskell_interpolation' , 1) +call vim2hs#letdefault('g:haskell_regex' , 1) +call vim2hs#letdefault('g:haskell_jmacro' , 1) +call vim2hs#letdefault('g:haskell_shqq' , 1) +call vim2hs#letdefault('g:haskell_sql' , 1) +call vim2hs#letdefault('g:haskell_json' , 1) +call vim2hs#letdefault('g:haskell_xml' , 1) +call vim2hs#letdefault('g:haskell_hsp' , 1) +call vim2hs#letdefault('g:haskell_conceal' , 1) +call vim2hs#letdefault('g:haskell_conceal_comments' , 0) +call vim2hs#letdefault('g:haskell_conceal_wide' , 0) +call vim2hs#letdefault('g:haskell_conceal_bad' , 0) call vim2hs#haskell#syntax#operators() @@ -87,7 +88,8 @@ call vim2hs#haskell#syntax#keywords(1) call vim2hs#haskell#syntax#types() call vim2hs#haskell#syntax#folds() call vim2hs#haskell#syntax#strings() -call vim2hs#haskell#syntax#comments() +call vim2hs#haskell#syntax#comments(g:haskell_conceal + \ && g:haskell_conceal_comments) if g:haskell_haddock call vim2hs#haskell#syntax#haddock()