* Re: Quote of % in a completed func name?
2023-09-18 20:43 Quote of % in a completed func name? Sebastian Gniazdowski
@ 2023-09-18 14:56 ` Bart Schaefer
2023-09-18 14:58 ` Bart Schaefer
2023-09-19 22:08 ` Sebastian Gniazdowski
0 siblings, 2 replies; 7+ messages in thread
From: Bart Schaefer @ 2023-09-18 14:56 UTC (permalink / raw)
To: Sebastian Gniazdowski; +Cc: Zsh Users
On Mon, Sep 18, 2023 at 6:42 AM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> Could the % be somehow be quoted after completing? (\%exa works and calls the %func functon)
Firstly, to prevent conflicts you can remove "jobs" from the same
completion zstyle I sent earlier for leading colons in command
completion.
For command execution, you're probably best going with a
zle-line-finish hook that does a search-and-replace, e.g.
BUFFER=${(*)BUFFER//#%(#b)(${(kj:|:)~functions[(I)%*]})/\\\\$match[1]}
(remove (*) and setopt extendedglob for older zsh)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Quote of % in a completed func name?
2023-09-18 14:56 ` Bart Schaefer
@ 2023-09-18 14:58 ` Bart Schaefer
2023-09-19 22:08 ` Sebastian Gniazdowski
1 sibling, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2023-09-18 14:58 UTC (permalink / raw)
To: Sebastian Gniazdowski; +Cc: Zsh Users
On Mon, Sep 18, 2023 at 7:56 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> BUFFER=${(*)BUFFER//#%(#b)(${(kj:|:)~functions[(I)%*]})/\\\\$match[1]}
>
> (remove (*) and setopt extendedglob for older zsh)
Oh, remove the #% too, that was a leftover from testing, you want to
match anywhere in the buffer not the whole buffer.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Quote of % in a completed func name?
@ 2023-09-18 20:43 Sebastian Gniazdowski
2023-09-18 14:56 ` Bart Schaefer
0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Gniazdowski @ 2023-09-18 20:43 UTC (permalink / raw)
To: Zsh Users
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
Hi
I have created some %functs… I complete them to see that they cannot
execute:
14:56[/home/q]3# %exa
fg: job not found: exa
Could the % be somehow be quoted after completing? (\%exa works and calls
the %func functon)
--
Best regards,
Sebastian Gniazdowski
[-- Attachment #2: Type: text/html, Size: 896 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Quote of % in a completed func name?
2023-09-19 22:08 ` Sebastian Gniazdowski
@ 2023-09-19 15:14 ` Bart Schaefer
2023-09-19 22:14 ` Sebastian Gniazdowski
1 sibling, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2023-09-19 15:14 UTC (permalink / raw)
To: Sebastian Gniazdowski; +Cc: Zsh Users
On Tue, Sep 19, 2023 at 8:06 AM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> it works, thanks. Question: what does the * flag do in ${(*)BUFFER … …?
Turns on extendedglob temporarily. See the NEWS file in 5.9
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Quote of % in a completed func name?
2023-09-19 22:14 ` Sebastian Gniazdowski
@ 2023-09-19 16:00 ` Bart Schaefer
0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2023-09-19 16:00 UTC (permalink / raw)
To: Sebastian Gniazdowski; +Cc: Zsh Users
On Tue, Sep 19, 2023 at 8:13 AM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> other thing i've noted: you used ~ flag not in the idiomatic way, ie. not as (~j:|:) but before the var: (j:|:)~functions. Why?
No reason other than that I forgot it was possible to put it inside
the parentheses.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Quote of % in a completed func name?
2023-09-18 14:56 ` Bart Schaefer
2023-09-18 14:58 ` Bart Schaefer
@ 2023-09-19 22:08 ` Sebastian Gniazdowski
2023-09-19 15:14 ` Bart Schaefer
2023-09-19 22:14 ` Sebastian Gniazdowski
1 sibling, 2 replies; 7+ messages in thread
From: Sebastian Gniazdowski @ 2023-09-19 22:08 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh Users
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
it works, thanks. Question: what does the * flag do in ${(*)BUFFER … …?
On Mon, 18 Sept 2023 at 09:56, Bart Schaefer <schaefer@brasslantern.com>
wrote:
> On Mon, Sep 18, 2023 at 6:42 AM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
> >
> > Could the % be somehow be quoted after completing? (\%exa works and
> calls the %func functon)
>
> Firstly, to prevent conflicts you can remove "jobs" from the same
> completion zstyle I sent earlier for leading colons in command
> completion.
>
> For command execution, you're probably best going with a
> zle-line-finish hook that does a search-and-replace, e.g.
>
> BUFFER=${(*)BUFFER//#%(#b)(${(kj:|:)~functions[(I)%*]})/\\\\$match[1]}
>
> (remove (*) and setopt extendedglob for older zsh)
>
--
Best regards,
Sebastian Gniazdowski
[-- Attachment #2: Type: text/html, Size: 1458 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Quote of % in a completed func name?
2023-09-19 22:08 ` Sebastian Gniazdowski
2023-09-19 15:14 ` Bart Schaefer
@ 2023-09-19 22:14 ` Sebastian Gniazdowski
2023-09-19 16:00 ` Bart Schaefer
1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Gniazdowski @ 2023-09-19 22:14 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh Users
[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]
other thing i've noted: you used ~ flag not in the idiomatic way, ie. not
as (~j:|:) but before the var: (j:|:)~functions. Why?
On Tue, 19 Sept 2023 at 17:08, Sebastian Gniazdowski <sgniazdowski@gmail.com>
wrote:
> it works, thanks. Question: what does the * flag do in ${(*)BUFFER … …?
>
> On Mon, 18 Sept 2023 at 09:56, Bart Schaefer <schaefer@brasslantern.com>
> wrote:
>
>> On Mon, Sep 18, 2023 at 6:42 AM Sebastian Gniazdowski
>> <sgniazdowski@gmail.com> wrote:
>> >
>> > Could the % be somehow be quoted after completing? (\%exa works and
>> calls the %func functon)
>>
>> Firstly, to prevent conflicts you can remove "jobs" from the same
>> completion zstyle I sent earlier for leading colons in command
>> completion.
>>
>> For command execution, you're probably best going with a
>> zle-line-finish hook that does a search-and-replace, e.g.
>>
>> BUFFER=${(*)BUFFER//#%(#b)(${(kj:|:)~functions[(I)%*]})/\\\\$match[1]}
>>
>> (remove (*) and setopt extendedglob for older zsh)
>>
>
>
> --
> Best regards,
> Sebastian Gniazdowski
>
>
--
Best regards,
Sebastian Gniazdowski
[-- Attachment #2: Type: text/html, Size: 2274 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-19 16:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18 20:43 Quote of % in a completed func name? Sebastian Gniazdowski
2023-09-18 14:56 ` Bart Schaefer
2023-09-18 14:58 ` Bart Schaefer
2023-09-19 22:08 ` Sebastian Gniazdowski
2023-09-19 15:14 ` Bart Schaefer
2023-09-19 22:14 ` Sebastian Gniazdowski
2023-09-19 16:00 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).