diff --git a/home-manager/shared/default.nix b/home-manager/shared/default.nix index 9bac4a0..799caca 100644 --- a/home-manager/shared/default.nix +++ b/home-manager/shared/default.nix @@ -34,6 +34,7 @@ broot lazygit navi + yazi ]; programs.navi.enable = true; } diff --git a/home-manager/shared/shell/helix/default.nix b/home-manager/shared/shell/helix/default.nix index 1222c51..76304ef 100644 --- a/home-manager/shared/shell/helix/default.nix +++ b/home-manager/shared/shell/helix/default.nix @@ -3,7 +3,20 @@ lib, pkgs, ... -}: { +}: let + yazi = + pkgs.writeText "open_in_helix_from_yazi.zsh" + '' + #! ~/.nix-profile/bin/zsh + files=(''${(fqq)"$( yazi --chooser-file=/dev/stdout | cat )"}) + zellij action toggle-floating-panes + zellij action write 27 # send escape-key + zellij action write-chars ":open $files" + zellij action write 13 # send enter-key + zellij action toggle-floating-panes + zellij action close-pane + ''; +in { programs.helix = { enable = true; defaultEditor = true; @@ -11,11 +24,11 @@ settings = { # theme = "catppuccin_macchiato"; # Don't need this because the module themes it for us keys.normal.backspace = { - b = ":run-shell-command zellij run -f -- direnv exec . just build"; - r = ":run-shell-command zellij run -f -- direnv exec . just run"; - t = ":run-shell-command zellij run -f -- direnv exec . just test"; - g = ":run-shell-command zellij run -fc -- lazygit"; - f = ":run-shell-command zellij run -fc -- broot"; + b = ":sh zellij run -f -n 'build code' -- direnv exec . just build"; + r = ":sh zellij run -f -n 'run code' -- direnv exec . just run"; + t = ":sh zellij run -f -n 'test code' -- direnv exec . just test"; + g = ":sh zellij run -fc -n 'lazygit' -- lazygit"; + f = ":sh zellij run --floating -n 'yazi picker' -- zsh ~/.config/helix/open_in_helix_from_yazi.zsh "; }; editor = { line-number = "relative"; @@ -165,4 +178,11 @@ target = ".config/helix/external-snippets.toml"; }; }; + + home.file = { + "yazi" = { + source = "${yazi}"; + target = ".config/helix/open_in_helix_from_yazi.zsh"; + }; + }; } diff --git a/home-manager/shared/shell/zsh.nix b/home-manager/shared/shell/zsh.nix index 55878f2..a3108ff 100644 --- a/home-manager/shared/shell/zsh.nix +++ b/home-manager/shared/shell/zsh.nix @@ -67,7 +67,7 @@ "zsh-navigation-tools" ]; }; - # stuff for zoxide & tre + # Extra commands that take more complex forms initExtra = '' eval "$(zoxide init --cmd cd zsh)" tre() { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; }