Closed roadkell closed 2 years ago
Thanks for a nicely detailed bug report. I appreciate that you included the workaround. I think the best option here is for me to wrap the bindkey
calls with a setting and make a zqs
command to enable/disable it.
Normally I wouldn't do bindkey
calls or other shell option settings in a plugin to prevent the sort of interference that you describe here, but the quickstart is meant to be a drop-in setup, including opinionated settings presets. I've started wrapping some of the settings in a way they can be easily activated/deactivated with a zqs-enable-xyz
/ zqs-disable-xyz
in https://github.com/unixorn/zsh-quickstart-kit/pull/191, and this drives home I need to finish testing and get that merged so I can fix this in a similar way.
@roadkell please have a look at https://github.com/unixorn/zsh-quickstart-kit/pull/198 and let me know if it meets your use case.
@unixorn it does indeed, thank you!
Describe the bug
Expanding aliases inline, as described here and implemented here, prevents other plugins which also
bindkey
Space
and/orCtrl-Space
from working correctly.Examples: zsh-expand, zsh-expand-all
To reproduce
~/.zsh-quickstart-local-plugins
Space
/Ctrl-Space
To circumvent
I've created
~/.zshrc.d/99-zsh-expand
which re-implements thebindkey
s from zsh-expand.plugin.zsh, thus overridingbindkey
s from.zshrc
and restoring proper behavior of the plugin:99-zsh-expand
``` bindkey -M viins " " zpwrExpandSupernaturalSpace bindkey -M viins "^@" zpwrExpandTerminateSpace bindkey -M emacs " " zpwrExpandSupernaturalSpace bindkey -M emacs "^@" zpwrExpandTerminateSpace ```Commenting out those
bindkey
s in.zshrc
does the job as well, obviously, but it defeats the idea of not needing a separate fork of the kit.Additional context
The original alias expansion snippet was meant to inline-expand aliases in all-caps. Since then, several plugins with similar goals but wider functionality, user-friendly customizations, etc. have been created. Thus, hardcoding this logic in
.zshrc
seems unmodular and uncustomizable.A more appropriate solution would be to break out the logic into a separate plugin. Thankfully, it has already been implemented in numerous plugins to various degrees of complexity (globalias is a neat one, closely resembling that one of
.zshrc
, for example).Desktop:
.zsh-quickstart-local-plugins
```sh ZGEN_LOADED=() ZGEN_COMPLETIONS=() if [[ ! -f ~/.zsh-quickstart-no-omz ]]; then zgenom oh-my-zsh fi # If zsh-syntax-highlighting is bundled after zsh-history-substring-search, # they break, so get the order right. # zgenom load zsh-users/zsh-syntax-highlighting zgenom load zdharma-continuum/fast-syntax-highlighting zgenom load zsh-users/zsh-history-substring-search # Set keystrokes for substring searching zmodload zsh/terminfo bindkey "$terminfo[kcuu1]" history-substring-search-up bindkey "$terminfo[kcud1]" history-substring-search-down # Automatically run zgenom update and zgenom selfupdate every 7 days. zgenom load unixorn/autoupdate-zgenom # Add my collection of miscellaneous utility functions. zgenom load unixorn/jpb.zshplugin # Colorize the things if you have grc installed. Well, some of the # things, anyway. zgenom load unixorn/warhol.plugin.zsh # Warn you when you run a command that you've set an alias for without # using the alias. zgenom load djui/alias-tips # Add my collection of git helper scripts. zgenom load unixorn/git-extra-commands # Supercharge your history search with fzf zgenom load unixorn/fzf-zsh-plugin # Adds aliases to open your current repo & branch on github. zgenom load peterhurford/git-it-on.zsh if [[ ! -f ~/.zsh-quickstart-no-omz ]]; then # Load some oh-my-zsh plugins zgenom oh-my-zsh plugins/alias-finder zgenom oh-my-zsh plugins/colored-man-pages zgenom oh-my-zsh plugins/command-not-found zgenom oh-my-zsh plugins/fd zgenom oh-my-zsh plugins/gh zgenom oh-my-zsh plugins/pip zgenom oh-my-zsh plugins/python zgenom oh-my-zsh plugins/rsync zgenom oh-my-zsh plugins/safe-paste zgenom oh-my-zsh plugins/systemd zgenom oh-my-zsh plugins/thefuck zgenom oh-my-zsh plugins/themes zgenom oh-my-zsh plugins/ubuntu zgenom oh-my-zsh plugins/zsh-interactive-cd fi # A set of shell functions to make it easy to install small apps and # utilities distributed with pip. zgenom load sharat87/pip-app zgenom load chrissicool/zsh-256color # Load more completion files for zsh from the zsh-lovers github repo. zgenom load zsh-users/zsh-completions src # Intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification zgenom load kaplanelad/shellfirm shell-plugins # Zsh Shift Select Mode zgenom load jirutka/zsh-shift-select # Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion zgenom load marlonrichert/zsh-autocomplete # Immediate expansion at command line with spacebar zgenom load MenkeTechnologies/zsh-expand # Load me last GENCOMPL_FPATH=$HOME/.zsh/complete # Very cool plugin that generates zsh completion functions for commands # if they have getopt-style help text. It doesn't generate them on the fly, # you'll have to explicitly generate a completion, but it's still quite cool. zgenom load RobSis/zsh-completion-generator # Add Fish-like autosuggestions to your ZSH. zgenom load zsh-users/zsh-autosuggestions # p10k is faster and what I'm using now, so it is the new default zgenom load romkatv/powerlevel10k powerlevel10k # Save it all to init script zgenom save ```P.S. I am in no way an expert on zsh or shell scripting, and I may be missing something completely obvious here. :sweat_smile: Also, thank you for the project!
can_haz()
makes me smile every time I stumble upon it. =)