Keep current working directory when opening a new tab in Terminal.app with Mac OS X Lion and tcsh

Mac OS X Lion has a lot of new features. Even the Terminal.app was improved.

When you open a new tab it automatically changes the working directory to the one of the old tab. But if you’re using tcsh this great new feature won’t work by default. You have to tell Terminal.app the current working directory using escape sequences. This is also stated in the preferences of Terminal.app but it does not say how to do it.

With a little research I found the solution in the Linux-mini How-To of Xterm. Put the following lines in your .tcshrc file and Terminal.app will always know your current working directory


switch ($TERM)
case "xterm*":
alias precmd 'printf "\033]0;$cwd\007"'
breaksw
endsw


blog comments powered by Disqus