Skip to content

Commit

Permalink
Syntax: Add elm module group
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Bryan Enders committed Feb 25, 2019
1 parent d22c0ba commit 1113904
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion syntax/elm.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 "\([-!#$%`&\*\+./<=>\?@\\^|~:]\|\<_\>\)"
Expand All @@ -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 "[()[\]{}]"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 1113904

Please sign in to comment.