You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, I'm not sure whether this issue relates to zsh itself, completions, or zle. I'll start by raising it here, but if I should ask elsewhere please feel free to let me know.
The basic context is this:
I type a command like ls[space] or git add[space]
I press tab
Completions appear
I would like to configure things so that (a) completions are grouped by kind and (b) I can customise the group titles. I am actually using Nerdfont icons for this, but for demonstration I've used some terrible ASCII art.
My reading of the docs is that I can start with this to force the group-by-kind behaviour:
zstyle ':completion:*' group-name ''
From here I can add styles like:
# For eg. ls first arg completion
zstyle ":completion:*:globbed-files" format '.~* globbed files *~.'
# For eg. git add arg completion
zstyle ":completion:*:modified-files" format ".~* modified files *~."
This works! Here's a docker session on zshusers/zsh:master where the last part shows the tab behaviour:
The group header is now back to file, a result of %d substitution (which can be confirmed by using non-template text). I'm confused because the docs say:
The style is tested with each tag valid for the current completion before it is tested for the descriptions tag. Hence different format strings can be defined for different types of match.
I would not expect that adding a style for ':completion:*:descriptions' would override the more specific globbed-files tag. Even more confusingly, if I trigger completions for git add, the descriptions style does not override the modified-files style.
I also tried adding a style for argument-rest, but this overrides pretty much any other group name I might care about, and it's also still unclear as to why that would work but not more specific ones.
I tried this on Zsh 5.9 on Ubuntu 23.10 and the Docker images zshusers/zsh:master and zshusers/zsh:5.9 with identical results. The output I've posted above has been a little bit modified to try to show the workflow and debugging info, but the commands themselves should work as they are posted.
The text was updated successfully, but these errors were encountered:
Firstly, I'm not sure whether this issue relates to zsh itself, completions, or zle. I'll start by raising it here, but if I should ask elsewhere please feel free to let me know.
The basic context is this:
ls[space]
orgit add[space]
I would like to configure things so that (a) completions are grouped by kind and (b) I can customise the group titles. I am actually using Nerdfont icons for this, but for demonstration I've used some terrible ASCII art.
My reading of the docs is that I can start with this to force the group-by-kind behaviour:
From here I can add styles like:
This works! Here's a docker session on
zshusers/zsh:master
where the last part shows the tab behaviour:The problem arises when I want to add a "catch-all" group heading via
':completion:*:descriptions'
:The group header is now back to
file
, a result of%d
substitution (which can be confirmed by using non-template text). I'm confused because the docs say:I would not expect that adding a style for ':completion:*:descriptions' would override the more specific
globbed-files
tag. Even more confusingly, if I trigger completions forgit add
, thedescriptions
style does not override themodified-files
style.I've tried looking for any differences in the tags, by using ctrl+x, h:
I also tried adding a style for
argument-rest
, but this overrides pretty much any other group name I might care about, and it's also still unclear as to why that would work but not more specific ones.I tried this on Zsh 5.9 on Ubuntu 23.10 and the Docker images
zshusers/zsh:master
andzshusers/zsh:5.9
with identical results. The output I've posted above has been a little bit modified to try to show the workflow and debugging info, but the commands themselves should work as they are posted.The text was updated successfully, but these errors were encountered: