Open aaronkollasch opened 4 months ago
Note that there is a related issue involving expansion suggestions for backslash-escaped words/paths as well as quoted words. This interferes with completing paths containing spaces, as the first suggestion is always to remove the escapes (which would break the path).
Your fix works for me as well - was getting annoyed by this. Thanks!
@aaronkollasch I was about to open an issue for that, I was just checking if there is already an issue for this?
is there any temporary fix? a lot of my paths contain spaces, so it's getting very annoying
@4rtemis-4rrow Here's a temporary fix for the spaces issue - It's not perfect in covering all the edge cases that could happen with quotations and escapes, but it does reduce the annoyance level: https://github.com/aaronkollasch/zsh-autocomplete/commit/d53d90dd205b3ef66101d4cf8692c8518d4daf61
Environment
Steps to reproduce
So the first suggestion is an expansion of
~
followed by the portion of the subdirectory. Because the expansion takes priority, it takes two tabs to get to the first directory completion instead of one. The problem repeats, as if I accept~/aaa_1
by typing '/', the new first completion is again the tilde expansion, and it's the full path ofaaa_1
, the folder I've already entered!This means that to efficiently complete
~/*
paths, I must first expand the~
, which clutters up the terminal and requires extra keystrokes.Contents of
~autocomplete-log/YYYY-MM-DD.log
(click to expand)Potential solution
Using bisection, I traced the issue to commit 06431898a04cbe9d2e128a1b66b84905a8c1de69.
The solution I came up with was to expand the first path component of
$word
if it begins with~
, before comparing with the full$expansion
.It feels a bit hack-y but I'm not sure if there's a better way, such as directly disabling tilde expansion in eval or something.
Note that due to the way I used patterns here, completing
~
still suggests the expansion into$HOME
as the first result, it just goes away for~/
or~/a...
and beyond. Seems like a useful middle ground for my purposes.See this commit for the diff: https://github.com/aaronkollasch/zsh-autocomplete/commit/da40b542b223f8519d0bcce4fd9d4beb96f62301