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

Better Nushell integration for Zoxide #6319

Open
SrEstegosaurio opened this issue Jan 15, 2025 · 0 comments
Open

Better Nushell integration for Zoxide #6319

SrEstegosaurio opened this issue Jan 15, 2025 · 0 comments
Assignees

Comments

@SrEstegosaurio
Copy link

Description

The Nushell Cookbook provides a better snippet for custom zoxide completions.

It might be interesting to set it up via programs.zoxide.enableNushellIntegration.

Due to lack of experience with Nu and a slightly convoluted setup I don't know how to approach this problem myself.

Idea?

Speaking from ignorance, it might be possible to wire up some logic that dynamically adds custom external completions to Nushell based on programs enableNushellIntegration when relevant .

Implementation Idea

In the case of Zoxide, taking the code from the Cookbook:

If programs.zoxide.enableNushellIntegration = true; then add the following lines to the completions function:

    __zoxide_z => $zoxide_completer
    __zoxide_zi => $zoxide_completer

Resulting in an hypothetical multiple_completers like:

let multiple_completers = {|spans|
    match $spans.0 {
        ls => $ls_completer
        git => $git_completer
       __zoxide_z => $zoxide_completer
       __zoxide_zi => $zoxide_completer
        _ => $default_completer
    } | do $in $spans
}
Pros
  • Provides a better out of the box experience in terms of integration.
  • Makes configuration possible without leaving Nix.
Cons
  • The complexity of implementation. (?)
  • All current Nushell integrations would need to be revised.
  • At least a subset of them would need changes.
  • Sounds dangerously close to having a configuration framework... 👀

Thanks for your time. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants