vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

glimmer.vim (1455B)


      1 " Vim syntax file
      2 " Language:     Glimmer
      3 " Maintainer:   Devin Weaver
      4 " Last Change:  2026 Feb 20
      5 " Origin:       https://github.com/joukevandermaas/vim-ember-hbs
      6 " Credits:      Jouke van der Maas
      7 " License:      Same as Vim
      8 
      9 " Vim detects GJS/GTS files as {java,type}script.glimmer
     10 " Vim will read the javascript/typescript syntax files first and set
     11 " b:current_syntax accordingly then it will read the glimmer syntax file.
     12 " This is why we use b:current_syntax to make sure we are in the correct state
     13 " to continue.
     14 
     15 if exists('b:current_syntax') && b:current_syntax !~# '\v%(type|java)script'
     16   finish
     17 endif
     18 
     19 let base_syntax = b:current_syntax
     20 unlet! b:current_syntax
     21 
     22 let s:cpo_save = &cpo
     23 set cpo&vim
     24 
     25 syntax include @hbs syntax/handlebars.vim
     26 
     27 if base_syntax == "javascript"
     28   syntax region glimmerTemplateBlock
     29     \ start="<template>" end="</template>"
     30     \ contains=@hbs
     31     \ keepend fold
     32 
     33   let b:current_syntax = "javascript.glimmer"
     34 else
     35   " syntax/typescript.vim adds typescriptTypeCast which is in conflict with
     36   " <template> typescriptreact doesn't define it but we want to not include
     37   " the JSX syntax.
     38   syntax clear typescriptTypeCast
     39 
     40   syntax region glimmerTemplateBlock
     41     \ start="<template>" end="</template>"
     42     \ contains=@hbs
     43     \ containedin=typescriptClassBlock,typescriptFuncCallArg
     44     \ keepend fold
     45 
     46   let b:current_syntax = "typescript.glimmer"
     47 endif
     48 
     49 let &cpo = s:cpo_save
     50 unlet s:cpo_save
     51 unlet! base_syntax