Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: