cantino / mcfly

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

Not working in Tmux at startup #135

Closed g4570n closed 3 years ago

g4570n commented 3 years ago

Hi, I have updated Mcfly to the latest version and I have changed the code in .bashrc to: eval "$(mcfly init bash)" , this works without problems in individual terminals, but when I am open tmux or I open a new pane inside, I get this message:

-bash: mcfly: the order was not found

if I do use ctrl-r it doesn't start mcfly. To make it works I have to do manually: . ~/.bashrc , and so mcfly works again if I do ctrl-r

is there any way to avoid this behavior in tmux?

cantino commented 3 years ago

Hey @g4570n. That's a very strange error message. Does everything work fine with the older source source "/usr/local/opt/mcfly/mcfly.bash" form?

g4570n commented 3 years ago

If I'm try with:

if [[ -r ~/bin/mcfly.bash ]]; then
  source ~/bin/mcfly.bash
fi
#eval "$(mcfly init bash)"

I am get this error in tmux: "Cannot find the mcfly binary, please make sure that mcfly is in your path before sourcing mcfly.bash."

Both mcfly and mcfly.bash are in ~/bin/

cantino commented 3 years ago

And I assume ~/bin/ is in your $PATH?

g4570n commented 3 years ago

And I assume ~/bin/ is in your $PATH?

Yes,

$ echo $PATH
/home/g4570n/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
cantino commented 3 years ago

So I assume you can type mcfly --version and it works because it's in your path. Is it possible that the PATH is being setup after the lines where you source ~/bin/mcfly.bash?

g4570n commented 3 years ago

So I assume you can type mcfly --version and it works because it's in your path.

Yes, it works.

$ mcfly --version
McFly 0.5.5

Is it possible that the PATH is being setup after the lines where you source ~/bin/mcfly.bash?

The PATH setting is in my .profile file:

# if running bash                                                                    
if [ -n "$BASH_VERSION" ]; then                                                      
    # include .bashrc if it exists                                                   
    if [ -f "$HOME/.bashrc" ]; then                                                  
    . "$HOME/.bashrc"                                                                
    fi                                                                               
fi                                                                                   

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then                                                         
    PATH="$HOME/bin:$PATH"                                                           
fi 
g4570n commented 3 years ago

Wow, after sending you the answer I realized what you say, I changed the order and now it works xD

Thanks!

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi
cantino commented 3 years ago

Great, I’m glad it’s working!

On Sun, Apr 4, 2021 at 5:53 PM g4570n @.***> wrote:

Closed #135 https://github.com/cantino/mcfly/issues/135.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/cantino/mcfly/issues/135#event-4549694679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUO64UJ4TIDDTUL6T7GZ3THECZVANCNFSM4Z2PTJNA .