[-- 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
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
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
> 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
What's the .vscode/settings.json file in the patch?
[-- 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