mirror of
https://github.com/nix-community/home-manager
synced 2025-01-22 17:09:52 +01:00
yazi: improve fish integration
Calls yazi as `command yazi`, allowing to use "yazi" as `shellWrapperName`. Also defines the wrapper with `programs.fish.functions` instead of `interactiveShellInit`.
This commit is contained in:
parent
96dee79b17
commit
4481a16d1a
4 changed files with 32 additions and 22 deletions
|
@ -1960,6 +1960,19 @@ in {
|
|||
as well as wf-shell.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2025-01-21T17:28:13+00:00";
|
||||
condition = with config.programs.yazi; enable && enableFishIntegration;
|
||||
message = ''
|
||||
Yazi's fish shell integration wrapper now calls the 'yazi' executable
|
||||
directly, ignoring any shell aliases with the same name.
|
||||
|
||||
Your configuration may break if you rely on the wrapper calling a
|
||||
'yazi' alias.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,12 @@ let
|
|||
'';
|
||||
|
||||
fishIntegration = ''
|
||||
function ${cfg.shellWrapperName}
|
||||
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||
yazi $argv --cwd-file="$tmp"
|
||||
set -l tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||
command yazi $argv --cwd-file="$tmp"
|
||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||
builtin cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
end
|
||||
'';
|
||||
|
||||
nushellIntegration = ''
|
||||
|
@ -202,7 +200,7 @@ in {
|
|||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration bashIntegration;
|
||||
|
||||
programs.fish.interactiveShellInit =
|
||||
programs.fish.functions.${cfg.shellWrapperName} =
|
||||
mkIf cfg.enableFishIntegration fishIntegration;
|
||||
|
||||
programs.nushell.extraConfig =
|
||||
|
|
|
@ -1,27 +1,18 @@
|
|||
{ ... }:
|
||||
{ config, ... }:
|
||||
|
||||
let
|
||||
shellIntegration = ''
|
||||
function yy
|
||||
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||
yazi $argv --cwd-file="$tmp"
|
||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||
builtin cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
end
|
||||
'';
|
||||
in {
|
||||
{
|
||||
programs.fish.enable = true;
|
||||
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
shellWrapperName = "yy";
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
test.stubs.yazi = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains home-files/.config/fish/config.fish '${shellIntegration}'
|
||||
assertFileContent home-files/.config/fish/functions/${config.programs.yazi.shellWrapperName}.fish \
|
||||
${./fish-integration-expected.fish}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
function yy
|
||||
set -l tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||
command yazi $argv --cwd-file="$tmp"
|
||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||
builtin cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
end
|
Loading…
Reference in a new issue