News for hackers. Stuff that matters.
Re:Ask HN: Programs that saved you 100 hours? by lloeki on Monday April 13, 2020 @03:17AM (#22853790)
I prefer my own kd, which is 40 dead simple LOCs of shell and is predictable since it operates only on dirs you added (which sounds like a chore but is just fine in practice)

    kd foo $PWD  # stores as foo
    kd f         # jumps to foo
    kd           # in a Ruby project subdir, jumps up to where the Gemfile is
https://github.com/lloeki/dotfiles/blob/master/shell/kd
Re:Ask HN: Programs that saved you 100 hours? by lloeki on Monday April 13, 2020 @06:08AM (#22854467)
Just updated kd with a long-time feature I wanted: tty detection!

   kd f             # => jumps to foo
   echo $(kd f)     # => outputs foo's path
   # some creative, if nonsensical, examples:
   cp some/file $(kd foo)/app/controllers/whatevs
   cp $(kd bar)/Gemfile $(kd foo)/Gemfile
   kd foo && cd app/controllers && cp $(kd)/config/whatever .
This is useful and possible because kd's output is stable and predictable: it always returns the last prefix match of the kdrc file (or, without argument, the project's top-level dir), and it returns non-zero rc on failure. Plus zsh will even gladly expand the result on <TAB> for double checking.