Skip to content

bezhermoso/tree-sitter-ghostty

Repository files navigation

tree-sitter-ghostty



Tree-sitter grammar for Ghostty configuration files

SCR-20241229-moju
SCR-20241229-mogq

TODOs

  • Grammar
    • Comments
    • Raw values
    • Numbers
    • Percents
    • Colors
    • Palette
    • Keybindings
      • Chords
      • Modifiers
      • Actions & arguments
      • Special keys (e.g. tab, space, up)
  • Tests
  • Capture highlight groups
  • Stable release
    • Contribute queries to nvim-treesitter (No longer accepting experimental parsers)

Neovim

lazy.nvim

Add this:

{
    "bezhermoso/tree-sitter-ghostty",
    build = "make nvim_install",
}

Note

Having nvim-treesitter installed is not required. However if you have it installed, this plugin will attempt to register itself as a parser so that nvim-treesitter can manage it e.g. :TSInstall! ghostty.

Installing this as a plugin should automatically enable syntax highlighting for Ghostty configuration files located in expected paths. You can add this line to the top of your config file if its filetype is not detected automatically:

+# vim: ft=ghostty
 #
 # The rest of your Ghostty configuration 👻...

Helix

  1. Add this to your languages.toml
[[language]]
name = "ghostty"
scope = "source.ghostty"
injection-regex = "ghostty"
file-types = [{ glob = "*ghostty/config" }]
grammar = "ghostty"
comment-tokens = "#"

[[grammar]]
name = "ghostty"
source = { git = "https://github.com/bezhermoso/tree-sitter-ghostty", rev = "main" }
  1. In your runtime directory, symlink ./queries/ghostty/highlights.scm to grammars/sources/ghostty/queries/highlights.scm