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:
parent
65ad4a6d6b
commit
b5d2518afd
1 changed files with 46 additions and 39 deletions
|
|
@ -1,15 +1,19 @@
|
||||||
{ lib, pkgs, ... }: let
|
{ lib, pkgs, ... }:
|
||||||
|
let
|
||||||
inherit (lib) getExe;
|
inherit (lib) getExe;
|
||||||
zoxide = getExe pkgs.zoxide;
|
zoxide = getExe pkgs.zoxide;
|
||||||
in {
|
in
|
||||||
home-manager.sharedModules = [{
|
{
|
||||||
|
home-manager.sharedModules = [
|
||||||
|
{
|
||||||
programs.zoxide = {
|
programs.zoxide = {
|
||||||
enable = true;
|
enable = true;
|
||||||
options = [ "--cmd cd" ];
|
options = [ "--cmd cd" ];
|
||||||
enableNushellIntegration = false;
|
enableNushellIntegration = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.nushell.extraConfig = /* nu */ ''
|
programs.nushell.extraConfig = # nu
|
||||||
|
''
|
||||||
# Zoxide integration with full path
|
# Zoxide integration with full path
|
||||||
$env.config = ($env.config? | default {})
|
$env.config = ($env.config? | default {})
|
||||||
$env.config.hooks = ($env.config.hooks? | default {})
|
$env.config.hooks = ($env.config.hooks? | default {})
|
||||||
|
|
@ -29,6 +33,8 @@ in {
|
||||||
$env.HOME
|
$env.HOME
|
||||||
} else if ($rest | length) == 1 and ($rest.0 == "-") {
|
} else if ($rest | length) == 1 and ($rest.0 == "-") {
|
||||||
$env.OLDPWD
|
$env.OLDPWD
|
||||||
|
} else if ($rest | length) == 1 and (($rest.0 | path expand) | path exists) {
|
||||||
|
$rest.0
|
||||||
} else {
|
} else {
|
||||||
${zoxide} query --exclude (pwd) -- ...$rest | str trim -r -c (char newline)
|
${zoxide} query --exclude (pwd) -- ...$rest | str trim -r -c (char newline)
|
||||||
}
|
}
|
||||||
|
|
@ -43,5 +49,6 @@ in {
|
||||||
alias cd = __zoxide_z
|
alias cd = __zoxide_z
|
||||||
alias cdi = __zoxide_zi
|
alias cdi = __zoxide_zi
|
||||||
'';
|
'';
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue