MichaelAquilina / zsh-you-should-use

📎 ZSH plugin that reminds you to use existing aliases for commands you just typed
GNU General Public License v3.0
1.55k stars 44 forks source link

per-directory-history breaks you-should-use #48

Open sheafitzek opened 6 years ago

sheafitzek commented 6 years ago

I'm using oh-my-zsh on Ubuntu 16.04. Whenever I enable the bundled per-directory-history plugin, you-should-use breaks. There is no output from it at all. Let me know if you need additional info.

MichaelAquilina commented 6 years ago

Are you on the latest version of you-should-use? How does it break (any output on the console)? What zsh version are you on? Would it be possible to provide a minimal zshrc showing the breakage?

sheafitzek commented 6 years ago

I am on ZSH v5.1.1 & you-should-use v0.4.4. There is no output to the console from you-should-use when per-directory-history plugin is activated.

##  .zshrc  ##

OS=$(uname | tr '[:upper:]' '[:lower:]')
source $HOME/git/dotfiles/bash/aliases-${OS}.bash

ZSH_THEME="powerlevel9k/powerlevel9k"

HYPHEN_INSENSITIVE="true"
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
ZSH_CUSTOM=$HOME/git/dotfiles/zsh/custom

plugins=(
    per-directory-history
    you-should-use
)

source $ZSH/oh-my-zsh.sh

If I comment out the per-directory-history plugin, you-should-use works as expected.

MichaelAquilina commented 6 years ago

Interestingly, when I enable the per-directory-history plugin it doesnt work for the first command. The next few commands that are typed are detected. Do you experience the same behaviour?

sheafitzek commented 6 years ago

I just tested about 10 commands that I have aliases for, some of them multiple times, but never got any output from you-should-use with per-directory-history enabled.

griwes commented 5 years ago

I am having the same issue; disabling per-directory-history is necessary for you-should-use to work correctly for me. Sadly, this means not using YSU for me...

I'm on Debian sid, ZSH 5.7.1, you-should-use 1.3.0.

Guchman commented 4 years ago

Any news? I've got same issue:(

MichaelAquilina commented 4 years ago

I'll try see if I can reproduce the issue at some point this week. Feel free to attempt to debug this though if you want to give a go at a PR :)

Guchman commented 4 years ago

I've tried to find out the reason and it seems that it's not the you-should-use problem itself. Prexec hook doesn't receives first argument. It's breaking on "fc -p " command at per-directory-history-addhistory() hook that installed from per-dir-history.zsh. Still didn't get the reason. Hook's documentation says that it is possible that both first and second argument will be ignored if history is not active, but I didn't completely understood what does it mean.

Guchman commented 4 years ago

There is already an issue at per-dir-history

MichaelAquilina commented 4 years ago

Thanks for coming back with this @Guchman, this helps a lot. I might try see if there is a workaround I can put in place for the plugin so that this works correctly.