Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Coreutils-like File Completion
- X-seq: zsh-workers 41816
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx, zsh-workers@xxxxxxx
- Subject: Re: Coreutils-like File Completion
- Date: Thu, 5 Oct 2017 12:56:47 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=ZZlz11YIUzE6r/D19TktKWKcegkjhIT0PYr0FgYcjvM=; b=FuPOXKEn6qOFBS7BH1IFlaa8ZyP1D4CXrOM5jwrzhvOxuCEJ8h22r914MDrS88rXr5 ZMFxED1o13/P2bPetRzIqkXF4oeWFSAfVQKu+Hq3seZ1MdRjRdJ/XBH6naDD3LckwduH 8Eu37gTlODP4HQL26bwFP/N5r7kpK1mwXBHGizDZHiBvJRvdZbnRr9NV4BLBuEQomlvZ FPjOl/TR4CFgGH3zHYanOuZmjFwmCDXccplqoyTEPEDuaQ4JCrVJO/yCgvH+fpDsgAtz c6f3nzxlSx5cxoaRH9uEBV9bWkgjGsepiyLGK+8kjDIVJGoxmNy1j4yBlFoYxk2jmMPB Vshg==
- In-reply-to: <87h8vdogvw.fsf@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CANBm1TZZG5ApM07erWOvAYJ3SV5k-pTtKJqixxYj35D6_6ZBTQ@mail.gmail.com> <c831f26d-076c-56a7-2509-8725c5370fa6@gmx.com> <87h8vdogvw.fsf@gmail.com>
On Oct 5, 3:37pm, Leah Neukirchen wrote:
} Subject: Re: Coreutils-like File Completion
}
} Eric Cook <llua@xxxxxxx> writes:
}
} > On another note, if you type an ' before pressing tab, zsh will
} > still complete the filename and add the closing ' if an file is
} > selected, the closing ' won't be added if the selected item is an
} > directory (since you may attempt to do further completion).
}
} This only seems to happen without compinit, anyone know how to revert
} to this behavior and still use compinit?
} (With compinit, ' is removed on TAB and the completion uses \ here...)
Hmm, I don't see your behavior. I have a directory full of deliberately
strangely-named files just for testing stuff like this.
torch% ls *' '*
two three with spaces
a (test):
bar foo
dir two:
dir3 file two
torch% print 'w<TAB>
torch% print 'with spaces' <C-U>
torch% echo 'a<TAB>
a'\''b abc answerfile a (test)/
Notice how, in the file name that contains a single quote, the listing
has closed the quote after the first "a", then backslashed the embedded
single quote, and then opened the quotes again before "b". If I cycle
the matches by repeately pressing TAB:
torch% echo 'a<TAB>
torch% echo 'a'\''b<TAB>
torch% echo 'abc'<TAB>
torch% echo 'answerfile'<TAB>
torch% echo 'a (test)/
And so on. This is all with compinit having run.
You should make sure that you're not confusing completion with expansion,
and for zstyles or setopts that may be making a difference.
There is a bit of a glitch above -- "a'b" is a directory, but the trailing
"/" is not being appended, and completion into that directory doesn't
work; the multiple quotings have confused path completion. It works if I
allow completion to supply the quoting:
torch% echo a<TAB><TAB>
torch% echo a\'b/
It also works if I start from a double quote so that it's not necessary
to close and reopen the single quotes:
torch% echo "a<TAB><TAB>
torch% echo "a'b/
Figuring out what the user means in order to unwind it, do a path search,
and then put it all back again, is of necessity heuristic, and doesn't
always work.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author