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.41k stars 44 forks source link

[RESOLVED] Hardcore mode won't block execution #90

Closed selfish closed 4 years ago

selfish commented 4 years ago

Issue Details

Out of thin air, Hardcore mode died on me. I don't believe any specific changes were made in my zshrc that should have broken it.

I have done anything I could think of, including validating my .zshrc, re-installing YSU, etc.

image

This example shows that when in using echo instead of my e alias, YSU does mention that it knows I'm using hardcore mode, but it won't actually block execution.

Please provide the following details when opening an issue:

Operating System

Darwin N-Mac.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

zsh version

zsh 5.7.1 (x86_64-apple-darwin18.2.0)

you-should-use version:

1.6.0

How is zsh-you-should-use installed?

Steps to reproduce the issue

Type in any long-form of an alias in Hardcore mode.

gist link to your zshrc

Lines directly related to YSU are line numbers 76, 77, 103.

https://gist.github.com/selfish/2140c335c5e7bd1168a077a47afafa8d


JUMP TO SOLUTION


Your help is very very appreciated!!

MichaelAquilina commented 4 years ago

That is quite strange, I have the same version of zsh and the plugin and it works correctly for me.

The only thing I can think of is the kill command targeting the wrong process due to some plugin that's been installed.

could you try running this in a shell

function kill() {
  echo "$@"
  ps -p "${@[3]}"
}

and the running the same command you should me before - and perhaps a few other examples you can think of.

selfish commented 4 years ago

I, uh, guess that you were right!

image

This process was open before the echo command which triggered the print.

I started a new session (to reset kill) and the result of which kill is:

kill: shell built-in command

Any direction on how to approach that?

~I also commented out all of my plugins and reset terminal again (then validated that none of them were working), and tried again, but still, no cigar, YSU fails to block.~

edit: I commented out all of my .zshrc and rebuilt it from the ground up. It appears that romkatv/powerlevel10k or one of it's deps is the cuplrit.

antigen theme romkatv/powerlevel10k

As soon as I commented this out, everything works as expected.

  1. You may want to list this somwhere as unsupported.
  2. If you fix that yourself, I'd love to know about that.
  3. I'm going to try to resolve it by myself now, so if I find anything interesting I'll share.
MichaelAquilina commented 4 years ago

It appears that romkatv/powerlevel10k or one of it's deps is the cuplrit.

strange since I also use this, must be a specific setting or a new version that I have not updated to.

I have a few ideas I can experiment with once I can reproduce this issue

selfish commented 4 years ago

Here's my .p10k.zsh in case it helps:

https://gist.github.com/e648eb8e240456926d10f8ced3b3068f

MichaelAquilina commented 4 years ago

@selfish is this still an issue? I've updated to the latest powerlevel10k for a while now and I still cant reproduce the issue described here.

selfish commented 4 years ago

@MichaelAquilina yups. I've tried everything I could come up with, but nothing seems to make it work again. I absolutely can't figure out what's causing the problem.

Did you happen to review my p10k config?

Thank you for following up.

MichaelAquilina commented 4 years ago

I've actually tried your configuration and still cant seem to reproduce your issue. From looking at your p10k.zsh though it seems like you are using the transient and instant prompt features which tend to cause incompatibility in plugins. Could you check if disabling one of these fixes the issue?

selfish commented 4 years ago

I just tried the following, each separately, and all together:

# .p10k.zsh:
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
# Commented out ALL segments on the prompt

# .zshrc:
# Comment out all antigen plugins excluding YSU
# Comment out this:
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# play around with applying p10k before and after YSU.

Bottom line is after I stripped down everything, it boils down to:

antigen theme romkatv/powerlevel10k

Even with every possible functionality turned off on p10k, and all plugins enabled on antigen, p10k kills YSU for me. :(

selfish commented 4 years ago

Okay!

So after growing desperate, I decided to go batshit crazy:

antigen update
# Opened a new shell, to find a message saying p10k config is corrupt
antigen reset
# Opened a new shell, EVERYTHING WORKS!

@MichaelAquilina thank you for all of your help! I appreciate the fact that you've tried, and I leave that here for reference. I have to admit I have no idea what all of it actually did, since I did have the latest version of YSU, and a late version of p10k. But sure, either the update or the cache clear antigen reset did the trick.

Again, thanks!

MichaelAquilina commented 4 years ago

Thanks for checking @selfish :) Hopefully this was just a very niche bug from a specific version of powerlevel10k. I'll keep an eye out for any similarly reported bugs in the future