summaryrefslogtreecommitdiff
path: root/runtime/queries/nu/highlights.scm
blob: b643a63afcbbc6102ee242ad4219cb818e8c7e60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(string) @string
(type) @type
(value_path) @variable
(comment) @comment

(number_literal) @constant.numeric
(range from: (number_literal) @constant.numeric)
(range to: (number_literal) @constant.numeric)

(command cmd_name: (identifier) @function)
(function_definition func_name: (identifier) @function)

[
    (variable_declaration name: (identifier))
    (parameter (identifier))
    (flag (flag_name))
    (flag (flag_shorthand_name))
    (record_entry entry_name: (identifier))
    (block_args block_param: (identifier))
] @variable.other.member
; (parameter (identifier) @variable.parameter) ; -- alternative highlighting group?

(cmd_invocation) @embedded


((identifier) @constant
 (#match? @constant "^[A-Z][A-Z\\d_]*$"))

[
 "if"
 "else"
 "let"
 "def"
 "export"
] @keyword

[
  ; "/" Not making / an operator may lead to better highlighting?
  "$"
  "|"
  "+"
  "-"
  "*"
  "="
  "!="
  "&&"
  "||"
  "=="
  ">"
] @operator

["."
 "," 
 ";" 
] @punctuation.delimiter