Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add nushell completion for __zoxide_z#1129

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Juhan280 wants to merge1 commit intoajeetdsouza:main
base:main
Choose a base branch
Loading
fromJuhan280:nushell_completion

Conversation

@Juhan280
Copy link

nushell/nushell#15888 added support for completions to replace multiple arguments. This allows us to define a completion which replaces all the keywords with the correct file path upon accepting the path.

Also wrapped the whole script into a nushell module to prevent the completion command from polluting the command namespace. (That's why (the indentation) the diff is so messy, sorry)

WindSoilder reacted with thumbs up emojiWindSoilder, ysthakur, and ankddev reacted with heart emoji
Copy link

@ysthakurysthakur left a comment

Choose a reason for hiding this comment

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

Random Nushell user here. Thanks for this! I have some minor comments

def "nu-complete __zoxide_z" [context: string] {
let ast = ast --flatten $context | skip 1

# If the user has typed a space after the first argument, use the custom

Choose a reason for hiding this comment

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

I don't think$ast will be nonempty only if you add a space after the first argument.ast -f "z foo" (no space afterfoo) is still a length 2 list.

Suggested change
# If the user hastyped a space after the first argument, use the custom
# If the user hasentered an argument, use the custom

Copy link
Author

@Juhan280Juhan280Nov 13, 2025
edited
Loading

Choose a reason for hiding this comment

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

If you look at the next few lines, I compare the output ofast with the length of the$context, thats how I tell if there is an extra space after the first arg or not.

if$ast.0.span.end>= ($context| str length) {return null }

#
{{ section }}
# Completion for __zoxide_z
#
Copy link

@ysthakurysthakurNov 13, 2025
edited
Loading

Choose a reason for hiding this comment

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

What's this for? The extra# and the blank line below, I mean.

Copy link
Author

Choose a reason for hiding this comment

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

To match the formating of other section headers in the file

  {{ section }}# Hook configuration for zoxide.#
  {{ section }}# When using zoxide with --no-cmd, alias these internal functions as desired.#

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@ysthakurysthakurysthakur left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Juhan280@ysthakur

[8]ページ先頭

©2009-2025 Movatter.jp