fix: support git add completion for file name that contains whitespace#1259
Merged
fdncred merged 1 commit intoJun 13, 2026
Merged
Conversation
Contributor
|
Thanks |
Contributor
Author
|
My pleasure. |
DeadBranches
pushed a commit
to deadbranch-forks/nu_scripts
that referenced
this pull request
Jun 17, 2026
nushell#1259) Hi, I recently found that the git add custom completion can not deal with file name that contains whitespace. Therefore I slightly modified "nu-complete git file" to let it support recognizing file name that contains whitespace. Originally, the regex for `<value>` only parses non-whitespace characters by using `\S+`. I changed it to `.+` so that it parses any character until the end of the string. I also added a post process to add surrounding backtick to the path that contains whitespace. I am new to Nushell, so if my implementation has any problem, feel free to point it out. I appreciate any feedback. :) Here are the demoatration videos: Before: https://github.com/user-attachments/assets/251e0945-9a00-4aca-994d-ef0c71b30b70 After: https://github.com/user-attachments/assets/629e933f-97eb-4a7e-864c-a34432716385
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi, I recently found that the git add custom completion can not deal with file name that contains whitespace. Therefore I slightly modified "nu-complete git file" to let it support recognizing file name that contains whitespace.
Originally, the regex for
<value>only parses non-whitespace characters by using\S+. I changed it to.+so that it parses any character until the end of the string.I also added a post process to add surrounding backtick to the path that contains whitespace.
I am new to Nushell, so if my implementation has any problem, feel free to point it out. I appreciate any feedback. :)
Here are the demoatration videos:
Before:
before.mp4
After:
after.mp4