.conf
syntax highlighting
#10776
-
This has to have been tackled before, but the number one most irritating thing about Helix is finding a language syntax that appropriately fits configuration files or "ini" files. I am not talking about the less common variants where |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@anoduck As far as I can tell, Helix has a pre-configured INI section in its default I haven't tried this personally, but you could add the following to your [[language]]
name = "ini"
scope = "source.ini"
file-types = [
"ini",
# Systemd unit files
"service",
"automount",
"device",
"mount",
"path",
"service",
"slice",
"socket",
"swap",
"target",
"timer",
# Podman quadlets
"container",
"volume",
"kube",
"network",
{ glob = ".editorconfig" },
{ glob = "rclone.conf" },
"properties",
"cfg",
"directory",
# === your specific .conf files or all ".conf" files ===
# { glob = "some_file.conf" },
# "conf",
]
injection-regex = "ini"
comment-token = "#"
indent = { tab-width = 4, unit = "\t" }
[[grammar]]
name = "ini"
source = { git = "https://github.com/justinmk/tree-sitter-ini", rev = "87176e524f0a98f5be75fa44f4f0ff5c6eac069c" } (note: I also updated the Tree Sitter grammar to the latest |
Beta Was this translation helpful? Give feedback.
@anoduck a quick search for "tree sitter nginx conf" on Google turned up this repo: https://gitlab.com/joncoole/tree-sitter-nginx
It is hosted on GitLab and I see most examples for
[[grammar]]
use GitHub links, but you can give it a shot. I'm not sure if this would work / haven't looked into the docs, but you could give something like this a shot:which should provide syntax highlighting for NGINX conf files.
Again, no idea if this would work since most grammar sections list a file extension, not a specific file name so you'd have to just giv…