cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.85k stars 178 forks source link

Conflict with zoxide #159

Closed alexxbb closed 3 years ago

alexxbb commented 3 years ago
eval "$(mcfly init bash)"
eval "$(zoxide init bash)"

With these two tool enabled at the same time, when I open a new shell I get this: bash: PROMPT_COMMAND: line 0: syntax error near unexpected token;;' bash: PROMPT_COMMAND: line 0: mcfly_prompt_command;;__zoxide_hook' Then, running mcfly:

thread 'main' panicked at 'McFly error: Please ensure that MCFLY_HISTORY is set (environment variable not found)', /net/homedirs/arusev/.cargo/registry/src/gitlab.spimageworks.com-dbbe1dfef02d8f03/mcfly-0.5.6/src/settings.rs:261:29

If I comment the zoxide line in my bashrc then it works. Any ideas which tool cases it?

Thanks.

cantino commented 3 years ago

Hey @alexxbb. It looks like zoxide sets the PROMPT_COMMAND to ;__zoxide_hook and mcfly then adds mcfly_prompt_command; at the front. I just tested and bash doesn't like the ;; in the combined command.

Is it easy for you to run mcfly from source and see if https://github.com/cantino/mcfly/pull/160 fixes it for you?

alexxbb commented 3 years ago

Thanks @cantino, I will try to build from source tomorrow and let you know!

alexxbb commented 3 years ago

The fix is working but only if tools are sourced in this order:

eval "$(zoxide init bash)"
eval "$(mcfly init bash)"

If mcfly goes first, the error is the same.

cantino commented 3 years ago

Thanks @alexxbb. Maybe MCFLY shouldn't add the ; at all. Do you mind checking if #169 fixes this entirely?