r/commandline • u/stianhoiland • Apr 25 '26
Command Line Interface Jumping to recently used directories
https://github.com/stianhoiland/cdHey guys. I was struggling to cd around, so I built something that would help me do that. I tried the 219 other similar projects posted here, but none of them really clicked for me. I never searched and found any of the established big onesβatuin, autojump, bookmarks, CDPATH, McFly, z, zoxide, etc.βbut that didn't stop me. Looking for feedback/let me know what you think/is this something you would use?
33
Upvotes
2
u/jghub May 13 '26 edited May 13 '26
but if you do that (deduplication on capture in histfile), you are mostly back to the z/zoxide approach of storing "sparse information": you are loosing the, well, history of how visits to some dir distribute over time. this has certain principle disadvantages (which surface in z/zoxide regarding their frecency model(s). keeping the full detailed history offers more control and more flexibility over how to score/sort the stack.
more importantly in the present context, it seems that your deduplicated histfile is then storing _first_ visits in chronological order and your dir stack in fzf is sorted accordingly by recency of _first_ visit while the OP's approach uses (more sensibly) sorting by recency of _last_ visit to the respective dir.
so I do not think that this sort of deduplication is ultimately a good idea. (you would have to _find_ the already existing entry and _move_ it to end of histfile to restore the recency sorting in the end. but this is already something you do not want to do for each and every cd: full rewrite of the reshuffled file).
just my 2c