ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
20.29k stars 518 forks source link

Trying to implement a go back and go forward #839

Open shibisuriya opened 3 weeks ago

shibisuriya commented 3 weeks ago

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 commented 3 days ago

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 commented 3 days ago

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 commented 3 days ago

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.