diff --git a/modules/nushell/configuration.nix.nu b/modules/nushell/configuration.nix.nu index 8a71076..3db54a6 100644 --- a/modules/nushell/configuration.nix.nu +++ b/modules/nushell/configuration.nix.nu @@ -137,9 +137,9 @@ $env.config.completions = { enable: true max_results: 100 completer: {|tokens: list| - mut expanded = scope aliases | where name == $tokens.0 | get --ignore-errors expansion.0 + let expanded = scope aliases | where name == $tokens.0 | get --ignore-errors expansion.0 - mut expanded = if $expanded != null { + let expanded = if $expanded != null and $expanded.0 != "cd" { $expanded | split row " " | append ($tokens | skip 1) } else { $tokens @@ -147,7 +147,7 @@ $env.config.completions = { $expanded.0 = ($expanded.0 | str trim --left --char "^") - fish --command $'complete (char sq)--do-complete=($expanded | str join " ")(char sq)' + fish --command $"complete '--do-complete=($expanded | str join ' ')'" | $"value(char tab)description(char newline)" + $in | from tsv --flexible --no-infer } @@ -410,4 +410,6 @@ $env.config.keybindings = [ event: { send: enter } } ] + +source ~/.config/nushell/zoxide.nu '' diff --git a/modules/nushell/default.nix b/modules/nushell/default.nix index c7cbd06..e2e542a 100644 --- a/modules/nushell/default.nix +++ b/modules/nushell/default.nix @@ -44,5 +44,6 @@ }) (systemPackages (with pkgs; [ - fish # For completions. + fish # For completions. + zoxide # For completions and better cd. ])) diff --git a/modules/nushell/environment.nix.nu b/modules/nushell/environment.nix.nu index 2ddbcbc..11b5cc3 100644 --- a/modules/nushell/environment.nix.nu +++ b/modules/nushell/environment.nix.nu @@ -15,4 +15,5 @@ def --env mc [path: path] { } use ${upkgs.nuScripts}/modules/background_task/task.nu +zoxide init nushell --cmd cd | save --force ~/.config/nushell/zoxide.nu ''