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

Heh, that was a fun one to figure out. When digging around in iTerm2 source, I found out that you can figure out the current working directory of the shell, so that was relatively easy.

The hard part was my goal of getting it to work even if you change the working directory, so that paths that were legit before stay legit. I found out that my shell sends an escape code that updated the terminal title when it changed directories, so I hooked it into that, but it turns out that's oh-my-zsh specific.

I also added the ability for it to work even with spaces, which is essentially a brute-force, so it's not pretty.



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

Search: