Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Absolute path tab completion on Windows
- X-seq: zsh-workers 53229
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Ram Rachum <ram@xxxxxxxxxx>
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Absolute path tab completion on Windows
- Date: Fri, 8 Nov 2024 20:45:57 -0800
- Archived-at: <https://zsh.org/workers/53229>
- In-reply-to: <CANXboVY-VO+U=Qb25SzaV7ZS7jpw=kqF2_WUVsrZ8-KgLQqbFA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CANXboVbJ0mv5sD_PAVe=ESkjymJs1YuAEKF8T=4QMCNpD8460g@mail.gmail.com> <CAH+w=7a13BXHRj6XD0RNnPVfpET9mcJxYCO8Gp4ser8PZwSj=Q@mail.gmail.com> <CANXboVZoDGi8BCHn0CPitYAR_R4yH2Vc3BiQ0c18A0Wy=9NHKg@mail.gmail.com> <CAHYJk3QnXGawgxBrsMVCG4gBLEKK6qNY-Z_y7YvU+71CJi_mMA@mail.gmail.com> <CANXboVYsxTOcQ+ms2voHiRQd70GQWq0fGe73-3dCGm2C5SpNBA@mail.gmail.com> <CAH+w=7aPdJ1JiHsWSVz-u98j9=rB3Xshq2-aR1qB0jQBpGT9eA@mail.gmail.com> <CANXboVb_D=DMFHFK9SBDXWctXVmTJz-keS030wMWZsCZ+RC0Gw@mail.gmail.com> <CAH+w=7bSOB7moxOaFb8eDUq0oJpXAihF8QQq16KKMJcdUfquXQ@mail.gmail.com> <CANXboVY-VO+U=Qb25SzaV7ZS7jpw=kqF2_WUVsrZ8-KgLQqbFA@mail.gmail.com>
On Fri, Nov 8, 2024 at 12:03 AM Ram Rachum <ram@xxxxxxxxxx> wrote:
>
> On Fri, Nov 8, 2024 at 2:18 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>
>> ${${(M)${(fL)"$(mount)"}:#[a-z]:*}%%:*}
>>
>> I left out the "sort -u" because (a) the order shouldn't matter
>
> On my system this results in `c c c c g j l m p` so I'll keep the implementation with `sort -u`.
I'm surprised by the multiple c: references, but just add (u) to make
them unique.
${(u)${(M)${(fL)"$(mount)"}:#[a-z]:*}%%:*}
>> _normal () {
>> if [[ $PREFIX != /*/*/* ]] && compset -P
>> "/(${(j:|:)${(M)${(fL)"$(mount)"}:#[a-z]:*}%%:*})/"
>
> This works for /c/ but not for my other drives.
Ah, as I said, tweaking. Need a couple of "preserve array-ness"
operations because of the outer double-quotes:
"/(${(j:|:)${(@u)${(@M)${(fL)"$(mount)"}:#[a-z]:*}%%:*}})/"
But you're right, since every drive is just a single letter you can do
it with a character class instead of with alternation. I couldn't do
that because I was testing with (lib|tmp|usr).
"/[${(j::)${(@u)${(@M)${(fL)"$(mount)"}:#[a-z]:*}%%:*}}]/"
However, I think even that is overkill -- there isn't anything that
matches the pattern /?/ yet is not a drive letter, is there? So just
if [[ $PREFIX != /*/*/* ]] && compset -P /?/
should set $IPREFIX to the drive path.
On Fri, Nov 8, 2024 at 12:06 AM Ram Rachum <ram@xxxxxxxxxx> wrote:
>
> Oh, now I find that it only works when autocompleting the first folder and not any subsequent folders... So it'll complete /c/win to /c/Windows but it won't complete /c/Windows/sys to /c/Windows/System.
Hm, I'd like to see ^X? (completion debugging) output for that,
because it might be related to the attempt to match
case-insensitively.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author