cantino / mcfly

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

zsh autocd not working #91

Closed PicoJr closed 3 years ago

PicoJr commented 4 years ago

Hello,

After loading mcfly.zsh the autocd feature of zsh stopped working.

After looking online I found a similar issue in another project: https://github.com/jenv/jenv/issues/234

For now I append setopt autocd at the end of mcfly.zsh.

I'm on Ubuntu 18.04LTS, shell is zsh via oh-my-zsh.

Best regards,

PicoJr.

GabLeRoux commented 4 years ago

I confirm this. typing .. doesn't work if

if [[ -r "/usr/local/opt/mcfly/mcfly.zsh" ]]; then
  source "/usr/local/opt/mcfly/mcfly.zsh"
fi

is placed after ~/.zshrc's source $ZSH/oh-my-zsh.sh. (and if placed before, mcfly.zsh it simply doesn't work) ;)

Suggested workaround works.

✅ Here's what I did in ~/.zshrc instead (doesn't involve modifying mcfly.zsh):

if [[ -r "/usr/local/opt/mcfly/mcfly.zsh" ]]; then
  source "/usr/local/opt/mcfly/mcfly.zsh"
  # https://github.com/cantino/mcfly/issues/91
  setopt autocd
fi
GabLeRoux commented 3 years ago

I think this was closed by #127

I updated mcfly, removed setopt autocd line from my ~/.zshrc:

if [[ -r "/usr/local/opt/mcfly/mcfly.zsh" ]]; then
  source "/usr/local/opt/mcfly/mcfly.zsh"
fi

Opened a new shell:

cd Application
..

and it worked as expected 🙌

cantino commented 3 years ago

Great! Thanks for verifying :)