Flake for my NixOS devices
1%YAML 1.2
2---
3# https://www.sublimetext.com/docs/syntax.html
4# https://www.https://www.nushell.sh/book/
5name: nushell
6scope: source.nu
7version: 2
8
9file_extensions:
10 - nu
11
12first_line_match: |-
13 (?xi:
14 ^ \s* \%+ .*? -\*- .*? \bnu\b .*? -\*- # editorconfig
15 )
16
17variables:
18 # ?
19 identifier: (?:[A-Za-z]\w*)
20 filename: (?:[^;,(\s]+)
21 eol: (?=\s*[%\n])
22
23 # https://www.nushell.sh/book/command_reference.html#command-reference
24 nushell_functions: |-
25 (?x: all | ansi | any | append | ast | bits | bytes | cd | char | chunks | clear | collect | columns | commandline | compact | complete | config | cp | date | debug | decode | default | describe | detect | do | drop | du | each | echo | encode | enumerate | error | every | exec | exit | explain | explore | fill | filter | find | first | flatten | fmt | format | from | generate | get | glob | grid | group-by | hash | headers | help | hide-env | histogram | history | http | ignore | input | insert | inspect | interleave | into | is-admin | is-empty | is-not-empty | is-terminal | items | join | keybindings | kill | last | length | let-env | lines | load-env | ls | math | merge | metadata | mkdir | mktemp | move | mv | nu-check | nu-highlight | open | overlay | panic | par-each | parse | path | plugin | port | prepend | print | ps | query | random | range | reduce | reject | rename | reverse | rm | roll | rotate | run-external | save | schema | scope | select | seq | shuffle | skip | sleep | sort | sort-by | split | split-by | start | stor | str | sys | table | take | tee | term | timeit | to | touch | transpose | tutor | ulimit | uname | uniq | update | upsert | url | values | version | view | watch | which | whoami | window | with-env | wrap | zip)
26
27 custom_functions: |-
28 (?x: 7z | \? | _atuin_search_cmd | activate | adbtasker | add-preamble | ai | ansi-strip-table | apps-update | askai | askdalle | askpdf | autolister | autouse-file | balena | banner | bar | base2dec | batstat | bhe-update | bitly | cblue | cd-pipe | chat_gpt | chatpdf | check-link | claude_ai | clean-analytics | clone-ubuntu-install | code | column | column2 | const-table | copy-downloads-2-ubbdrive | copy-research-2-ubbdrive | copy-scripts-and-commit | copy-webies-2-ubbdrive | copy-yandex-and-commit | coretemp | countdown | cp-pipe | cpwd | create_left_prompt | create_right_prompt | dall_e | date | debunk-table | dec2base | default-table | dpx | echo-c | echo-g | echo-r | exchange_rates | export-nushell-docs | find-file | find-index | fix-docker | fix-green-dirs | format-mails | fuzzy-dispatcher | fuzzy-select-fs | gcal | generate-dates | get-aliases | get-devices | get-dirs | get-env | get-files | get-github-latest | get-input | get-ips | get-keybindings | get-miss-chapters | get-monitors | get-pass | get-phone-number | get-rows | get-vers | get_weather_by_interval | gg | gg-trans | github-app-update | gmail | gnome-settings | gnu-plot | google_ai | google_search | goto-nuconfigdir | grep-nu | group-list | guake | h | habitica | history | history-stats | http | indexify | install-font | intersect | into | is-column | is-mounted | iselect | isleap | jd | jdown | join-text-files | killn | le | left_prompt | lg | libreoff | list-diff | list-sum | listen-ports | lister | lists2table | ln | lo | ls-ports | lt | m | maps | math | matlab-cli | mcx | med_discord | media | mk-anime | mkcd | monitor | mpv | multiwhere | mv-anime | mv-manga | mv-pipe | mv-torrents | my-pandoc | my-pdflatex | nchat | nerd-fonts-clean | network-switcher | nu-crypt | nu-sloc | nufetch | nushell-syntax-2-sublime | obs | op | open-analytics | open-credential | open-link | openf | openl | openm | patch-font | pdf | pip3-upgrade | pivot-table | plot-table | png-plot | print-file | progress_bar | ps | psn | pwd | pwd-short | qrenc | quick-ubuntu-and-tools-update-module | r9 | ram | rand-select | randi | random | range2list | rclone | re-enamerate | rebrandly | rename-all | rename-date | replicate-tree | reset-alpine-auth | return-error | rm-empty-dirs | rm-pipe | rml | rmount | save-credential | scale-minmax | scale-minmax-table | scompact | send-gmail | set-env | set-screen | setdiff | show-ips | show_banner | speedtest-plot | ssh-sin-pass | ssh-termux | ssh-to | std | stop-net-apps | str | subl | sum-size | supgrade | svg2pdf | sys | t | table-diff | table2record | tasker | tasker-join | to-conversiones | to-onedrive | tokei | token2word | trans | tts | typeof | ubb | ubb_announce | um | umall | union | uniq-by | unset-env | up2ubb | update-nu-config | upload-debs-to-gdrive | usage | ver | verify | weather | wget-all | which-cd | wifi-info | wifi-pass | xls2csv | ydx | yt-api | ytcli | ytm | z | zi)
29
30 plugin_functions: |-
31 (?x: from | gstat | highlight | hist | inc | plot | polars | port | query | to | xyplot)
32
33 nushell_keywords: |-
34 (?x: alias | break | const | continue | def | export | export-env | extern | for | hide | if | let | loop | match | module | mut | overlay | plugin | return | source | source-env | try | use | where | while | else | catch)
35
36 nushell_aliases: |-
37 (?x: R | apagar | append-table | bard | bat | btop | cable-ubb | cal | copy | cputemp | dexit | ds | dsitcl | enter | finished | g | get-mac | get-wg | grp | math mean | math std | max-vol | mcv | mount-ssd4 | mpydf | mute | n | ncdu | netspeed | nu-clean | open-config | p | paste | png | print-list | quantum | reiniciar | s | shells | takephoto | to matlab-matrix | trc | tree | unmute | wsp)
38
39 nushell_personal: |-
40 (?x: speedtest | myffmpeg | subtitles-renamer)
41
42 nushell_operators: |-
43 (?x: and | or | mod | in | not-in | not | xor | bit-or | bit-xor | bit-and | bit-shl | bit-shr | starts-with | ends-with)
44
45 boolean_operators: |-
46 (?x: true | false)
47
48################################################################################
49
50contexts:
51 main:
52 - include: function-declarations
53 - include: class-declarations
54 - include: keywords
55 - include: expressions
56
57 expressions:
58 - include: comments
59 - include: line-continuations
60 - include: parens
61 - include: brackets
62 - include: braces
63 - include: numbers
64 - include: strings
65 - include: operators
66 - include: accessor-dots
67 - include: terminators
68 - include: separator-commas
69 - include: builtin-packages
70 - include: structures
71 - include: builtin-constants
72 - include: builtin-variables
73 - include: transposed-variables
74 - include: variable-assignments
75 - include: builtin-types
76 - include: builtin-commands
77 - include: builtin-functions
78 - include: custom-functions
79 - include: plugin-functions
80 - include: nushell-keywords
81 - include: nushell-aliases
82 - include: nushell-personal
83 - include: nushell-operators
84 - include: boolean-operators
85 - include: variables
86 - include: invalid-variables
87
88 eol-pop:
89 - match: "{{eol}}"
90 pop: 1
91
92 else-pop:
93 - match: (?=\S)
94 pop: 1
95
96 ###[ COMMENTS AND LINE CONTINUATION ]###########################################
97
98 comments:
99 - include: block-comments
100 - include: line-comments
101
102 block-comments:
103 - match: ^\s*(#\{)\s*\n
104 captures:
105 1: punctuation.definition.comment.nu
106 push: block-comment-content
107
108 block-comment-content:
109 - meta_scope: comment.block.percentage.nu
110 - match: ^\s*(#)\s*$\n?
111 captures:
112 1: punctuation.definition.comment.nu
113 pop: 1
114 - include: block-comments
115
116 line-comments:
117 - match: (#+).*\n?
118 scope: comment.line.percentage.nu
119 captures:
120 1: punctuation.definition.comment.nu
121
122 # line-continuations:
123 # - match: (\.{3})\s*(\S.*\n?)?
124 # captures:
125 # 1: punctuation.separator.continuation.line.nu
126 # 2: comment.line.nu
127
128 ###[ LANGUAGE FUNDAMENTALS ]####################################################
129
130 numbers: #?
131 - match: \b(0[xX])(\h+)(u8|u16|u32|u64|s8|s16|s32|s64)?\b
132 scope: meta.number.integer.hexadecimal.nu
133 captures:
134 1: constant.numeric.base.nu
135 2: constant.numeric.value.nu
136 3: constant.numeric.suffix.nu
137 push: maybe-transpose
138 - match: \b(0[bB])([01]+)(u8|u16|u32|u64|s8|s16|s32|s64)?\b
139 scope: meta.number.integer.binary.nu
140 captures:
141 1: constant.numeric.base.nu
142 2: constant.numeric.value.nu
143 3: constant.numeric.suffix.nu
144 push: maybe-transpose
145 - match: ((?:\d+(\.)\d*|(\.)?\d+)(?:[Ee][-+]?\d+)?)(i|j)\b
146 scope: meta.number.imaginary.decimal.nu
147 captures:
148 1: constant.numeric.value.nu
149 2: punctuation.separator.decimal.nu
150 3: punctuation.separator.decimal.nu
151 4: constant.numeric.suffix.nu
152 push: maybe-transpose
153 - match: (?:\d+(\.)\d*|(\.)?\d+)(?:[Ee][-+]?\d+)?(?!\w)
154 scope: meta.number.float.decimal.nu constant.numeric.value.nu
155 captures:
156 1: punctuation.separator.decimal.nu
157 2: punctuation.separator.decimal.nu
158 push: maybe-transpose
159
160 strings:
161 - match: \'
162 scope: punctuation.definition.string.begin.nu
163 push: single-quoted-string
164 - match: \"
165 scope: punctuation.definition.string.begin.nu
166 push: double-quoted-string
167
168 single-quoted-string:
169 - meta_include_prototype: false
170 - meta_scope: meta.string.nu string.quoted.single.nu
171 - match: \'\'
172 scope: constant.character.escape.nu
173 - match: \'
174 scope: punctuation.definition.string.end.nu
175 set: maybe-dot-transpose
176 - match: $\n?
177 scope: invalid.illegal.unclosed-string.nu
178 pop: 1
179 - include: escaped-characters
180 - include: format-specs
181
182 double-quoted-string:
183 - meta_include_prototype: false
184 - meta_scope: meta.string.nu string.quoted.double.nu
185 - match: \"\"
186 scope: constant.character.escape.nu
187 - match: \"
188 scope: punctuation.definition.string.end.nu
189 set: maybe-transpose
190 - match: $\n?
191 scope: invalid.illegal.unclosed-string.nu
192 pop: 1
193 - include: escaped-characters
194 - include: format-specs
195
196 escaped-characters:
197 - match: \%\%|\\\\|\\[abfnrtv]
198 scope: constant.character.escape.nu
199
200 format-specs:
201 - match: \%(?:\d\$)?[-+\s0#]?(?:\d+|\*)?(?:\.\d+|\.\*)?(?:[cdeEfgGis]|[bt]?[ouxX])
202 scope: constant.other.placeholder.nu
203
204 variables:
205 - match: \b{{identifier}}
206 scope: variable.other.nu
207
208 transposed-variables:
209 - match: \b({{identifier}})(?:\s*(\.\')|(\'))
210 captures:
211 1: variable.other.nu
212 2: keyword.operator.transpose.nu
213 3: keyword.operator.transpose.nu
214
215 variable-assignments:
216 - match: \b({{identifier}})\s*(=)(?!=)
217 captures:
218 1: variable.other.nu
219 2: keyword.operator.assignment.nu
220
221 structures:
222 - match: \b({{identifier}})(\.)(?={{identifier}})
223 captures:
224 1: variable.other.nu
225 2: punctuation.accessor.dot.nu
226 push: structure-fields
227
228 structure-fields:
229 - match: ({{identifier}})(\.)(?={{identifier}})
230 captures:
231 1: variable.other.member.nu
232 2: punctuation.accessor.dot.nu
233 - match: "{{identifier}}"
234 scope: variable.other.member.nu
235 set: maybe-transpose
236
237 ###[ PARENS/BRACKETS/BRACES BLOCKS ]############################################
238
239 parens:
240 - match: \(
241 scope: punctuation.section.parens.begin.nu
242 push: parens-content
243
244 parens-content:
245 - meta_scope: meta.parens.nu
246 - match: \)
247 scope: punctuation.section.parens.end.nu
248 set: maybe-fields-or-transpose
249 - include: last-indices
250 - include: expressions
251
252 maybe-fields-or-transpose:
253 - match: (\.)({{identifier}})
254 captures:
255 1: punctuation.accessor.dot.nu
256 2: variable.other.member.nu
257 - match: \.(?!['*/\\^])
258 scope: punctuation.accessor.dot.nu
259 pop: 1
260 - include: maybe-transpose
261
262 brackets:
263 - match: \[
264 scope: punctuation.section.brackets.begin.nu
265 push: brackets-content
266
267 brackets-content:
268 - meta_scope: meta.brackets.nu
269 - match: \]
270 scope: punctuation.section.brackets.end.nu
271 set: maybe-transpose
272 - include: separator-semicolons
273 - include: argument-placeholders
274 - include: expressions
275
276 braces:
277 - match: \{
278 scope: punctuation.section.braces.begin.nu
279 push: braces-content
280
281 braces-content:
282 - meta_scope: meta.braces.nu
283 - match: \}
284 scope: punctuation.section.braces.end.nu
285 set: maybe-fields-or-transpose
286 - include: separator-semicolons
287 - include: last-indices
288 - include: expressions
289
290 ###[ DECLARATION BLOCKS ]#######################################################
291
292 function-declarations:
293 - match: \bdef\b
294 scope: keyword.declaration.function.nu
295 push: function-declaration-header
296
297 function-declaration-header:
298 - meta_scope: meta.function.nu
299 - include: line-continuations
300 - match: "{{eol}}"
301 set: maybe-function-arguments-block
302 - match: ({{identifier}})\s*(=)
303 captures:
304 1: variable.parameter.output.nu
305 2: keyword.operator.assignment.nu
306 - match: \[
307 scope: punctuation.section.brackets.begin.nu
308 push: function-output-parameters-list
309 # - match: =
310 # scope: keyword.operator.assignment.nu
311 - match: (?:(?:set|get)(\.))?{{identifier}}
312 scope: entity.name.function.nu
313 captures:
314 1: punctuation.accessor.dot.nu
315 - match: \{
316 scope: punctuation.section.parens.begin.nu
317 push: function-input-parameters-list
318
319 function-output-parameters-list:
320 - include: line-continuations
321 - include: eol-pop
322 - include: separator-commas
323 - match: \]
324 scope: punctuation.section.brackets.end.nu
325 pop: 1
326 - match: "{{identifier}}"
327 scope: variable.parameter.output.nu
328
329 function-input-parameters-list:
330 - clear_scopes: 1
331 - meta_scope: meta.function.parameters.nu
332 - include: line-continuations
333 - include: eol-pop
334 - include: separator-commas
335 - include: argument-placeholders
336 - match: \)
337 scope: punctuation.section.parens.end.nu
338 pop: 1
339 - match: "{{identifier}}"
340 scope: variable.parameter.input.nu
341
342 maybe-function-arguments-block:
343 - meta_content_scope: meta.function.nu
344 - include: comments
345 - match: \barguments\b
346 scope: keyword.context.arguments.nu
347 push: function-arguments-block-header
348 - match: (?=\S)
349 set: function-body
350
351 function-arguments-block-header:
352 - meta_scope: meta.arguments.nu
353 - match: \[
354 scope: punctuation.section.parens.begin.nu
355 push: function-arguments-block-attributes-list
356 - match: "{{eol}}"
357 set: function-arguments-block-content
358
359 function-arguments-block-attributes-list:
360 - meta_scope: meta.attributes.nu
361 - include: eol-pop
362 - match: \]
363 scope: punctuation.section.parens.end.nu
364 pop: 1
365 - match: \bRepeating\b
366 scope: variable.parameter.attribute.nu
367
368 function-arguments-block-content:
369 - meta_scope: meta.arguments.nu
370 - match: \bend\b
371 scope: keyword.context.arguments.end.nu
372 pop: 1
373 - match: \b\.\?
374 scope: keyword.operator.properties.nu
375 - include: argument-placeholders
376 - include: builtin-types
377 - include: expressions
378
379 function-body:
380 - meta_scope: meta.function.nu
381 - match: \bend\b
382 scope: keyword.declaration.function.end.nu
383 pop: 1
384 - include: function-declarations
385 - include: keywords
386 - include: expressions
387
388 ###[ KEYWORDS AND FLOW CONTROL BLOCKS ]#########################################
389
390 # https://www.mathworks.com/help/matlab/ref/iskeyword.html
391 # https://www.mathworks.com/help/matlab/control-flow.html
392 keywords:
393 - include: if-blocks
394 - include: switch-blocks
395 - include: for-blocks
396 - include: parfor-blocks
397 - include: while-blocks
398 - include: try-blocks
399 - include: spmd-blocks
400 # - match: \bbreak\b
401 # scope: keyword.control.flow.break.nu
402 # - match: \bcontinue\b
403 # scope: keyword.control.flow.continue.nu
404 # - match: \breturn\b
405 # scope: keyword.control.flow.return.nu
406 # - match: \bglobal\b
407 # scope: storage.modifier.global.nu
408 # - match: \bpersistent\b
409 # scope: storage.modifier.persistent.nu
410
411 if-blocks:
412 - match: \bif\b
413 scope: keyword.control.conditional.if.nu
414 push: if-block-content
415
416 if-block-content:
417 - meta_scope: meta.block.if.nu
418 - match: \belseif\b
419 scope: keyword.control.conditional.elseif.nu
420 - match: \belse\b
421 scope: keyword.control.conditional.else.nu
422 - match: \bend\b
423 scope: keyword.control.conditional.end.nu
424 pop: 1
425 - include: keywords
426 - include: expressions
427
428 # switch-blocks:
429 # - match: \bswitch\b
430 # scope: keyword.control.conditional.switch.nu
431 # push: switch-block-content
432
433 # switch-block-content:
434 # - meta_scope: meta.block.switch.nu
435 # - match: \bcase\b
436 # scope: keyword.control.conditional.case.nu
437 # - match: \botherwise\b
438 # scope: keyword.control.conditional.otherwise.nu
439 # - match: \bend\b
440 # scope: keyword.control.conditional.end.nu
441 # pop: 1
442 # - include: keywords
443 # - include: expressions
444
445 for-blocks:
446 - match: \bfor\b
447 scope: keyword.control.loop.for.nu
448 push: for-block-content
449
450 for-block-content:
451 - meta_scope: meta.block.for.nu
452 - match: \bend\b
453 scope: keyword.control.loop.end.nu
454 pop: 1
455 - include: keywords
456 - include: expressions
457
458 # parfor-blocks:
459 # - match: \bparfor\b
460 # scope: keyword.control.loop.parfor.nu
461 # push: parfor-block-content
462
463 # parfor-block-content:
464 # - meta_scope: meta.block.parfor.nu
465 # - match: \bend\b
466 # scope: keyword.control.loop.end.nu
467 # pop: 1
468 # - include: keywords
469 # - include: expressions
470
471 # while-blocks:
472 # - match: \bwhile\b
473 # scope: keyword.control.loop.while.nu
474 # push: while-block-content
475
476 # while-block-content:
477 # - meta_scope: meta.block.while.nu
478 # - match: \bend\b
479 # scope: keyword.control.loop.end.nu
480 # pop: 1
481 # - include: keywords
482 # - include: expressions
483
484 # try-blocks:
485 # - match: \btry\b
486 # scope: keyword.control.exception.try.nu
487 # push: try-block-content
488
489 # try-block-content:
490 # - meta_scope: meta.block.try.nu
491 # - match: \bcatch\b
492 # scope: keyword.control.exception.catch.nu
493 # - match: \bend\b
494 # scope: keyword.control.exception.end.nu
495 # pop: 1
496 # - include: keywords
497 # - include: expressions
498
499 # spmd-blocks:
500 # - match: \bspmd\b
501 # scope: keyword.context.spmd.nu
502 # push: spmd-block-content
503
504 # spmd-block-content:
505 # - meta_scope: meta.block.spmd.nu
506 # - match: \bend\b
507 # scope: keyword.context.spmd.end.nu
508 # pop: 1
509 # - include: keywords
510 # - include: expressions
511
512 ###[ OPERATORS AND PUNCTUATION ]################################################
513
514 # https://www.mathworks.com/help/matlab/matlab_prog/matlab-operators-and-special-characters.html
515 operators:
516 - match: '\+|-|\*|\.\*|/|\./|\\|\.\\|\^|\.\^'
517 scope: keyword.operator.arithmetic.nu
518 - match: "==|~=|>=|>|<=|<"
519 scope: keyword.operator.comparison.nu
520 - match: '~|&&|&|\|\||\|'
521 scope: keyword.operator.logical.nu
522 - match: ":"
523 scope: keyword.operator.colon.nu
524 - match: "="
525 scope: keyword.operator.assignment.nu
526 - match: \?(?=[A-Za-z])
527 scope: keyword.operator.metaclass.nu
528 - match: \!
529 scope: keyword.operator.shell-escape.nu
530 push: shell-escape-content
531 - match: \b\@
532 scope: punctuation.accessor.at.nu
533 - match: \@
534 scope: keyword.operator.at.nu
535 push: function-handle
536
537 shell-escape-content:
538 - meta_content_scope: meta.string.nu string.unquoted.nu
539 - match: \n
540 pop: 1
541
542 function-handle:
543 - match: \(
544 scope: punctuation.section.parens.begin.nu
545 set: anonymous-function-parameters-list
546 - match: ""
547 pop: 1
548
549 anonymous-function-parameters-list:
550 - meta_scope: meta.function.parameters.nu
551 - include: line-continuations
552 - include: eol-pop
553 - match: "{{identifier}}"
554 scope: variable.parameter.input.nu
555 - include: separator-commas
556 - match: \)
557 scope: punctuation.section.parens.end.nu
558 pop: 1
559
560 maybe-transpose:
561 - match: (?:\s*(\.\')|(\'))?
562 captures:
563 1: keyword.operator.transpose.nu
564 2: keyword.operator.transpose.nu
565 pop: 1
566
567 maybe-dot-transpose:
568 - match: (?:\s*(\.\'))?
569 captures:
570 1: keyword.operator.transpose.nu
571 pop: 1
572
573 accessor-dots:
574 - match: \b\.
575 scope: punctuation.accessor.dot.nu
576
577 terminators:
578 - match: \;
579 scope: punctuation.terminator.nu
580
581 separator-commas:
582 - match: \,
583 scope: punctuation.separator.sequence.nu
584
585 separator-semicolons:
586 - match: \;
587 scope: punctuation.separator.sequence.nu
588
589 ###[ BUILTIN CONSTANTS, VARIABLES AND DATA TYPES ]##############################
590
591 # Functions that return essential constants, usually used without parameters
592 # builtin-constants:
593 # - match: \b(true|false|eps|pi|Inf|NaN|NaT|flintmax|intmax|intmin|realmax|realmin|namelengthmax)\b
594 # scope: constant.language.nu
595 # push: maybe-transpose
596
597 # builtin-variables:
598 # - match: \b(ans|nargin|nargout|varargin|varargout)\b
599 # scope: variable.language.nu
600 # push: maybe-transpose
601
602 # builtin-types:
603 # - match: \b(?:categorical|cell|char|complex|double|int8|int16|int32|int64|logical|single|string|struct|table|timeseries|timetable|uint8|uint16|uint32|uint64)\b(?!\()
604 # scope: storage.type.nu
605
606 # last-indices:
607 # - match: \bend\b
608 # scope: variable.language.nu
609 # push: maybe-transpose
610
611 # argument-placeholders:
612 # - match: \~(?![A-Za-z])
613 # scope: variable.language.anonymous.nu
614
615 ###[ BUILTIN COMMANDS AND FUNCTIONS ]###########################################
616
617 # Functions with predefined parameters, mostly used in command syntax form
618 # builtin-commands:
619 # # https://www.mathworks.com/help/matlab/ref/axis.html
620 # - match: \baxis\b
621 # scope: meta.function-call.nu support.function.builtin.nu
622 # push: maybe-axis-parameter
623 # # https://www.mathworks.com/help/matlab/ref/beep.html
624 # - match: \bbeep\b
625 # scope: meta.function-call.nu support.function.builtin.nu
626 # push: maybe-on-off-parameter
627 # # https://www.mathworks.com/help/matlab/ref/box.html
628 # - match: \bbox\b
629 # scope: meta.function-call.nu support.function.builtin.nu
630 # push: maybe-on-off-parameter
631 # # https://www.mathworks.com/help/matlab/ref/matlab.graphics.interaction.internal.brush.html
632 # - match: \bbrush\b
633 # scope: meta.function-call.nu support.function.builtin.nu
634 # push: maybe-on-off-parameter
635 # # https://www.mathworks.com/help/matlab/ref/cla.html
636 # - match: \bcla\b
637 # scope: meta.function-call.nu support.function.builtin.nu
638 # push: maybe-cla-parameter
639 # # https://www.mathworks.com/help/matlab/ref/clear.html
640 # - match: \bclear\b
641 # scope: meta.function-call.nu support.function.builtin.nu
642 # push: maybe-clear-parameter
643 # # https://www.mathworks.com/help/matlab/ref/close.html
644 # - match: \bclose\b
645 # scope: meta.function-call.nu support.function.builtin.nu
646 # push: maybe-close-parameter
647 # # https://www.mathworks.com/help/matlab/ref/diary.html
648 # - match: \bdiary\b
649 # scope: meta.function-call.nu support.function.builtin.nu
650 # push: maybe-on-off-parameter
651 # # https://www.mathworks.com/help/matlab/ref/drawnow.html
652 # - match: \bdrawnow\b
653 # scope: meta.function-call.nu support.function.builtin.nu
654 # push: maybe-drawnow-parameter
655 # # https://www.mathworks.com/help/matlab/ref/echo.html
656 # - match: \becho\b
657 # scope: meta.function-call.nu support.function.builtin.nu
658 # push: maybe-echo-parameter
659 # # https://www.mathworks.com/help/matlab/ref/exist.html
660 # - match: \bexist\b
661 # scope: meta.function-call.nu support.function.builtin.nu
662 # push: maybe-exist-parameter
663 # # https://www.mathworks.com/help/matlab/ref/exit.html
664 # # https://www.mathworks.com/help/matlab/ref/quit.html
665 # - match: \b(?:exit|quit)\b
666 # scope: meta.function-call.nu support.function.builtin.nu
667 # push: maybe-exit-parameter
668 # # https://www.mathworks.com/help/matlab/ref/format.html
669 # - match: \bformat\b
670 # scope: meta.function-call.nu support.function.builtin.nu
671 # push: maybe-format-parameter
672 # # https://www.mathworks.com/help/matlab/ref/grid.html
673 # - match: \bgrid\b
674 # scope: meta.function-call.nu support.function.builtin.nu
675 # push: maybe-grid-parameter
676 # # https://www.mathworks.com/help/matlab/ref/hidden.html
677 # - match: \bhidden\b
678 # scope: meta.function-call.nu support.function.builtin.nu
679 # push: maybe-on-off-parameter
680 # # https://www.mathworks.com/help/matlab/ref/hold.html
681 # - match: \bhold\b
682 # scope: meta.function-call.nu support.function.builtin.nu
683 # push: maybe-hold-parameter
684 # # https://www.mathworks.com/help/matlab/ref/import.html
685 # - match: \bimport\b
686 # scope: meta.function-call.nu support.function.builtin.nu
687 # push: maybe-import-parameter
688 # # https://www.mathworks.com/help/matlab/ref/material.html
689 # - match: \bmaterial\b
690 # scope: meta.function-call.nu support.function.builtin.nu
691 # push: maybe-material-parameter
692 # # https://www.mathworks.com/help/matlab/ref/mkdir.html
693 # - match: \bmkdir\b
694 # scope: meta.function-call.nu support.function.builtin.nu
695 # push: maybe-mkdir-parameter
696 # # https://www.mathworks.com/help/matlab/ref/more.html
697 # - match: \bmore\b
698 # scope: meta.function-call.nu support.function.builtin.nu
699 # push: maybe-on-off-parameter
700 # # https://www.mathworks.com/help/matlab/ref/movefile.html
701 # - match: \bmovefile\b
702 # scope: meta.function-call.nu support.function.builtin.nu
703 # push: maybe-movefile-parameter
704 # # https://www.mathworks.com/help/matlab/ref/opengl.html
705 # - match: \bopengl\b
706 # scope: meta.function-call.nu support.function.builtin.nu
707 # push: maybe-opengl-parameter
708 # # https://www.mathworks.com/help/matlab/ref/rmdir.html
709 # - match: \brmdir\b
710 # scope: meta.function-call.nu support.function.builtin.nu
711 # push: maybe-rmdir-parameter
712 # # https://www.mathworks.com/help/matlab/ref/who.html
713 # # https://www.mathworks.com/help/matlab/ref/whos.html
714 # - match: \b(?:who|whos)\b
715 # scope: meta.function-call.nu support.function.builtin.nu
716 # push: maybe-who-parameter
717
718 # maybe-on-off-parameter:
719 # - match: (?:on|off)\b
720 # scope: meta.string.nu support.constant.nu
721 # pop: 1
722 # - include: else-pop
723 # - include: eol-pop
724
725 # maybe-axis-parameter:
726 # - match: (?:manual|auto|tight|padded|equal|image|square|fill|vis3d|normal|xy|ij|on|off)\b
727 # scope: meta.string.nu support.constant.nu
728 # pop: 1
729 # - include: else-pop
730 # - include: eol-pop
731
732 # maybe-cla-parameter:
733 # - match: reset\b
734 # scope: meta.string.nu support.constant.nu
735 # pop: 1
736 # - include: else-pop
737 # - include: eol-pop
738
739 # maybe-clear-parameter:
740 # - match: -regexp\b
741 # scope: meta.string.nu support.constant.nu
742 # set: regexp-pattern-list
743 # - match: (?:all|classes|functions|global|import|java|mex|variables)\b
744 # scope: meta.string.nu support.constant.nu
745 # pop: 1
746 # - include: else-pop
747 # - include: eol-pop
748
749 # regexp-pattern-list:
750 # - include: eol-pop
751 # - match: (?=[;,])
752 # pop: 1
753 # - match: '[^;,\s]+'
754 # scope: meta.string.nu string.regexp.nu
755
756 # maybe-close-parameter:
757 # - match: all\b
758 # scope: meta.string.nu support.constant.nu
759 # set: maybe-close-parameter-2
760 # - include: else-pop
761 # - include: eol-pop
762
763 # maybe-close-parameter-2:
764 # - match: (?:hidden|force)\b
765 # scope: meta.string.nu support.constant.nu
766 # pop: 1
767 # - include: else-pop
768 # - include: eol-pop
769
770 # maybe-drawnow-parameter:
771 # - match: (?:limitrate|nocallbacks|update|expose)\b
772 # scope: meta.string.nu support.constant.nu
773 # pop: 1
774 # - include: else-pop
775 # - include: eol-pop
776
777 # maybe-echo-parameter:
778 # - match: (?:on|off)\b
779 # scope: meta.string.nu support.constant.nu
780 # set: maybe-echo-parameter-2
781 # - match: '{{filename}}'
782 # scope: meta.string.nu string.unquoted.nu
783 # set: maybe-on-off-parameter
784 # - include: else-pop
785 # - include: eol-pop
786
787 # maybe-echo-parameter-2:
788 # - match: all\b
789 # scope: meta.string.nu support.constant.nu
790 # pop: 1
791 # - include: else-pop
792 # - include: eol-pop
793
794 # maybe-exist-parameter:
795 # - match: '{{filename}}'
796 # scope: meta.string.nu string.unquoted.nu
797 # set: maybe-exist-parameter-2
798 # - include: else-pop
799 # - include: eol-pop
800
801 # maybe-exist-parameter-2:
802 # - match: (?:builtin|class|dir|file|var)\b
803 # scope: meta.string.nu support.constant.nu
804 # pop: 1
805 # - include: else-pop
806 # - include: eol-pop
807
808 # maybe-exit-parameter:
809 # - match: (?:cancel|force)\b
810 # scope: meta.string.nu support.constant.nu
811 # pop: 1
812 # - include: else-pop
813 # - include: eol-pop
814
815 # maybe-format-parameter:
816 # - match: (?:short|long|shortE|longE|shortG|longG|shortEng|longEng|bank|hex|rational|compact|loose)\b
817 # scope: meta.string.nu support.constant.nu
818 # pop: 1
819 # - include: else-pop
820 # - include: eol-pop
821
822 # maybe-grid-parameter:
823 # - match: (?:on|off|minor)\b
824 # scope: meta.string.nu support.constant.nu
825 # pop: 1
826 # - include: else-pop
827 # - include: eol-pop
828
829 # maybe-hold-parameter:
830 # - match: (?:on|off|all)\b
831 # scope: meta.string.nu support.constant.nu
832 # pop: 1
833 # - include: else-pop
834 # - include: eol-pop
835
836 # maybe-import-parameter:
837 # - match: (?:\w+\.)*(?:\w+|\*)
838 # scope: meta.string.nu string.unquoted.nu
839 # pop: 1
840 # - include: else-pop
841 # - include: eol-pop
842
843 # maybe-material-parameter:
844 # - match: (?:shiny|dull|metal|default)\b
845 # scope: meta.string.nu support.constant.nu
846 # pop: 1
847 # - include: else-pop
848 # - include: eol-pop
849
850 # maybe-mkdir-parameter:
851 # - match: '{{filename}}'
852 # scope: meta.string.nu string.unquoted.nu
853 # set: maybe-mkdir-parameter-2
854 # - include: else-pop
855 # - include: eol-pop
856
857 # maybe-mkdir-parameter-2:
858 # - match: '{{filename}}'
859 # scope: meta.string.nu string.unquoted.nu
860 # pop: 1
861 # - include: else-pop
862 # - include: eol-pop
863
864 # maybe-movefile-parameter:
865 # - match: '{{filename}}'
866 # scope: meta.string.nu string.unquoted.nu
867 # set: maybe-movefile-parameter-2
868 # - include: else-pop
869 # - include: eol-pop
870
871 # maybe-movefile-parameter-2:
872 # - match: '{{filename}}'
873 # scope: meta.string.nu string.unquoted.nu
874 # set: maybe-movefile-parameter-3
875 # - include: else-pop
876 # - include: eol-pop
877
878 # maybe-movefile-parameter-3:
879 # - match: f\b
880 # scope: meta.string.nu support.constant.nu
881 # pop: 1
882 # - include: else-pop
883 # - include: eol-pop
884
885 # maybe-opengl-parameter:
886 # - match: (?:info|software|hardware|hardwarebasic)\b
887 # scope: meta.string.nu support.constant.nu
888 # pop: 1
889 # - include: else-pop
890 # - include: eol-pop
891
892 # maybe-rmdir-parameter:
893 # - match: '{{filename}}'
894 # scope: meta.string.nu string.unquoted.nu
895 # set: maybe-rmdir-parameter-2
896 # - include: else-pop
897 # - include: eol-pop
898
899 # maybe-rmdir-parameter-2:
900 # - match: s\b
901 # scope: meta.string.nu support.constant.nu
902 # pop: 1
903 # - include: else-pop
904 # - include: eol-pop
905
906 # maybe-who-parameter:
907 # - match: global\b
908 # scope: meta.string.nu support.constant.nu
909 # pop: 1
910 # - include: else-pop
911 # - include: eol-pop
912
913 # Parentheses are usually omitted when functions are used without parameters.
914 # This command syntax is also possible for functions if all parameters are character arrays.
915 # Only the function names are matched here to allow both command syntax and function syntax form.
916 # https://www.mathworks.com/help/matlab/matlab_prog/command-vs-function-syntax.html
917 builtin-functions:
918 - match: \b{{nushell_functions}}\b
919 scope: meta.function-call.nu support.function.builtin.nu
920
921 custom-functions:
922 - match: \b{{custom_functions}}\b
923 scope: support.function.custom.nu
924
925 plugin-functions:
926 - match: \b{{plugin_functions}}\b
927 scope: support.function.plugin.nu
928
929 nushell-keywords:
930 - match: \b{{nushell_keywords}}\b
931 scope: support.function.keywords.nu
932
933 nushell-aliases:
934 - match: \b{{nushell_aliases}}\b
935 scope: support.function.aliases.nu
936
937 nushell-personal:
938 - match: \b{{nushell_personal}}\b
939 scope: support.function.personal.nu
940
941 nushell-operators:
942 - match: \b{{nushell_operators}}\b
943 scope: support.function.operators.nu
944
945 boolean-operators:
946 - match: \b{{boolean_operators}}\b
947 scope: support.function.boolean.nu
948
949 ###[ BUILTIN PACKAGES AND OBJECT FUNCTIONS ]####################################
950
951 # builtin-packages:
952 # - match: \bcdflib\b
953 # scope: support.module.builtin.nu
954 # push:
955 # - maybe-cdflib-object-function
956 # - maybe-accessor-dot
957 # - match: \bclibgen\b
958 # scope: support.module.builtin.nu
959 # push:
960 # - maybe-clibgen-object-function
961 # - maybe-accessor-dot
962 # - match: \bH5\b
963 # scope: support.module.builtin.nu
964 # push:
965 # - maybe-h5-object-function
966 # - maybe-accessor-dot
967 # - match: \bH5A\b
968 # scope: support.module.builtin.nu
969 # push:
970 # - maybe-h5a-object-function
971 # - maybe-accessor-dot
972 # - match: \bH5DS\b
973 # scope: support.module.builtin.nu
974 # push:
975 # - maybe-h5ds-object-function
976 # - maybe-accessor-dot
977 # - match: \bH5E\b
978 # scope: support.module.builtin.nu
979 # push:
980 # - maybe-h5e-object-function
981 # - maybe-accessor-dot
982 # - match: \bH5F\b
983 # scope: support.module.builtin.nu
984 # push:
985 # - maybe-h5f-object-function
986 # - maybe-accessor-dot
987 # - match: \bH5G\b
988 # scope: support.module.builtin.nu
989 # push:
990 # - maybe-h5g-object-function
991 # - maybe-accessor-dot
992 # - match: \bH5I\b
993 # scope: support.module.builtin.nu
994 # push:
995 # - maybe-h5i-object-function
996 # - maybe-accessor-dot
997 # - match: \bH5L\b
998 # scope: support.module.builtin.nu
999 # push:
1000 # - maybe-h5l-object-function
1001 # - maybe-accessor-dot
1002 # - match: \bH5ML\b
1003 # scope: support.module.builtin.nu
1004 # push:
1005 # - maybe-h5ml-object-function
1006 # - maybe-accessor-dot
1007 # - match: \bH5O\b
1008 # scope: support.module.builtin.nu
1009 # push:
1010 # - maybe-h5o-object-function
1011 # - maybe-accessor-dot
1012 # - match: \bH5P\b
1013 # scope: support.module.builtin.nu
1014 # push:
1015 # - maybe-h5p-object-function
1016 # - maybe-accessor-dot
1017 # - match: \bH5R\b
1018 # scope: support.module.builtin.nu
1019 # push:
1020 # - maybe-h5r-object-function
1021 # - maybe-accessor-dot
1022 # - match: \bH5S\b
1023 # scope: support.module.builtin.nu
1024 # push:
1025 # - maybe-h5s-object-function
1026 # - maybe-accessor-dot
1027 # - match: \bH5T\b
1028 # scope: support.module.builtin.nu
1029 # push:
1030 # - maybe-h5t-object-function
1031 # - maybe-accessor-dot
1032 # - match: \bH5Z\b
1033 # scope: support.module.builtin.nu
1034 # push:
1035 # - maybe-h5z-object-function
1036 # - maybe-accessor-dot
1037 # - match: \bMException\b
1038 # scope: support.module.builtin.nu
1039 # push:
1040 # - maybe-mexception-object-function
1041 # - maybe-accessor-dot
1042 # - match: \bNET\b
1043 # scope: support.module.builtin.nu
1044 # push:
1045 # - maybe-net-object-function
1046 # - maybe-accessor-dot
1047 # - match: \bnetcdf\b
1048 # scope: support.module.builtin.nu
1049 # push:
1050 # - maybe-netcdf-object-function
1051 # - maybe-accessor-dot
1052 # - match: \bRandStream\b
1053 # scope: support.module.builtin.nu
1054 # push:
1055 # - maybe-randstream-object-function
1056 # - maybe-accessor-dot
1057 # - match: \bTiff\b
1058 # scope: support.module.builtin.nu
1059 # push:
1060 # - maybe-tiff-object-function
1061 # - maybe-accessor-dot
1062
1063 # maybe-accessor-dot:
1064 # - match: \.\'
1065 # scope: keyword.operator.transpose.nu
1066 # pop: 2
1067 # - match: \.(?!\*|/|\\|\^)
1068 # scope: punctuation.accessor.dot.nu
1069 # pop: 1
1070 # - match: ''
1071 # pop: 2
1072
1073 # maybe-cdflib-object-function:
1074 # - match: '{{cdflib_object_functions}}\b'
1075 # scope: meta.function-call.nu support.function.nu
1076 # pop: 1
1077 # - match: '{{identifier}}?'
1078 # scope: variable.other.nu
1079 # pop: 1
1080
1081 # maybe-clibgen-object-function:
1082 # - match: '{{clibgen_object_functions}}\b'
1083 # scope: meta.function-call.nu support.function.nu
1084 # pop: 1
1085 # - match: '{{identifier}}?'
1086 # scope: variable.other.nu
1087 # pop: 1
1088
1089 # maybe-h5-object-function:
1090 # - match: '{{H5_object_functions}}\b'
1091 # scope: meta.function-call.nu support.function.nu
1092 # pop: 1
1093 # - match: '{{identifier}}?'
1094 # scope: variable.other.nu
1095 # pop: 1
1096
1097 # maybe-h5a-object-function:
1098 # - match: '{{H5A_object_functions}}\b'
1099 # scope: meta.function-call.nu support.function.nu
1100 # pop: 1
1101 # - match: '{{identifier}}?'
1102 # scope: variable.other.nu
1103 # pop: 1
1104
1105 # maybe-h5ds-object-function:
1106 # - match: '{{H5DS_object_functions}}\b'
1107 # scope: meta.function-call.nu support.function.nu
1108 # pop: 1
1109 # - match: '{{identifier}}?'
1110 # scope: variable.other.nu
1111 # pop: 1
1112
1113 # maybe-h5e-object-function:
1114 # - match: '{{H5E_object_functions}}\b'
1115 # scope: meta.function-call.nu support.function.nu
1116 # pop: 1
1117 # - match: '{{identifier}}?'
1118 # scope: variable.other.nu
1119 # pop: 1
1120
1121 # maybe-h5f-object-function:
1122 # - match: '{{H5F_object_functions}}\b'
1123 # scope: meta.function-call.nu support.function.nu
1124 # pop: 1
1125 # - match: '{{identifier}}?'
1126 # scope: variable.other.nu
1127 # pop: 1
1128
1129 # maybe-h5g-object-function:
1130 # - match: '{{H5G_object_functions}}\b'
1131 # scope: meta.function-call.nu support.function.nu
1132 # pop: 1
1133 # - match: '{{identifier}}?'
1134 # scope: variable.other.nu
1135 # pop: 1
1136
1137 # maybe-h5i-object-function:
1138 # - match: '{{H5I_object_functions}}\b'
1139 # scope: meta.function-call.nu support.function.nu
1140 # pop: 1
1141 # - match: '{{identifier}}?'
1142 # scope: variable.other.nu
1143 # pop: 1
1144
1145 # maybe-h5l-object-function:
1146 # - match: '{{H5L_object_functions}}\b'
1147 # scope: meta.function-call.nu support.function.nu
1148 # pop: 1
1149 # - match: '{{identifier}}?'
1150 # scope: variable.other.nu
1151 # pop: 1
1152
1153 # maybe-h5ml-object-function:
1154 # - match: '{{H5ML_object_functions}}\b'
1155 # scope: meta.function-call.nu support.function.nu
1156 # pop: 1
1157 # - match: '{{identifier}}?'
1158 # scope: variable.other.nu
1159 # pop: 1
1160
1161 # maybe-h5o-object-function:
1162 # - match: '{{H5O_object_functions}}\b'
1163 # scope: meta.function-call.nu support.function.nu
1164 # pop: 1
1165 # - match: '{{identifier}}?'
1166 # scope: variable.other.nu
1167 # pop: 1
1168
1169 # maybe-h5p-object-function:
1170 # - match: '{{H5P_object_functions}}\b'
1171 # scope: meta.function-call.nu support.function.nu
1172 # pop: 1
1173 # - match: '{{identifier}}?'
1174 # scope: variable.other.nu
1175 # pop: 1
1176
1177 # maybe-h5r-object-function:
1178 # - match: '{{H5R_object_functions}}\b'
1179 # scope: meta.function-call.nu support.function.nu
1180 # pop: 1
1181 # - match: '{{identifier}}?'
1182 # scope: variable.other.nu
1183 # pop: 1
1184
1185 # maybe-h5s-object-function:
1186 # - match: '{{H5S_object_functions}}\b'
1187 # scope: meta.function-call.nu support.function.nu
1188 # pop: 1
1189 # - match: '{{identifier}}?'
1190 # scope: variable.other.nu
1191 # pop: 1
1192
1193 # maybe-h5t-object-function:
1194 # - match: '{{H5T_object_functions}}\b'
1195 # scope: meta.function-call.nu support.function.nu
1196 # pop: 1
1197 # - match: '{{identifier}}?'
1198 # scope: variable.other.nu
1199 # pop: 1
1200
1201 # maybe-h5z-object-function:
1202 # - match: '{{H5Z_object_functions}}\b'
1203 # scope: meta.function-call.nu support.function.nu
1204 # pop: 1
1205 # - match: '{{identifier}}?'
1206 # scope: variable.other.nu
1207 # pop: 1
1208
1209 # maybe-mexception-object-function:
1210 # - match: last\b
1211 # scope: meta.function-call.nu support.function.nu
1212 # pop: 1
1213 # - match: '{{identifier}}?'
1214 # scope: variable.other.nu
1215 # pop: 1
1216
1217 # maybe-net-object-function:
1218 # - match: '{{NET_object_functions}}\b'
1219 # scope: meta.function-call.nu support.function.nu
1220 # pop: 1
1221 # - match: '{{identifier}}?'
1222 # scope: variable.other.nu
1223 # pop: 1
1224
1225 # maybe-netcdf-object-function:
1226 # - match: '{{netcdf_object_functions}}\b'
1227 # scope: meta.function-call.nu support.function.nu
1228 # pop: 1
1229 # - match: '{{identifier}}?'
1230 # scope: variable.other.nu
1231 # pop: 1
1232
1233 # maybe-randstream-object-function:
1234 # - match: '{{RandStream_object_functions}}\b'
1235 # scope: meta.function-call.nu support.function.nu
1236 # pop: 1
1237 # - match: '{{identifier}}?'
1238 # scope: variable.other.nu
1239 # pop: 1
1240
1241 # maybe-tiff-object-function:
1242 # - match: '{{Tiff_object_functions}}\b'
1243 # scope: meta.function-call.nu support.function.nu
1244 # pop: 1
1245 # - match: '{{identifier}}?'
1246 # scope: variable.other.nu
1247 # pop: 1
1248
1249 ###[ INVALID ]##################################################################
1250
1251 invalid-variables:
1252 # No variables or function names can start with a number or an underscore.
1253 - match: '\b(_\w|\d+[_a-df-zA-DF-Z])\w*\b'
1254 scope: invalid.illegal.invalid-variable-name.nu