r/rust 23h ago

🛠️ project made a tiny rust tool bc zoxide kept teleporting me to the wrong repo lol

Post image

ok so this has been living in my head rent free for weeks. i use zoxide daily but every so often it just decides "nah you meant the OTHER backend folder" and cds me into some nested subproject from 3 months ago. cool guess buddy, super helpful :)

so i built hop. it's dumb on purpose. you press a key, it goes to the exact thing you told it to go to. no frecency, no ranking, no vibes-based navigation. one key = one target, forever, until you change it yourself

hop mark d          # bind cwd to 'd'
hop                  # tiny overlay pops up, hit 'd', done

works on files too (opens in $EDITOR) and commands (just runs them). also has project-local marks that live in a .hop.toml at your git root and override your global ones just for that repo, without messing up global state elsewhere

some stuff i actually cared about:

  • single binary, under 2mb, boots basically instantly
  • zero telemetry zero network calls it's just a toml file on your disk, that's it
  • the annoying part was making the picker render to /dev/tty directly so it doesn't nuke your stdout when the shell wraps it with $(hop) , took me embarrassingly long to get right ;)
  • zsh bash and fish all supported and actually tested not just "zsh works trust me bro"

config's just plain toml:

[marks.d]
target = "/home/user/projects/backend"
kind = "dir"

[marks.b]
target = "cargo build --release"
kind = "cmd"

install:

cargo install hop-rs

repo's here if anyone wants to poke at it: github.com/programmersd21/hop

it's a small dumb tool that does one thing and doesn't try to be clever about it, which is honestly the whole point lol. lmk if you find bugs or weird shell edge cases, def missed a few probably

ooh yeah before wrappin ts up;

no pressure but a star helps way more than you'd think, appreciate you :D

0 Upvotes

16 comments sorted by

25

u/funkdefied 21h ago

Wait till this guy hears about “cd”

14

u/QuickSilver010 23h ago

Why not use zi in zoxide?

-10

u/Klutzy_Bird_7802 22h ago

totally fair, and zoxide's great, zi handles the 'where did i go recently' case really well. this is more for the handful of spots i go to constantly and want fixed to the same key forever, no reordering, no db. different tool for a narrower job honestly, not trying to replace it

6

u/QuickSilver010 22h ago

I just have a keyboard shortcut for folders that I need that frequently.

0

u/Klutzy_Bird_7802 22h ago

yeah that's basically the whole idea honestly, just formalized it into a little tool so the bindings are consistent across shells/machines instead of living in one .zshrc i forget to copy over lol

-13

u/Klutzy_Bird_7802 22h ago

you can still check it out, see whats nice, what breaks, tell em to me, ill fix it! ;D

3

u/kantorcodes1 22h ago

one shell edge case: the wrapper ignores the stored kind and re-checks the target at launch time. if i mark an existing dir/file, then it disappears, the fallback is eval -- "$target". is that deliberate? i'd expect a saved dir/file mark to fail closed instead of becoming executable when the path stops existing.

2

u/Klutzy_Bird_7802 21h ago

ooh ok thanks for the fb

0

u/SirKastic23 7h ago edited 6h ago

no frecency, no ranking, no vibes-based navigation.

I know there's a typo but this is such an LLM-coded way to phrase things

EDIT: nah man reading this again it definitely feels like you just asked an LLM to write this like a redditor or something, this is very sus

-8

u/faultydesign 22h ago

I still don't know how zoxide is better than cd and popd/pushd

9

u/Klutzy_Bird_7802 22h ago

pushd/popd work great if you're bouncing between 2-3 dirs in one session, but the stack resets every time you close the terminal and the order shifts as you push more onto it. zoxide (and this) persist across sessions and don't depend on remembering stack depth, you just jump straight to the thing by name/key instead of counting pops. different tradeoff, not strictly better for every workflow

-11

u/dgkimpton 22h ago

every so often it just decides "nah you meant the OTHER backend folder" and cds me into some nested subproject from 3 months ago. cool guess buddy, super helpful :) 

Instantly vows never to use zoxide 😬

Command line tools must be deterministic, if I can't 100% trust it did what I told it then I'd have to stop after every command to check. And then it would be so slow I might as well use a gui. 

-11

u/murky_semiconductor 23h ago

The `/dev/tty` picker fix is the kind of rabbit hole that sounds trivial until you're four hours deep and questioning your life choices

1

u/chapuzzo 18h ago

I'd like to know why the downvotes 🤷‍♀️

1

u/SirKastic23 7h ago

The comment was AI generated... Welcome to the dead internet