Skip to content

Commit

Permalink
Add ghostty configuration support (#12703)
Browse files Browse the repository at this point in the history
gerblesh authored Jan 29, 2025
1 parent 6049f20 commit 8328c42
Showing 3 changed files with 80 additions and 1 deletion.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@
| gdscript |||| |
| gemini || | | |
| gherkin || | | |
| ghostty || | | |
| git-attributes || | | |
| git-commit ||| | |
| git-config ||| | |
12 changes: 11 additions & 1 deletion languages.toml
Original file line number Diff line number Diff line change
@@ -2829,7 +2829,6 @@ file-types = [
"network",
{ glob = ".editorconfig" },
{ glob = ".npmrc" },
{ glob = "ghostty/config" },
{ glob = "hgrc" },
{ glob = "npmrc" },
{ glob = "rclone.conf" },
@@ -4077,3 +4076,14 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "gren"
source = { git = "https://github.com/MaeBrooks/tree-sitter-gren", rev = "76554f4f2339f5a24eed19c58f2079b51c694152" }

[[language]]
name = "ghostty"
scope = "source.ghostty"
file-types = [{ glob = "ghostty/config" }]
comment-tokens = "#"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "ghostty"
source = { git = "https://github.com/bezhermoso/tree-sitter-ghostty" , rev = "8438a93b44367e962b2ea3a3b6511885bebd196a" }
68 changes: 68 additions & 0 deletions runtime/queries/ghostty/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
; extends
; Comments
(comment) @comment

; Keys
(property) @variable

; Values
(boolean) @constant.builtin.boolean


[
(number)
(adjustment)
] @constant.numeric

[
"+"
"="
(keybind_trigger ">")
] @operator

(":") @punctuation.delimiter

; (color) are hex values
(color "#" @punctuation.special
(#eq? @punctuation.special "#"))

(path_value "?" @keyword.control.conditional
(#eq? @keyword.control.conditional "?"))

; `palette`
(palette_index) @variable.other.member

; `path_directive`
(path_directive (property) @keyword.import)
(path_directive (path_value (string) @string.special.path ))


(action_name) @function.builtin
(action_argument (string) @variable.parameter )

; (tuple)
(tuple "," @punctuation.delimiter.special
(#eq? @punctuation.delimiter.special ","))

[
(string)
(color)
] @string

; clear is a special keyword that clear all existing keybind up to that point
((keybind_value) @keyword
(#eq? @keyword "clear"))

; `keybind`
(keybind_value) @string.special

; NOTE: The order here matters!
[
(key_qualifier)
(keybind_modifier)
] @attribute

[
(modifier_key)
(key)
] @constant.builtin

0 comments on commit 8328c42

Please sign in to comment.