Skip to content

fix: support git add completion for file name that contains whitespace#1259

Merged
fdncred merged 1 commit into
nushell:mainfrom
VioletsOleander:fix-filename/20260613-211425
Jun 13, 2026
Merged

fix: support git add completion for file name that contains whitespace#1259
fdncred merged 1 commit into
nushell:mainfrom
VioletsOleander:fix-filename/20260613-211425

Conversation

@VioletsOleander

@VioletsOleander VioletsOleander commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

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

@VioletsOleander VioletsOleander changed the title fix: support completion for file name that contains whitespace fix: support git add completion for file name that contains whitespace Jun 13, 2026
@fdncred fdncred merged commit afb08cd into nushell:main Jun 13, 2026
1 check passed
@fdncred

fdncred commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Thanks

@VioletsOleander

Copy link
Copy Markdown
Contributor Author

My pleasure.

@VioletsOleander VioletsOleander deleted the fix-filename/20260613-211425 branch June 13, 2026 14:37
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
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.

2 participants