diff options
Diffstat (limited to '.config/nushell')
| -rw-r--r-- | .config/nushell/config.nu | 12 |
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 = { |
