Answered by
Atemo-C
Sep 5, 2025
Replies: 4 comments 9 replies
|
The current syntax for nix is pretty barebones so you would need to extend it. It should be straight-forward to recognize URLs in comments and move |
5 replies
Penultimate updateWith the following filetype: nix
detect:
filename: "\\.nix$"
rules:
- special: "\\b(null|self|super|true|false|abort)\\b"
- statement: "\\b(let|in|with|import|rec|inherit)\\b"
- statement: "[A-Za-z0-9_-]+\\s*(\ )"
- symbol.operator: "([~^.:;,+*|=!\\%@]|<|>|/|-|&)"
- symbol.brackets: "([(){}]|\\[|\\])"
- constant.bool.true: "\\b(true)\\b"
- constant.bool.false: "\\b(false)\\b"
- constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b"
- constant.string:
start: "\""
end: "\""
rules: []
- constant.string:
start: "''"
end: "''"
rules: []
- comment:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- underlined.url: "https?://[\\w\\-./?=&%#]+"
- underlined.url: "http?://[\\w\\-./?=&%#]+"
- comment:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
- underlined.url: "https?://[\\w\\-./?=&%#]+"
- underlined.url: "http?://[\\w\\-./?=&%#]+"I am unsure if this is fully correct, as this is the first time I modify this kind of file, but it seems to work. Now, I still have not figured out how to make the last word yellow before the |
0 replies
2 replies
Answer selected by
Atemo-C
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment











Yay.
This is more a workaround than a solution, but replacing the problematic line with
- identifier: "[A-Za-z0-9_-]+(\ =|;)""fixes" the issue (edit: and now quite a bit more detailed"[A-Za-z0-9_-]+(\ *=|;|}.| &&|\\)|\ *\\(|\ *{|\ *\")", will keep updating if needs be). It is not great and is fragile, but, in this case…hey, it works. Probably not going to open a pull request with that kind of quality, though.This is the full file for those interested: