summaryrefslogtreecommitdiffstats
path: root/syntax/elm.vim
diff options
context:
space:
mode:
authorDan Reif <35710107+CH-DanReif@users.noreply.github.com>2018-06-05 14:18:09 -0700
committerGitHub <noreply@github.com>2018-06-05 14:18:09 -0700
commitd362dca9b3373c2ddc8526eaa80b02bfaa274c7d (patch)
tree3016d45f4f2714937790a989be8adda3fe942ae3 /syntax/elm.vim
parenta26134de3c09f9725667e14e7073a701bcff4e19 (diff)
parent1f34e0adcfb54b45760d7570d4c270a939daa03b (diff)
downloadvim-polyglot-d362dca9b3373c2ddc8526eaa80b02bfaa274c7d.tar.gz
vim-polyglot-d362dca9b3373c2ddc8526eaa80b02bfaa274c7d.zip
Merge pull request #315 from sheerun/periodic_rebuild_20180605
Update (periodic rebuild)
Diffstat (limited to '')
-rw-r--r--syntax/elm.vim18
1 files changed, 14 insertions, 4 deletions
diff --git a/syntax/elm.vim b/syntax/elm.vim
index fb3874c0..a26fb0f6 100644
--- a/syntax/elm.vim
+++ b/syntax/elm.vim
@@ -7,13 +7,13 @@ if exists('b:current_syntax')
endif
" Keywords
-syn keyword elmConditional case else if of then
+syn keyword elmConditional else if of then
syn keyword elmAlias alias
-syn keyword elmTypedef type port let in
+syn keyword elmTypedef contained type port
syn keyword elmImport exposing as import module where
" Operators
-syn match elmOperator "\([-!#$%`&\*\+./<=>\?@\\^|~:]\|\<_\>\)"
+syn match elmOperator contained "\([-!#$%`&\*\+./<=>\?@\\^|~:]\|\<_\>\)"
" Types
syn match elmType "\<[A-Z][0-9A-Za-z_'-]*"
@@ -29,7 +29,7 @@ syn match elmTupleFunction "\((,\+)\)"
" Comments
syn keyword elmTodo TODO FIXME XXX contained
syn match elmLineComment "--.*" contains=elmTodo,@spell
-syn region elmComment matchgroup=elmComment start="{-|\=" end="-}" contains=elmTodo,elmComment,@spell
+syn region elmComment matchgroup=elmComment start="{-|\=" end="-}" contains=elmTodo,elmComment,@spell fold
" Strings
syn match elmStringEscape "\\u[0-9a-fA-F]\{4}" contained
@@ -45,6 +45,16 @@ syn match elmFloat "\(\<\d\+\.\d\+\>\)"
" Identifiers
syn match elmTopLevelDecl "^\s*[a-zA-Z][a-zA-z0-9_]*\('\)*\s\+:\s\+" contains=elmOperator
+" Folding
+syn region elmTopLevelTypedef start="type" end="\n\(\n\n\)\@=" contains=ALL fold
+syn region elmTopLevelFunction start="^[a-zA-Z].\+\n[a-zA-Z].\+=" end="^\(\n\+\)\@=" contains=ALL fold
+syn region elmCaseBlock matchgroup=elmCaseBlockDefinition start="^\z\(\s\+\)\<case\>" end="^\z1\@!\W\@=" end="\(\n\n\z1\@!\)\@=" end="\n\z1\@!\(\n\n\)\@=" contains=ALL fold
+syn region elmCaseItemBlock start="^\z\(\s\+\).\+->$" end="^\z1\@!\W\@=" end="\(\n\n\z1\@!\)\@=" end="\(\n\z1\S\)\@=" contains=ALL fold
+syn region elmLetBlock matchgroup=elmLetBlockDefinition start="\<let\>" end="\<in\>" contains=ALL fold
+
+hi def link elmCaseBlockDefinition Conditional
+hi def link elmCaseBlockItemDefinition Conditional
+hi def link elmLetBlockDefinition TypeDef
hi def link elmTopLevelDecl Function
hi def link elmTupleFunction Normal
hi def link elmTodo Todo