summaryrefslogtreecommitdiff
path: root/.config/nushell
diff options
context:
space:
mode:
authorWriterV2 <primary-v2@protonmail.com>2026-10-04 13:34:34 +0200
committerWriterV2 <primary-v2@protonmail.com>2026-10-04 13:34:34 +0200
commitb9c2191d25ac50c1b71d17dab1eec8cc3d9433cb (patch)
treecb41d0ef43c1c008f9e543fc000d6c7fa8b6ef49 /.config/nushell
parent7f036a51567cc1fe857bc7c162b5d863efeb3a41 (diff)
Nushell: Update fish completer config to replace deprecated `spans` with `$place.command`
Diffstat (limited to '.config/nushell')
-rw-r--r--.config/nushell/config.nu12
1 files changed, 10 insertions, 2 deletions
diff --git a/.config/nushell/config.nu b/.config/nushell/config.nu
index 0955ef7..3461d15 100644
--- a/.config/nushell/config.nu
+++ b/.config/nushell/config.nu
@@ -1,7 +1,15 @@
-let completer = {|spans|
- fish --command $'complete "--do-complete=($spans | str join " ")"'
+let completer = {|place|
+ fish --command $"complete '--do-complete=($place.command | str replace --all "'" "\\'" | str join ' ')'"
| from tsv --flexible --noheaders --no-infer
| rename value description
+ | update value {|row|
+ let value = $row.value
+ let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any {$in in $value}
+ if ($need_quote and ($value | path exists)) {
+ let expanded_path = if ($value starts-with '~') {$value | path expand --no-symlink} else {$value}
+ $'"($expanded_path | str replace --all "\"" "\\\"")"'
+ } else {$value}
+ }
}
let dark_theme = {