Provide completions for Nushell #1064
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides completions for
z
andzi
. 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 option
completion_algorithm: "substring"
, which was only added in 0.104. An alternative would be to usecompletion_algorithm: "prefix", positional: false
, which works in older versions but is deprecated.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 typingz /foo bar<TAB>
were/foo/bar
, hitting Enter would replace your command line withz /foo /foo/bar
, which is incorrect.