runtime(glimmer): add syntax support for glimmer files
Commit:
https://github.com/vim/vim/commit/75decb4a8d10c2e529add1f0e7e0a545576de2ea
Author: Devin Weaver <[email protected]>
Date: Thu Mar 5 20:07:50 2026 +0000
runtime(glimmer): add syntax support for glimmer files
In commit cdf717283 ("patch 8.2.4424: ".gts" and ".gjs" files are not
recognized", 2022-02-19) support for the glimmer file types were added.
Problem: Syntax hilighting suppoprt was missing.
Solution: Added a glimmer syntax file that will leverage the base
syntaxs (javascript/typescript) and include handlebars syntax
for .gjs/.gts files.
closes: #19569
Signed-off-by: Devin Weaver <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index 92e9e6025..6d51dea17 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -542,6 +542,7 @@ runtime/syntax/gitignore.vim
@ObserverOfTime
runtime/syntax/gitolite.vim @sitaramc
runtime/syntax/gitrebase.vim @tpope
runtime/syntax/gleam.vim @kirillmorozov
+runtime/syntax/glimmer.vim @sukima
runtime/syntax/glsl.vim @gpanders
runtime/syntax/go.vim @bhcleek
runtime/syntax/goaccess.vim @meonkeys
diff --git a/runtime/syntax/glimmer.vim b/runtime/syntax/glimmer.vim
new file mode 100644
index 000000000..67555db85
--- /dev/null
+++ b/runtime/syntax/glimmer.vim
@@ -0,0 +1,51 @@
+" Vim syntax file
+" Language: Glimmer
+" Maintainer: Devin Weaver
+" Last Change: 2026 Feb 20
+" Origin: https://github.com/joukevandermaas/vim-ember-hbs
+" Credits: Jouke van der Maas
+" License: Same as Vim
+
+" Vim detects GJS/GTS files as {java,type}script.glimmer
+" Vim will read the javascript/typescript syntax files first and set
+" b:current_syntax accordingly then it will read the glimmer syntax file.
+" This is why we use b:current_syntax to make sure we are in the correct state
+" to continue.
+
+if exists('b:current_syntax') && b:current_syntax !~# ' %(type|java)script'
+ finish
+endif
+
+let base_syntax = b:current_syntax
+unlet! b:current_syntax
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+syntax include @hbs syntax/handlebars.vim
+
+if base_syntax == "javascript"
+ syntax region glimmerTemplateBlock
+ \ start="<template>" end="</template>"
+ \ contains=@hbs
+ \ keepend fold
+
+ let b:current_syntax = "javascript.glimmer"
+else
+ " syntax/typescript.vim adds typescriptTypeCast which is in conflict with
+ " <template> typescriptreact doesn't define it but we want to not include
+ " the JSX syntax.
+ syntax clear typescriptTypeCast
+
+ syntax region glimmerTemplateBlock
+ \ start="<template>" end="</template>"
+ \ contains=@hbs
+ \ containedin=typescriptClassBlock,typescriptFuncCallArg
+ \ keepend fold
+
+ let b:current_syntax = "typescript.glimmer"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+unlet! base_syntax
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vyF6A-008UdQ-KG%40256bit.org.