olets / zsh-abbr

The zsh manager for auto-expanding abbreviations, inspired by fish. ~13,000 unique cloners as of May '24, 580+ Homebrew installs 6/23-6/24
https://zsh-abbr.olets.dev
Other
510 stars 18 forks source link

Abbreviations do not expand [oh-my-zsh] #46

Closed zohnannor closed 2 years ago

zohnannor commented 2 years ago

I've installed zsh-abbr using oh-my-zsh:

$ git clone https://github.com/olets/zsh-abbr.git  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-abbr

And added it to my plugins list in .zshrc:

plugins=(
    git
    common-aliases
    ---snip---
    zsh-syntax-highlighting
    zsh-abbr
)
source $ZSH/oh-my-zsh.sh

Then I ran abbr import-aliases and they were successfully imported, but weren't working even after I restarted zsh, commented out all the other plugins I have and re-imported aliases.

The solution to this problem is just

$ source $ZSH_CUSTOM/plugins/zsh-abbr/zsh-abbr.zsh

but isn't there more elegant solution? Should I just add the line above to my .zshrc? (I thought oh-my-zsh were doing exactly that -- sourceing plugins' scripts?)

olets commented 2 years ago

Thanks for reporting!

I thought so too, but I don't use OMZ and don't know its inner workings especially well.

Lots on my plate right now; I'll shoot to investigate in the next few weeks! Let me know if you figure out anything in the meantime.

zohnannor commented 2 years ago

No problem, thanks! I will try to figure out the problem myself, and if I find anything, I will definitely let you know.

zohnannor commented 2 years ago

Apparently the reason for OMZ isn't working as expected is it needs to be sourced after the bindkey -v line I had in my .zshrc.

I also apologize for a late response for such an easy issue solution. The solution is simply to move source $ZSH/oh-my-zsh.sh line in the .zshrc to the bottom of the file!

olets commented 2 years ago

No apology needed! Glad you got it working

lazywei commented 1 year ago

Thanks @zohnannor for posting the solution. Apparently this also applies when using plugin like https://github.com/jeffreytse/zsh-vi-mode