Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yazi: improve fish integration #6320

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

iSma
Copy link
Contributor

@iSma iSma commented Jan 15, 2025

Description

Improve yazi fish integration:

Calls yazi as command yazi, allowing to use "yazi" as shellWrapperName without infinite recursion. This could be backward-incompatible for users who have an alias named "yazi" and expect this shell wrapper to call that alias instead of the yazi executable directly.

Also defines the wrapper with programs.fish.functions instead of interactiveShellInit, which seems to be the preferred way.

Checklist

  • Change is backwards compatible. (with one exception, see above)

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

@XYenon @eljamm

@eljamm
Copy link
Contributor

eljamm commented Jan 16, 2025

This could be backward-incompatible for users who have an alias named "yazi" and expect this shell wrapper to call that alias instead of the yazi executable directly.

Could you explain this, perhaps? To me, it seems that we're doing the same thing: creating a function for the integration, but now we're storing it in functions instead of including it directly in the config.

@iSma iSma force-pushed the fix/yazi-fish-integration branch from 63e050a to b9b98c0 Compare January 16, 2025 07:24
@iSma
Copy link
Contributor Author

iSma commented Jan 16, 2025

This could be backward-incompatible for users who have an alias named "yazi" and expect this shell wrapper to call that alias instead of the yazi executable directly.

Could you explain this, perhaps? To me, it seems that we're doing the same thing: creating a function for the integration, but now we're storing it in functions instead of including it directly in the config.

Yes, that part doesn't change; the end result is that we create a function named $shellWrapperName.

The difference I was pointing to is the way yazi is called from within this function: I've changed it to command yazi which calls executable directly and ignores potential shell aliases named "yazi". Previously, a user could potentially define alias yazi=yazi --some-options and the wrapper would call this alias.

I don't think the old behavior is particularly useful, since users can (and probably should) set their options directly in the settings. But I still wanted to point it out for the sake of completeness.

@eljamm
Copy link
Contributor

eljamm commented Jan 16, 2025

The difference I was pointing to is the way yazi is called from within this function: I've changed it to command yazi which calls executable directly and ignores potential shell aliases named "yazi".

Ah, I see. I missed that, somehow.

Since this might be a breaking change, do you think it's better if we write something in the news file, like this perhaps:

{
time = "2024-06-26T07:07:17+00:00";
condition = with config.programs.yazi;
enable && (enableBashIntegration || enableZshIntegration
|| enableFishIntegration || enableNushellIntegration);
message = ''
Yazi's shell integration wrappers have been renamed from 'ya' to 'yy'.
A new option `programs.yazi.shellWrapperName` is also available that
allows you to override this name.
'';
}

But just for fish integration users.

@iSma iSma force-pushed the fix/yazi-fish-integration branch 2 times, most recently from f710af2 to cc93434 Compare January 16, 2025 18:18
@iSma
Copy link
Contributor Author

iSma commented Jan 16, 2025

The difference I was pointing to is the way yazi is called from within this function: I've changed it to command yazi which calls executable directly and ignores potential shell aliases named "yazi".

Ah, I see. I missed that, somehow.

Since this might be a breaking change, do you think it's better if we write something in the news file, like this perhaps:

{
time = "2024-06-26T07:07:17+00:00";
condition = with config.programs.yazi;
enable && (enableBashIntegration || enableZshIntegration
|| enableFishIntegration || enableNushellIntegration);
message = ''
Yazi's shell integration wrappers have been renamed from 'ya' to 'yy'.
A new option `programs.yazi.shellWrapperName` is also available that
allows you to override this name.
'';
}

But just for fish integration users.

Yes to be on the safe side I added a news entry.

@iSma iSma force-pushed the fix/yazi-fish-integration branch from cc93434 to 0483361 Compare January 16, 2025 18:20
Copy link
Contributor

@eljamm eljamm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me.

Calls yazi as `command yazi`, allowing to use "yazi" as
`shellWrapperName`. Also defines the wrapper with
`programs.fish.functions` instead of `interactiveShellInit`.
@rycee rycee force-pushed the fix/yazi-fish-integration branch from 0483361 to 4481a16 Compare January 21, 2025 17:29
@rycee rycee merged commit 4481a16 into nix-community:master Jan 21, 2025
3 checks passed
@rycee
Copy link
Member

rycee commented Jan 21, 2025

Thanks! Merged to master now 🙂

@iSma iSma deleted the fix/yazi-fish-integration branch January 22, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants