-
Notifications
You must be signed in to change notification settings - Fork 512
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
Import from cd
history
#703
Comments
I built a simple python script that does this. https://gist.github.com/Pyrestone/105c837f8aab14bd833d5807b2c43751 usage: python zoxide_from_bash_history.py
#inspect the generated add_command.bash
bash ./add_command.bash It certainly isn't perfect, and just tries to re-trace the history of cd in your .bash_history, to keep track of where you've been and how often. In this way, it keeps track of all the places in your file system that you've likely been to, and on every change it saves it to a list of directories, which get added to a command which you can then run to add them all to your zoxide history at once. |
Wow you really went all the way down that rabbit hole and came back out with a result. I did not 😅 |
TBH though, after doing that, I now hate that zoxide pollutes the bash_history with commands that are no longer valid normal cd commands. That's especially an issue when using "--cmd cd" in the zoxide init command. Maybe I should make a feature request for a mode where zoxide replaces the entries it leaves in bash_history with the final cd command it actually executes in the end, so that the bash_history stays useful.... |
That sounds like a good idea but I can imagine they wouldn't wanna do it because it's sorta nonstandard to manipulate the bash history, even if it's just an optional mode. |
This is really interesting. |
I think it should at least be an option to train zoxide on the history of
cd
calls after installing it. I think it would even make sense to just do that by default.The text was updated successfully, but these errors were encountered: