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

cd command is slow #479

Open
amorey opened this issue May 21, 2024 · 3 comments
Open

cd command is slow #479

amorey opened this issue May 21, 2024 · 3 comments

Comments

@amorey
Copy link

amorey commented May 21, 2024

Thanks for making such a useful tool!

I noticed that the cd command slowed down significantly after installing gvm and I tracked down the issue to this script: $GVM_ROOT/scripts/env/cd. I understand the need for overloading cd but it would be helpful if the function ran faster or alternatively if there was a way to opt-in or opt-out. In my case I'm just using the global go version and most of my use of cd is not go-related so the extra cycles aren't necessary.

Here's my setup:

zsh 5.9 (x86_64-apple-darwin23.0)
gvm v1.0.22
macOS 14.5
@Jakrh
Copy link

Jakrh commented May 28, 2024

If you don't need go version auto-switching on cd, there is a workaround command unset cd to un-overloading cd.

You can put this command into ~/.bash_profile or ~/.zprofile.

@amorey
Copy link
Author

amorey commented May 29, 2024

Thanks! I had to add "-f" but this worked:

[[ -s "/path/to/home/.gvm/scripts/gvm" ]] && source "/path/to/home/.gvm/scripts/gvm"
unset -f cd

@ccharon
Copy link

ccharon commented Jan 23, 2025

just found this because my cd command stopped working after installing gvm. This is somehow unexpected :P

i type "cd Programs" in my home directory and it takes a second or two and then the prompt returns but the directory was not changed.

Using the mentioned "unset -f cd" makes it work again, so there is something broken in the cd script.

Go Version Manager v1.0.22
GNU bash, Version 5.2.37(1)-release
Gentoo Linux

Output when setting GVM_DEBUG=1

me@machine ~ $ cd Programs
Resolving defaults...
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
defaults_go_name => go1.23.5
defaults_go_pkgset => global
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Resolved default go: go1.23.5
Resolved default pkgset: global

dot_go_version =>
defaults_go_name => go1.23.5

No .go-version found. Using system or default go.

dot_go_pkgset =>

No .go-pkgset found. Using system or default pkgset.
---------- defaults_go_pkgset => global ----------

vncsmyrnk added a commit to vncsmyrnk/zsh-config that referenced this issue Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants