Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/nu/injections.scm')
-rw-r--r--runtime/queries/nu/injections.scm49
1 files changed, 46 insertions, 3 deletions
diff --git a/runtime/queries/nu/injections.scm b/runtime/queries/nu/injections.scm
index 690ff9a8..8005ffdc 100644
--- a/runtime/queries/nu/injections.scm
+++ b/runtime/queries/nu/injections.scm
@@ -1,7 +1,50 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
+
+(command
+ head: ((cmd_identifier) @_cmd
+ (#match? @_cmd "^\\s*(find|parse|split|str)$"))
+ flag: (_
+ name: (_) @_flag
+ (#any-of? @_flag "r" "regex"))
+ .
+ arg: (_
+ (string_content) @injection.content
+ (#set! injection.language "regex")))
+
+(_
+ opr: [
+ "=~"
+ "!~"
+ "like"
+ "not-like"
+ ]
+ rhs: (_
+ (string_content) @injection.content
+ (#set! injection.language "regex")))
+
+(command
+ head: (_) @_cmd
+ (#any-of? @_cmd "nu" "$nu.current-exe")
+ flag: (_
+ name: (_) @_flag
+ (#any-of? @_flag "c" "e" "commands" "execute"))
+ .
+ arg: (_
+ (string_content) @injection.content
+ (#set! injection.language "nu")))
(command
head: (cmd_identifier) @_command (#any-of? @_command "jq" "jaq")
- arg: (val_string) @injection.content
- (#set! injection.language "jq"))
+ .
+ arg: (_ (string_content) @injection.content)
+ (#set! injection.language "jq")
+)
+
+(command
+ head: (cmd_identifier) @_command (#eq? @_command "fish")
+ flag: (short_flag "-") @_flag (#match? @_flag "^-.*c$")
+ .
+ arg: (_ (string_content) @injection.content)
+ (#set! injection.language "fish")
+)