aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/extra/sublime.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-04-04 19:22:04 +0300
committerCan Celik <ogulcancelik@gmail.com>2026-04-05 01:23:06 +0300
commit41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch)
tree3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/extra/sublime.zig
parent55c138263e190a1e79d4b997bfb9397306c0ec1f (diff)
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/extra/sublime.zig')
-rw-r--r--vendor/libghostty-vt/src/extra/sublime.zig50
1 files changed, 50 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/extra/sublime.zig b/vendor/libghostty-vt/src/extra/sublime.zig
new file mode 100644
index 00000000..e0deb2fa
--- /dev/null
+++ b/vendor/libghostty-vt/src/extra/sublime.zig
@@ -0,0 +1,50 @@
+const Config = @import("../config/Config.zig");
+
+const Template = struct {
+ const header =
+ \\%YAML 1.2
+ \\---
+ \\# See http://www.sublimetext.com/docs/syntax.html
+ \\name: Ghostty Config
+ \\file_extensions:
+ \\ - ghostty
+ \\scope: source.ghostty
+ \\
+ \\contexts:
+ \\ main:
+ \\ # Comments
+ \\ - match: '^\s*#.*$'
+ \\ scope: comment.line.number-sign.ghostty
+ \\
+ \\ # Keywords
+ \\ - match: '\b(
+ ;
+ const footer =
+ \\)\b'
+ \\ scope: keyword.other.ghostty
+ \\
+ ;
+};
+
+/// Check if a field is internal (starts with underscore)
+fn isInternal(name: []const u8) bool {
+ return name.len > 0 and name[0] == '_';
+}
+
+/// Generate keywords from Config fields
+fn generateKeywords() []const u8 {
+ @setEvalBranchQuota(5000);
+ var keywords: []const u8 = "";
+ const config_fields = @typeInfo(Config).@"struct".fields;
+
+ for (config_fields) |field| {
+ if (isInternal(field.name)) continue;
+ if (keywords.len > 0) keywords = keywords ++ "|";
+ keywords = keywords ++ field.name;
+ }
+
+ return keywords;
+}
+
+/// Complete Sublime syntax file content
+pub const syntax = Template.header ++ generateKeywords() ++ Template.footer;