1
Fork 0
mirror of https://github.com/thegeneralist01/config.git synced 2026-03-10 02:30:29 +01:00

shell: fix zoxide cd

This commit is contained in:
TheGeneralist 2026-01-30 14:47:24 +01:00
parent 65ad4a6d6b
commit b5d2518afd
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -1,15 +1,19 @@
{ lib, pkgs, ... }: let
{ lib, pkgs, ... }:
let
inherit (lib) getExe;
zoxide = getExe pkgs.zoxide;
in {
home-manager.sharedModules = [{
in
{
home-manager.sharedModules = [
{
programs.zoxide = {
enable = true;
options = [ "--cmd cd" ];
enableNushellIntegration = false;
};
programs.nushell.extraConfig = /* nu */ ''
programs.nushell.extraConfig = # nu
''
# Zoxide integration with full path
$env.config = ($env.config? | default {})
$env.config.hooks = ($env.config.hooks? | default {})
@ -29,6 +33,8 @@ in {
$env.HOME
} else if ($rest | length) == 1 and ($rest.0 == "-") {
$env.OLDPWD
} else if ($rest | length) == 1 and (($rest.0 | path expand) | path exists) {
$rest.0
} else {
${zoxide} query --exclude (pwd) -- ...$rest | str trim -r -c (char newline)
}
@ -43,5 +49,6 @@ in {
alias cd = __zoxide_z
alias cdi = __zoxide_zi
'';
}];
}
];
}