summaryrefslogtreecommitdiffstats
path: root/syntax/gleam.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2021-01-01 17:09:30 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2021-01-01 17:09:30 +0100
commita81756029291d6e21295687515a3e58499c19b33 (patch)
tree81142fd6640ad9de3b38b7cb0e4bd798a6db86e0 /syntax/gleam.vim
parent1f4236df3aaaec797e81572fd120a9d49d4035b9 (diff)
downloadvim-polyglot-a81756029291d6e21295687515a3e58499c19b33.tar.gz
vim-polyglot-a81756029291d6e21295687515a3e58499c19b33.zip
Add support for gleam, closes #655
Co-authored-by: Jeff Kreeftmeijer <jeffkreeftmeijer@gmail.com>
Diffstat (limited to 'syntax/gleam.vim')
-rw-r--r--syntax/gleam.vim58
1 files changed, 58 insertions, 0 deletions
diff --git a/syntax/gleam.vim b/syntax/gleam.vim
new file mode 100644
index 00000000..cc667893
--- /dev/null
+++ b/syntax/gleam.vim
@@ -0,0 +1,58 @@
+if has_key(g:polyglot_is_disabled, 'gleam')
+ finish
+endif
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+let b:current_syntax = "gleam"
+
+" Keywords
+syntax keyword gleamKeyword
+ \ module import pub external
+ \ type let as if else todo const
+ \ case assert tuple try opaque
+highlight link gleamKeyword Keyword
+
+" Function definition
+syntax keyword gleamDef fn nextgroup=gleamFunctionDef skipwhite skipempty
+highlight link gleamDef Keyword
+
+syntax match gleamFunctionDef "[a-z_-][0-9a-z_-]*" contained skipwhite skipnl
+highlight link gleamFunctionDef Function
+
+" Int
+syntax match gleamInt '\<[0-9][0-9_]*\>'
+highlight link gleamInt Number
+
+" Float
+syntax match gleamFloat '\<[0-9][0-9_]*\.[0-9_]*\>'
+highlight link gleamFloat Float
+
+" Operators
+syntax match gleamOperator "\([-!#$%`&\*\+./<=>@\\^|~:]\|\<\>\)"
+highlight link gleamOperator Operator
+
+" Type
+syntax match gleamType "\([a-z]\)\@<![A-Z]\w*"
+highlight link gleamType Identifier
+
+" Comments
+syntax region gleamCommentLine start="//" end="$" contains=gleamTodo
+highlight link gleamCommentLine Comment
+
+syntax keyword gleamTodo contained TODO FIXME XXX NB NOTE
+highlight def link gleamTodo Todo
+
+" String
+syntax region gleamString start=/"/ end=/"/ contains=gleamStringModifier
+syntax match gleamStringModifier '\\.' contained
+highlight link gleamString String
+highlight link gleamStringModifier Special
+
+" Attribute
+syntax match gleamAttribute "#[a-z][a-z_]*"
+highlight link gleamAttribute PreProc