mattmc3 / zephyr

:wind_face: A Zsh framework as nice as a cool summer breeze
MIT License
123 stars 13 forks source link

Is it valid to load a part of Zephyr? #2

Closed mel0n0 closed 2 years ago

mel0n0 commented 2 years ago

Hello:-)

I recently tried using Antidote and Zephyr referencing your dotfile. And there are two points that confused me.

First, is it valid to load only a certain part of Zephyr? For example, I just need zephyr path:plugins/autosuggestions. Since the directory functions is not in fpath, will the following line be invalid? https://github.com/mattmc3/zephyr/blob/f95c701dea829da1b95d8ce90438ff31c1a94388/plugins/autosuggestions/autosuggestions.plugin.zsh#L14

Another thing, when I used the plugin fancy-ctrl-z, I found that its bindkey did not work. I tried to search bindkey by $ bindkey | grep fancy, but no results. Here is the related information:

# zsh --version
# zsh 5.9 (x86_64-apple-darwin20.6.0)

# .zsh_plugins.txt
ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z

# .zsh_plugins.zsh
fpath+=( /Users/me/.cache/antidote/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z )
source /Users/me/.cache/antidote/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh

BTW, If I source fancy-ctrl-z.plugin.zsh manually, it works fine.

mattmc3 commented 2 years ago

Is it valid to load a part of Zephyr?

Yes, absolutely. In fact, that's the primary use case - to load only what you want.

Since the directory functions is not in fpath, will the following line be invalid?

It should work fine. Antidote adds your plugins to fpath, but even without antidote it shouldn't be a problem. If you are having an issue with it though, please describe further.

Another thing, when I used the plugin fancy-ctrl-z, I found that its bindkey did not work

Is there a chance you have something else in your config that would reset your keybindings after you load fancy-ctrl-z? I tried a lot of different things to see if I could replicate the behavior you're describing, but I can't seem to.

# from an interactive terminal, try this:
% source <(antidote bundle ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z)
% bindkey | grep fancy                                          
"^Z" fancy-ctrl-z
mel0n0 commented 2 years ago

It should work fine. Antidote adds your plugins to fpath, but even without antidote it shouldn't be a problem.

Thanks, I get it.

About fancy-ctrl-z, I also found out why it doesn't work according to your reply. This seems to be due to putting the below after .zsh_plugins.zsh is loaded in my zshrc.

# Choose your preferred keybindings.
bindkey -e   # Emacs keybindings
#bindkey -v  # Vi keybindings