Skip to content

Provide completions for Nushell #1064

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ysthakur
Copy link

@ysthakur ysthakur commented May 24, 2025

This PR provides completions for z and zi. Nushell no longer uses external completers for internal commands since v0.103 (release notes), so people's old external Zoxide completers won't work anymore.

This completer uses the options completion_algorithm: "prefix", positional: false. positional was deprecated in 0.104 in favor of completion_algorithm: "substring". However, I chose not to use the substring algorithm because it won't work in older versions of Nushell. Also, this completer will probably end up being updated in a few Nushell releases anyway (some improvements to Nushell's completers are planned).

This completer also looks a little weird if you type in multiple arguments. If you type in z /foo bar<TAB>, all the completions you see will have everything up to and including the first /foo stripped. It's not great, but it's needed because custom completers in Nushell can't currently choose which span they want to replace. Without it, if your first result upon typing z /foo bar<TAB> were /foo/bar, hitting Enter would replace your command line with z /foo /foo/bar, which is incorrect.

asciicast

@ysthakur
Copy link
Author

@ajeetdsouza Could you take a look at this?

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.

1 participant