Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report: wd does not actually change directories #115

Open
synic opened this issue May 15, 2023 · 3 comments
Open

Bug report: wd does not actually change directories #115

synic opened this issue May 15, 2023 · 3 comments
Labels
Bug Plugin manager A problem using wd through a plugin manager

Comments

@synic
Copy link

synic commented May 15, 2023

Describe the bug
Typing wd <bookmarkname> doesn't actually change directories. Everything seems like it's going to work, but the most important part doesn't seem to do anything.

To Reproduce
Steps to reproduce the behavior:

  1. Install wd via zplug on MacOS Ventura
  2. Go to a directory you want to bookmark
  3. Type wd add test
  4. Type wd list to verify that it created your bookmark and that it points to the correct directory.
  5. Type cd ~/ to go to your home directory.
  6. Type wd test.

Expected behavior
It should go to the directory you bookmarked

Actual behavior
You are still in your home directory. No errors are printed. Nothing happened.

Desktop (please complete the following information):

  • zsh version: zsh 5.9 (arm-apple-darwin22.1.0)
  • wd version: wd version 0.5.0

Additional context
It doesn't seem to matter if I am using the version of zsh that comes with MacOS, or the version that is installed with homebrew, it doesn't work for either one.

@synic synic added the Bug label May 15, 2023
@synic
Copy link
Author

synic commented May 15, 2023

Just a note, I tried it with oh-my-zsh, and it works, so there must be some configuration option I'm missing?

@NoiseRay
Copy link

NoiseRay commented Sep 1, 2023

Well sorry for being late to the party, But I have the same "bug" (behavior), it was strange at first, but after reading some of the code I was able of figure it out.

This behavior has nothing to do with the repo itself, wd works perfectly, the issue comes with the plugin manager, in my case "zinit"

The problem is the context in which "shell" runs the script, the subshell is changing the path , but it has its own environment, so it changes the directory and finishes, but it isn't carrying the proper environment so it changes, but not for the main prompt.

That said, you can simply define the function again after the script loads, as
indicated by install.sh in line 38

echo "Adding wd function to your ~/.zshrc..."
echo "wd() {"         >> $ZSHRC
echo "  . $DIR/wd.sh" >> $ZSHRC
echo "}"       

You can do it this way after loading the script

wd(){
  . /path/to/wd.sh #there is a space to source it in the current enviroment
}

I solved it in a dirty way (coz im learning about zinit lol) and simple source it wd.plugin.zsh if anyone was wondering how

zinit ice as"program" \
    cp"wd.sh -> wd" mv"_wd.sh -> _wd" \
    src"wd.plugin.zsh"
zinit light mfaerevaag/wd

@alpha-tango-kilo
Copy link
Collaborator

alpha-tango-kilo commented Sep 1, 2023

I'd be happy to review & merge a PR for new or updated installation steps for zinit/zplug. Especially since we already document how to install zplug, if that method no longer works, then that should be updated or removed

@alpha-tango-kilo alpha-tango-kilo added the Plugin manager A problem using wd through a plugin manager label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Plugin manager A problem using wd through a plugin manager
Projects
None yet
Development

No branches or pull requests

3 participants