From 2ffb0ba65b6330bb04d1146f26bc0cf263a1b7fd Mon Sep 17 00:00:00 2001 From: cspark Date: Wed, 20 Nov 2024 02:55:24 +0000 Subject: [PATCH] Implement zoxide integration with neovim, override cd with zoxide as new cd command --- global-home.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/global-home.nix b/global-home.nix index be4b79b8..e32e7001 100644 --- a/global-home.nix +++ b/global-home.nix @@ -59,6 +59,14 @@ else builtin cd "''${HOME}" && printf "\033]7;file://''${PWD}\033\\" fi '') + # Version for zoxide + (pkgs.writeShellScriptBin "z-nvim" '' +if [ "$1" ]; then + z-builtin "''${1}" && printf "\033]7;file://''${PWD}\033\\" +else + z-builtin "''${HOME}" && printf "\033]7;file://''${PWD}\033\\" +fi + '') # wineWowPackages.full # native wayland support (unstable) @@ -307,13 +315,18 @@ fi # bashrcExtra = "fastfetch"; initExtra = '' . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + eval "$(zoxide init bash --cmd z-builtin)" # Initialise zoxide as terminal command z-builtin ([[ -z $(tty) ]] && nvim +terminal) || fastfetch ''; shellAliases = { sudo = "sudo "; doas = "doas "; edit = "$EDITOR"; - cd = "source cd-nvim"; + + # Override the default cd and z (zoxide) terminal commands to ensure to add our custom hooks onto it for neovim integration + #cd = "source cd-nvim"; + z = "source z-nvim"; + cd = "source z-nvim"; # Now will use z (zoxide) as the default cd command instead }; };