This repository has been archived on 2026-09-17. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
nixos-config/hosts/globalServices/zsh.nix
pijukka 336aabd3ab zsh: move yazi's cd-on-quit wrapper to global config, drop tnix duplicate
y() now lives in hosts/globalServices/zsh.nix via programs.zsh.interactiveShellInit,
so it works on every host (previously only tnix had it, via home-manager,
and pinix's plain package had no cd-on-quit wrapper at all). yazi package
moved from pinix-local to global packages.nix for the same reason.

Dropped from home/tnix/localModules/zsh.nix as now-redundant: the local
yazi() function (same wrapper, bound to the wrong name and shadowed by
the global one anyway), the `y = "yazi"` alias (would have shadowed the
new global function), and a dead HYPRLAND_INSTANCE_SIGNATURE export
left over from the sway migration -- nothing in the repo references it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 17:36:54 +02:00

29 lines
700 B
Nix

{
programs.zsh = {
enable = true;
# `y` opens yazi and, on quit, cd's the shell to wherever yazi ended
# up -- yazi itself can't change its parent shell's directory, so it
# writes the last dir to --cwd-file for the wrapper to pick up.
interactiveShellInit = ''
y() {
local tmp="$(mktemp)"
command yazi --cwd-file="$tmp" "$@"
if [ -f "$tmp" ]; then
local dir="$(cat "$tmp")"
rm -f "$tmp"
[ -d "$dir" ] && [ "$dir" != "$PWD" ] && cd "$dir"
fi
}
'';
};
environment.shellAliases = {
la = "ls -la";
v = "nvim";
".." = "cd ..";
"..." = "cd ../..";
"s" = "systemctl";
};
}