neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

gleam.vim (2808B)


      1 " Vim syntax file
      2 " Language:    Gleam
      3 " Maintainer:  Kirill Morozov <kirill@robotix.pro>
      4 " Based On:    https://github.com/gleam-lang/gleam.vim
      5 " Last Change: 2025 Apr 20
      6 " 2025 May 15 Add @Spell clusters #17324
      7 
      8 if exists("b:current_syntax")
      9  finish
     10 endif
     11 let b:current_syntax = "gleam"
     12 
     13 syntax case match
     14 
     15 " Keywords
     16 syntax keyword gleamConditional case if
     17 syntax keyword gleamConstant const
     18 syntax keyword gleamDebug echo
     19 syntax keyword gleamException panic assert todo
     20 syntax keyword gleamInclude import
     21 syntax keyword gleamKeyword as let use
     22 syntax keyword gleamStorageClass pub opaque
     23 syntax keyword gleamType type
     24 
     25 " Number
     26 "" Int
     27 syntax match gleamNumber "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)\>"
     28 
     29 "" Binary
     30 syntax match gleamNumber "\<-\=0[bB]_\?\%([01]\|[01]_[01]\)\+\>"
     31 
     32 "" Octet
     33 syntax match gleamNumber "\<-\=0[oO]\?_\?\%(\o\|\o_\o\)\+\>"
     34 
     35 "" Hexadecimal
     36 syntax match gleamNumber "\<-\=0[xX]_\?\%(\x\|\x_\x\)\+\>"
     37 
     38 "" Float
     39 syntax match gleamFloat "\(0*[1-9][0-9_]*\|0\)\.\(0*[1-9][0-9_]*\|0\)\(e-\=0*[1-9][0-9_]*\)\="
     40 
     41 " String
     42 syntax region gleamString start=/"/ end=/"/ contains=gleamSpecial,@Spell
     43 syntax match gleamSpecial '\\.' contained
     44 
     45 " Operators
     46 "" Basic
     47 syntax match gleamOperator "[-+/*]\.\=\|[%=]"
     48 
     49 "" Arrows + Pipeline
     50 syntax match gleamOperator "<-\|[-|]>"
     51 
     52 "" Bool
     53 syntax match gleamOperator "&&\|||"
     54 
     55 "" Comparison
     56 syntax match gleamOperator "[<>]=\=\.\=\|[=!]="
     57 
     58 "" Misc
     59 syntax match gleamOperator "\.\.\|<>\||"
     60 
     61 " Type
     62 syntax match gleamIdentifier "\<[A-Z][a-zA-Z0-9]*\>" contains=@NoSpell
     63 
     64 " Attribute
     65 syntax match gleamPreProc "@[a-z][a-z_]*" contains=@NoSpell
     66 
     67 " Function definition
     68 syntax keyword gleamKeyword fn nextgroup=gleamFunction skipwhite skipempty
     69 syntax match gleamFunction "[a-z][a-z0-9_]*\ze\s*(" skipwhite skipnl contains=@NoSpell
     70 
     71 " Comments
     72 syntax region gleamComment start="//" end="$" contains=gleamTodo,@Spell
     73 syntax region gleamSpecialComment start="///" end="$" contains=@Spell
     74 syntax region gleamSpecialComment start="////" end="$" contains=@Spell
     75 syntax keyword gleamTodo contained TODO FIXME XXX NB NOTE
     76 
     77 " Highlight groups
     78 highlight link gleamComment Comment
     79 highlight link gleamConditional Conditional
     80 highlight link gleamConstant Constant
     81 highlight link gleamDebug Debug
     82 highlight link gleamException Exception
     83 highlight link gleamFloat Float
     84 highlight link gleamFunction Function
     85 highlight link gleamIdentifier Identifier
     86 highlight link gleamInclude Include
     87 highlight link gleamKeyword Keyword
     88 highlight link gleamNumber Number
     89 highlight link gleamOperator Operator
     90 highlight link gleamPreProc PreProc
     91 highlight link gleamSpecial Special
     92 highlight link gleamSpecialComment SpecialComment
     93 highlight link gleamStorageClass StorageClass
     94 highlight link gleamString String
     95 highlight link gleamTodo Todo
     96 highlight link gleamType Type
     97 
     98 " vim: sw=2 sts=2 et