Skip to content

Instantly share code, notes, and snippets.

@KelseyHigham
Last active June 20, 2023 11:57
Show Gist options
  • Save KelseyHigham/cc67b3eb364056910afd3b825a045f51 to your computer and use it in GitHub Desktop.
Save KelseyHigham/cc67b3eb364056910afd3b825a045f51 to your computer and use it in GitHub Desktop.
Lua + GLSL syntax highlighting, for Sublime Text 4
%YAML 1.2
---
name: Lua-glsl
scope: source.lua
extends: Packages/Lua/Lua.sublime-syntax
version: 2
file_extensions:
- lua
# Lua with GLSL syntax highlighting within multi-line strings, intended for LÖVR
# to use, start a GLSL block with [[//glsl. for example:
# local depthShader = lovr.graphics.newShader('unlit', [[//glsl
# vec4 lovrmain() {
# float d = clamp(1-distance(CameraPositionWorld, PositionWorld)/20, .1, 1);
# return Color * vec4(d,d,d,1);
# }
# ]])
contexts:
string:
- include: single-quoted-string
- include: double-quoted-string
- include: multiline-string-glsl
- include: multiline-string
multiline-string-glsl:
- match: '(?i)(\[\[ ?/?/?\*? ?GLSL ?\*?/?)'
scope: punctuation.definition.string.begin.lua
embed: scope:source.glsl
embed_scope: source.glsl.embedded
escape: \]\]
escape_captures:
0: punctuation.definition.string.end.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment