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

disabling cd on fish broke zoxide #553

Closed
stephane-archer opened this issue Apr 12, 2023 · 5 comments
Closed

disabling cd on fish broke zoxide #553

stephane-archer opened this issue Apr 12, 2023 · 5 comments
Labels
waiting-for-response Waiting for a response from the issue author.

Comments

@stephane-archer
Copy link

Hi, I wanted to "disable cd" for interactive use to change my muscle memory.
type this in your shell and it works!

function cd
    if status is-interactive
          echo "Use z"
          return 1
	end
	builtin cd $argv
end

cd is disabled and z works!
let's funcsave cd then start a new terminal
cd is disabled but z says now "Use z"...

PS: in my config file I have the following:

if status --is-interactive
        zoxide init fish | source
end

System info:

fish, version 3.6.1
zoxide v0.9.0
Darwin MacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64 x86_64
screen-256color
@stephane-archer
Copy link
Author

stephane-archer commented Apr 12, 2023

I found a workaround by defining the following function __zoxide_cd_internal; builtin cd $argv; end
but this is an issue because zoxide init fish output is not right.
please see this detailed answer: fish-shell/fish-shell#9733 (comment)

@ajeetdsouza
Copy link
Owner

zoxide uses the fish cd function under the hood, so the solution is simply to change the cd function after calling zoxide:

if status --is-interactive
        zoxide init fish | source
end

function cd
    if status is-interactive
        echo "Use z"
        return 1
    end
    builtin cd $argv
end

@ajeetdsouza ajeetdsouza added the waiting-for-response Waiting for a response from the issue author. label Apr 16, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you feel this is still relevant, please comment here or create a fresh issue.

@sascha-wi
Copy link

zoxide uses the fish cd function under the hood, so the solution is simply to change the cd function after calling zoxide:

if status --is-interactive
        zoxide init fish | source
end

function cd
    if status is-interactive
        echo "Use z"
        return 1
    end
    builtin cd $argv
end

Doesn't work for me, if I use z instead it still says "Use z".

@ajeetdsouza
Copy link
Owner

@sascha-wi could you create a separate issue for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-response Waiting for a response from the issue author.
Projects
None yet
Development

No branches or pull requests

3 participants