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

Trying to implement a go back and go forward #839

Open
shibisuriya opened this issue Jun 11, 2024 · 4 comments
Open

Trying to implement a go back and go forward #839

shibisuriya opened this issue Jun 11, 2024 · 4 comments

Comments

@shibisuriya
Copy link

Hi, I am trying to implement go back and go forward between current working directory, I am trying to replicate vim's +o and +i (which helps me jump and forth between files)... I am using z - to go to the last working directory, but there is no provision to go forward to where I came from using something like z + maybe....

@jonasreiher
Copy link

Just z - again. This lets you jump between the two most recent directories. Consider ~/foo/bar/baz/:

$ z foo
$ z bar
$ z baz
$ pwd
~/foo/bar/baz
$ z -
~/foo/bar
$ z -
~/foo/bar/baz

@shibisuriya
Copy link
Author

I want to jump forward, then forward again if I want to, like a stack, push and pop the directories... Go back and forth.

@jonasreiher
Copy link

If you need this to work for multiple steps (not just toggling between the two last directories), pushd and popd sound more like what you need. Not sure how to integrate this with zoxide, though. And the forward jumping is also not directly supported.

@hendstephen
Copy link

+1 to this request! Would love built in support for pushd and popd.
@shibisuriya, in the meantime I've added this to my .bashrc:

# ~/.bashrc
alias pushz='pushd . && z'

# Then you can run as follows:
pushz mydir

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