OS X Lion has "Resume" feature, i. e. when you reopen an app it restores all windows and their contents. That works for Terminal as well. But if you use Zsh instead of Bash it doesn't restore opened directory. How can I fix this?
UPDATE: This isn't entirely correct, for reasons mentioned in the comments. Use the answer below. Thanks @ChrisPage for going the extra mile :)
The answer can be found by reverse engineering how bash does it in
|show 4 more comments|
Here's my adaptation of /etc/bashrc for zsh. I've included percent-encoding of all invalid URL characters, which is important if you want this to work with all valid file and directory names.
This is almost entirely done without invoking other programs, except that it requires running
Also, this version registers a chpwd hook instead of defining chpwd directly. This enables more than one function to be registered in other scripts and configuration files.