agkozak/zsh-z

Import database from autojump?

Closed this issue · 7 comments

Is it possible to import my existing autojump database into zsh-z?

I have not used autojump more than once or twice, but I've tried to create a utility for you to use; perhaps you can help me finish it? It's located here: jumpstart-z

You should be able to test its output by running it on your existing autojump database:

autojump-z /path/to/autojump.txt

What you'll see is a bunch of lines with fields delimited by vertical bars, like so:

/foo/bar|10|12345678
/bat/baz|20|12345678
/quux/plugh|5|12345678

If that looks about right, you can run the command again with a redirection to your target zsh-z database, e.g.

autojump-z /path/to/autojump.txt > ~/.z

Then start using z and see if you're happy. I look forward to hearing from you!

Limitations

It looks to me -- I've only given autojump a cursory glance -- as if its system of weighting directories is somewhat different. For one thing, autojump uses zsh's chpwd hook, which means that it's giving importance to how often you go to a directory, but not how much time you spend in it (z and zsh-z use precmd).

Also, autojump doesn't record when you last visited a directory. z and zsh-z use that information, so I'm just recording "now" as the time you last visited them; that way zsh-z will consider all your autojump directories to have been equally recently visited, and your database will become more nuanced as you go about actually using zsh-z.

@ashtonlance Did my tool help?

@agkozak this works for migrating from fasd, simply rename ~/.fasd as ~/.z on first install zsh-z, if not run cat ~/.fasd >> ~/.z

@agkozak It worked perfectly! Thanks.

Great.

@wych42, thanks for the suggestion -- I've added it to the documentation.

hey @agkozak , I just started using zsh-z and this tool helped me import my autojump DB, worked perfectly, thanks!

@edobry I'm so glad to hear it. Thanks for letting me know.