zsh-users / zsh-history-substring-search

🐠 ZSH port of Fish history search (up arrow)
2.61k stars 156 forks source link

`(anon):local:1: bad option: -e` error #143

Closed Anomalocaridid closed 1 year ago

Anomalocaridid commented 1 year ago

I recently updated my zsh plugins and if I have this plugin enabled, even if I do not have the zle widgets mapped to any keys, I get an error saying (anon):local:1: bad option: -e. I have confirmed that no other part of my configuration is responsible for this by only loading my plugin manager, zcomet, and this plugin.

guidovansteen commented 1 year ago

I would ask the developers of zcomet.

Anomalocaridid commented 1 year ago

I tried directly sourcing this plugin without a plugin manager and I have confirmed that this error still occurs without it. I even moved my .zshenv file and logged in and out for good measure. Apologies for not trying this sooner.

Here is the full output of the error, which I get every time I press enter:

home-pc% (anon):local:1: bad option: -e
[bat error]: invalid digit found in string

If I do not have bat installed, then I instead get this:

home-pc% (anon):local:1: bad option: -e
(anon):1: command not found: bat

I apologize for previously overlooking the second line of the output. I initially assumed it was unrelated because I thought that I did not see it when just zcomet and this plugin was loaded.

guidovansteen commented 1 year ago

Zhss does not use bat. So this issue must be unrelated to it.

Anomalocaridid commented 1 year ago

I am aware zhss does not use bat, but this bug only happens if zhss is sourced, even if no other part of my configuration is sourced. So I am not sure what else could cause it. Did you at least try to replicate the issue? I use the Sway edition of EndeavourOS if that's important. Please let me know if there is any other information I should provide or anything else I should try to rule zhss out.

guidovansteen commented 1 year ago

Is it possible that you (or some shell script) aliased cat to bat. You might check this by running alias cat. If this yields any output you might run unalias cat and check if that helps resolve your problem.

guidovansteen commented 1 year ago

I googled your error and found this: https://github.com/DanielFGray/fzf-scripts/issues/15. Just a suggestion, in case you have installed fzf: You might have to add --ansi to the environment variable FZF_DEFAULT_OPTS (like export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS -- ansi")

Anomalocaridid commented 1 year ago

Apparently, something changed and I am no longer able to replicate my issue on zsh with no .zshrc. So it looks like you are most likely right that zhss is not the cause of my problem. Nonetheless, thank you for your help and I apologize for wasting your time.

Also it does not appear cat being aliased or fzf being passed a given flag affects my problem, but thank you for the suggestions anyways.

Edit: It looks like it was caused by making -h a global alias. I feel very silly now. Although I am not sure how it still affected me when I did not have my config loaded. I suppose I accidentally loaded part of it or something.