From 1113904a6f48ba5eb78669929afb1e6ad9242500 Mon Sep 17 00:00:00 2001 From: Bryan Enders Date: Mon, 25 Feb 2019 06:44:48 -0500 Subject: [PATCH] Syntax: Add elm module group Why --- I want to be able to differentiate Elm modules from Elm types How --- * Create `elmModule` highlight group * Link `elmModule` to `Type`, the group conventionally used for modules --- syntax/elm.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/syntax/elm.vim b/syntax/elm.vim index be23595..270a803 100644 --- a/syntax/elm.vim +++ b/syntax/elm.vim @@ -8,7 +8,7 @@ endif syn keyword elmConditional else if of then syn keyword elmAlias alias syn keyword elmTypedef contained type port -syn keyword elmImport exposing as import module where +syn keyword elmImport contained exposing as import module where " Operators syn match elmOperator contained "\([-!#$%`&\*\+./<=>\?@\\^|~:]\|\<_\>\)" @@ -17,6 +17,10 @@ syn match elmOperator contained "\([-!#$%`&\*\+./<=>\?@\\^|~:]\|\<_\>\)" syn match elmType "\<[A-Z][0-9A-Za-z_'-]*" syn keyword elmNumberType number +" Modules +syn match elmModule "\<[A-Z][0-9A-Za-z_'-]*\."me=e-1 +syn match elmModule "^\(module\|import\)\s\+[A-Z][0-9A-Za-z_'-\.]*\(\s\+as\s\+[A-Z][0-9A-Za-z_'-\.]*\)\?\(\s\+exposing\)\?" contains=elmImport + " Delimiters syn match elmDelimiter "[,;]" syn match elmBraces "[()[\]{}]" @@ -73,6 +77,7 @@ hi def link elmAlias Delimiter hi def link elmOperator Operator hi def link elmType Identifier hi def link elmNumberType Identifier +hi def link elmModule Type syn sync minlines=500