* [PATCH] Don't complete dirs as suffix aliases
@ 2022-05-11 7:37 Marlon Richert
2022-05-11 8:03 ` Mikael Magnusson
2022-05-12 5:44 ` Bart Schaefer
0 siblings, 2 replies; 6+ messages in thread
From: Marlon Richert @ 2022-05-11 7:37 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 55 bytes --]
...because suffix aliases don't work with directories.
[-- Attachment #2: 0001-Don-t-complete-dirs-as-suffix-aliases.txt --]
[-- Type: text/plain, Size: 1051 bytes --]
From 7c66e4983fa7149e1912d0390f4303351ad001a3 Mon Sep 17 00:00:00 2001
From: Marlon Richert <marlonrichert@users.noreply.github.com>
Date: Wed, 11 May 2022 10:18:16 +0300
Subject: [PATCH] Don't complete dirs as suffix aliases
---
.vscode/settings.json | 3 +++
Completion/Zsh/Type/_suffix_alias_files | 1 +
2 files changed, 4 insertions(+)
create mode 100644 .vscode/settings.json
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..640a2c3e3
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "search.sortOrder": "fileNames"
+}
\ No newline at end of file
diff --git a/Completion/Zsh/Type/_suffix_alias_files b/Completion/Zsh/Type/_suffix_alias_files
index 1c2c8ebb5..de3e2b9d9 100644
--- a/Completion/Zsh/Type/_suffix_alias_files
+++ b/Completion/Zsh/Type/_suffix_alias_files
@@ -16,6 +16,7 @@ else
tmpa=(${(kq)saliases})
pat="*.(${(kj.|.)tmpa})"
fi
+pat+='(#q^/)'
# _wanted is called for us by _command_names
_path_files "$@" -g $pat
--
2.36.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't complete dirs as suffix aliases
2022-05-11 7:37 [PATCH] Don't complete dirs as suffix aliases Marlon Richert
@ 2022-05-11 8:03 ` Mikael Magnusson
2022-05-11 10:44 ` Marlon Richert
2022-05-12 5:44 ` Bart Schaefer
1 sibling, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2022-05-11 8:03 UTC (permalink / raw)
To: Marlon Richert; +Cc: Zsh hackers list
On 5/11/22, Marlon Richert <marlon.richert@gmail.com> wrote:
> ...because suffix aliases don't work with directories.
In what sense do they not work?
% alias -s marlon=echo
% mkdir hello.marlon
% hello.marlon
hello.marlon
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't complete dirs as suffix aliases
2022-05-11 8:03 ` Mikael Magnusson
@ 2022-05-11 10:44 ` Marlon Richert
2022-05-11 11:18 ` Peter Stephenson
0 siblings, 1 reply; 6+ messages in thread
From: Marlon Richert @ 2022-05-11 10:44 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: Zsh hackers list
On Wed, May 11, 2022 at 11:03 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> On 5/11/22, Marlon Richert <marlon.richert@gmail.com> wrote:
> > ...because suffix aliases don't work with directories.
>
> In what sense do they not work?
>
> % alias -s marlon=echo
> % mkdir hello.marlon
> % hello.marlon
> hello.marlon
% zsh -f
% alias -s marlon=echo
% mkdir hello.marlon
% hello.marlon
zsh: command not found: hello.marlon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't complete dirs as suffix aliases
2022-05-11 10:44 ` Marlon Richert
@ 2022-05-11 11:18 ` Peter Stephenson
0 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2022-05-11 11:18 UTC (permalink / raw)
To: Zsh hackers list
> On 11 May 2022 at 11:44 Marlon Richert <marlon.richert@gmail.com> wrote:
> On Wed, May 11, 2022 at 11:03 AM Mikael Magnusson <mikachu@gmail.com> wrote:
> >
> > On 5/11/22, Marlon Richert <marlon.richert@gmail.com> wrote:
> > > ...because suffix aliases don't work with directories.
> >
> > In what sense do they not work?
>
> % zsh -f
> % alias -s marlon=echo
> % mkdir hello.marlon
> % hello.marlon
> zsh: command not found: hello.marlon
So I think you need to change the line you added to
[[ -o autocd ]] || pat+='(#q^/)'
Not a particularly obvious use case, but presumably best not to break it.
pws
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't complete dirs as suffix aliases
2022-05-11 7:37 [PATCH] Don't complete dirs as suffix aliases Marlon Richert
2022-05-11 8:03 ` Mikael Magnusson
@ 2022-05-12 5:44 ` Bart Schaefer
2022-05-30 11:51 ` Marlon Richert
1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2022-05-12 5:44 UTC (permalink / raw)
To: Marlon Richert; +Cc: Zsh hackers list
What's the .vscode/settings.json file in the patch?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't complete dirs as suffix aliases
2022-05-12 5:44 ` Bart Schaefer
@ 2022-05-30 11:51 ` Marlon Richert
0 siblings, 0 replies; 6+ messages in thread
From: Marlon Richert @ 2022-05-30 11:51 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
On Thu, May 12, 2022 at 8:44 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> What's the .vscode/settings.json file in the patch?
Oh, whoops, that shouldn't be there. Here's a new version of the patch.
[-- Attachment #2: 0001-Don-t-complete-dirs-as-suffix-aliases.txt --]
[-- Type: text/plain, Size: 718 bytes --]
From 43c3a62e747b50c3b7454902f737d4e6bbdc2845 Mon Sep 17 00:00:00 2001
From: Marlon Richert <marlonrichert@users.noreply.github.com>
Date: Wed, 11 May 2022 10:18:16 +0300
Subject: [PATCH] Don't complete dirs as suffix aliases
---
Completion/Zsh/Type/_suffix_alias_files | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/Zsh/Type/_suffix_alias_files b/Completion/Zsh/Type/_suffix_alias_files
index 1c2c8ebb5..de3e2b9d9 100644
--- a/Completion/Zsh/Type/_suffix_alias_files
+++ b/Completion/Zsh/Type/_suffix_alias_files
@@ -16,6 +16,7 @@ else
tmpa=(${(kq)saliases})
pat="*.(${(kj.|.)tmpa})"
fi
+pat+='(#q^/)'
# _wanted is called for us by _command_names
_path_files "$@" -g $pat
--
2.36.1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-30 11:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 7:37 [PATCH] Don't complete dirs as suffix aliases Marlon Richert
2022-05-11 8:03 ` Mikael Magnusson
2022-05-11 10:44 ` Marlon Richert
2022-05-11 11:18 ` Peter Stephenson
2022-05-12 5:44 ` Bart Schaefer
2022-05-30 11:51 ` Marlon Richert
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).