New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(init)!: allow turning off aliases for libs and plugins #11550
Conversation
We can see in #10510 what does this PR closes also 👌🏻 |
Proof of concept work for backing up and restoring aliases on libs and plugins that have them turned off by the user via ztyle: zstyle ':omz:*' aliases no zstyle ':omz:lib:*' aliases no zstyle ':omz:plugins:*' aliases no zstyle ':omz:plugins:git' aliases no Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
dcb1729
to
f7dcdae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 😉
After testing with https://github.com/romkatv/zsh-bench, I cannot see a difference while removing all aliases and leaving all of them. It seems that the way we are keeping and restoring aliases has no performance issues. |
I'm currently debugging why setting |
OK it looks like the same happens with When that happens, the resulting hash table does not actually get modified, I don't know exactly why by looking at the code: https://github.com/zsh-users/zsh/blob/c006d760/Src/Modules/parameter.c#L1767-L1807 I have pushed a version that uses EDIT: it looks like the culprit is that the hashtable is actually empty, so this check matches and nothing is done: https://github.com/zsh-users/zsh/blob/c006d7609703afcfb2162c36d4f745125df45879/Src/Modules/parameter.c#L1773-L1774 |
I think the code is a bit more difficult to read. What about adding always a garbage alias, maybe |
That looks like a hack, I have instead pushed a change that doesn't resort to weird tricks, a simple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's more readable I'd say, LGTM!
Incredible job Marc😉
Shipped! 🚀 Thank you for the review! |
…11550) BREAKING CHANGE: the previous zstyle setting to disable `lib/directories.zsh` aliases has been changed to the new syntax: `zstyle ':omz:lib:directories' aliases no`. See https://github.com/ohmyzsh/ohmyzsh#skip-aliases to see other ways you can use this setting. Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Fix regression introduced in ohmyzsh#11550. If an existing alias was present in the moment of sourcing, and oh-my-zsh aliases were disabled for that file, it'd be overwritten aswell. See ohmyzsh#11658.
Fix regression introduced in ohmyzsh#11550. If an existing alias was present in the moment of sourcing, and oh-my-zsh aliases were disabled for that file, it'd be overwritten aswell. See ohmyzsh#11658.
…11550) BREAKING CHANGE: the previous zstyle setting to disable `lib/directories.zsh` aliases has been changed to the new syntax: `zstyle ':omz:lib:directories' aliases no`. See https://github.com/ohmyzsh/ohmyzsh#skip-aliases to see other ways you can use this setting. Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Fix regression introduced in ohmyzsh#11550. If an existing alias was present in the moment of sourcing, and oh-my-zsh aliases were disabled for that file, it'd be overwritten aswell. See ohmyzsh#11658.
…11550) BREAKING CHANGE: the previous zstyle setting to disable `lib/directories.zsh` aliases has been changed to the new syntax: `zstyle ':omz:lib:directories' aliases no`. See https://github.com/ohmyzsh/ohmyzsh#skip-aliases to see other ways you can use this setting. Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Fix regression introduced in ohmyzsh#11550. If an existing alias was present in the moment of sourcing, and oh-my-zsh aliases were disabled for that file, it'd be overwritten aswell. See ohmyzsh#11658.
Fix regression introduced in ohmyzsh#11550. If an existing alias was present in the moment of sourcing, and oh-my-zsh aliases were disabled for that file, it'd be overwritten aswell. See ohmyzsh#11658.
Standards checklist:
Proof of concept work for backing up and restoring aliases on libs and plugins that have them turned off by the user via ztyle:
Aliases could also be selectively enabled for specific components, such as:
Work in collaboration with @carlosala.
Fixes #9414