cantino / mcfly

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

Insufficient documentation / how to run it? #154

Closed stepanselyuk closed 3 years ago

stepanselyuk commented 3 years ago

Hello,

I've downloaded the latest release archive and there are the binary file and shell files. I created ~/.bin directory and placed the files there and added ~/.bin to the PATH.

I'm on Ubuntu 20.04.2 and use Guake + Zsh + OhMyZSH (with plugins) + powerlevel10k theme. What are my next steps? I placed at the end of .zshrc:

export PATH="$PATH:$HOME/.bin"
export MCFLY_FUZZY=true
export MCFLY_RESULTS=50

# tried with it and without it
# ~/.bin/mcfly.zsh

eval "$(mcfly init zsh)"

Once I got setup-dialog from McFly and it even created ~/.mcfly/history.db, but then it's not bonded with Ctrl+R. I tried to disabled fzf and history plugins from OhMyZSH, and after that, I've got just plain ctrl+R function.

How to make it work and how to use mcfly.zsh / mcfly.bash scripts?

stepanselyuk commented 3 years ago

Ok so mcfly init zsh just returns the same content as in these scripts...

I tried to run

eval "$(mcfly init zsh)"

in opened shell and it worked. But for some reason, it's not working when I placed that at the end of the .zshrc file.

cantino commented 3 years ago

Are you sure that last line of your .zshrc file is getting executed? Maybe add an echo statement or check that MCFLY_HISTORY is set in env?

stepanselyuk commented 3 years ago

I did a little debugging and seems my ZSH installation reacts to this instruction:

[[ -t 0 ]] || return

when I changed it to:

if [ -t 1 ]; then return 0; fi

it started working as expected...

cantino commented 3 years ago

Does if [[ ! -t 0 ]]; then return 0; fi work?

stepanselyuk commented 3 years ago

Nope, that is not working...

Good examples of how to check if a shell is interactive or not in various shells: https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch/26782

stepanselyuk commented 3 years ago
[[ ! -o interactive ]] && return 0

this works for me

cantino commented 3 years ago

Should be fixed in https://github.com/cantino/mcfly/pull/164

thomaseizinger commented 3 years ago

Should be fixed in #164

Can confirm that this fixes the issue for me!

cantino commented 3 years ago

Great, thanks for checking @thomaseizinger!