added yazi as a fancy file picker to helix with a simple backspace + f command :)

This commit is contained in:
Lillian Violet 2024-10-18 17:43:10 +02:00
parent 7b8d516b6a
commit cb87a12ad2
3 changed files with 28 additions and 7 deletions

View file

@ -34,6 +34,7 @@
broot
lazygit
navi
yazi
];
programs.navi.enable = true;
}

View file

@ -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";
};
};
}

View file

@ -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; }