You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to force completion to escape instead of using quotes #11271
Hi.
Since the new release, fish will quote completion with special characters instead of escaping them.
This breaks my workflow because I often use completions to then add a wildcard like * (for instance, to diff two files), but this no longer works because now it is quoted (so the wildcard won't be interpreted).
So, please add an option to always force the completion to escape special characters instead of using quotes.
Also, it seems there might be some incoherent behavior here, for instance:
$ touch'[test] file1'
$ ls<Tab># completes to: ls '[test] file1'
$ touch'[test] file2'
$ ls<Tab><Tab># completes to: ls \[test\]\ file1
Interesting. As demonstrated by your example, backslashes are used when a completion is not unique.
The idea is to allow use cases like yours (for example ls <Tab>* will result in ls \[test\]\ file* if both files exist).
But you mention there's also a scenario where a completion is unique but you still want to add *?
Perhaps to match a file that will be created later?
I'm trying to imagine your scenario. Hopefully we can improve the heuristic. Feels like it wasn't a strictly improvement. Here's a hack to turn it off:
diff --git a/src/reader.rs b/src/reader.rs
index 0808e1bcd1..85b4123856 100644
--- a/src/reader.rs+++ b/src/reader.rs@@ -6148,6 +6148,3 @@ pub fn completion_apply_to_command_line(
- let mut escape_flags = EscapeFlags::empty();- if append_only || trailer.is_none() {- escape_flags.insert(EscapeFlags::NO_QUOTED);- }+ let mut escape_flags = EscapeFlags::NO_QUOTED;
if no_tilde {
But you mention there's also a scenario where a completion is unique but you still want to add *?
No. I do not know how the heuristic works, but there are cases when there are multiple completions, but I want to add *.
I believe it will use \ when doing <Tab><Tab>, but doing te<Tab><Tab> will use quotes.
An example if this isn't clear:
$ touch'[test] file1'
$ touch'[test] file2'
$ ls<Tab><Tab># completes to: ls \[test\]\ file1
$ ls te<Tab><Tab># completes to: ls '[test] file1'
ah I see. Currently we always use quotes if the completion is rewriting the current token (as opposed to appending).
Even if completion is ambiguous -- which is wrong, at least in the case where two matching completions have a shared prefix
Activity
krobelus commentedon Mar 13, 2025
Interesting. As demonstrated by your example, backslashes are used when a completion is not unique.
The idea is to allow use cases like yours (for example
ls <Tab>*will result inls \[test\]\ file*if both files exist).But you mention there's also a scenario where a completion is unique but you still want to add
*?Perhaps to match a file that will be created later?
I'm trying to imagine your scenario. Hopefully we can improve the heuristic. Feels like it wasn't a strictly improvement. Here's a hack to turn it off:
antoyo commentedon Mar 13, 2025
No. I do not know how the heuristic works, but there are cases when there are multiple completions, but I want to add
*.I believe it will use
\when doing<Tab><Tab>, but doingte<Tab><Tab>will use quotes.An example if this isn't clear:
krobelus commentedon Mar 13, 2025
ah I see. Currently we always use quotes if the completion is rewriting the current token (as opposed to appending).
Even if completion is ambiguous -- which is wrong, at least in the case where two matching completions have a shared prefix
Quote only unique completions, use backslashes for ambiguous ones
Quote only unique completions, use backslashes for ambiguous ones