Say you are in /very/cool/and/deeply/nested/folder . And you want to open a new terminal tab in the same folder.
How would you do that?
I use Mac OS and Zsh.
|
|
|
Use Oh-My-Zsh and add the 'osx' plugin in your ~/.zshrc like:
That's all you need to do! |
|||||||||||||
|
|
Another option now available in Mac OS X Lion is using the built-in feature. It uses 'escape sequences' to find out the current directory. For me it works if I use these commands in my .zshrc:
it is also possible to use
where More information: |
|||||||||||||||
|
|
This is how you do it in bash. This shell script will tell (quiet literally, using Applescript) Terminal.app to open a new tab then switch to the current directory:
… put the above shell script in a directory in your
(source) |
|||||||||
|
|
gdirs seems like a way to almost do it: new tab, then gdirs to select the deep directory and voila. My first idea was to make the directory stack shared among all tabs and do cd ~1 after the new tab, but I cannot find how to do that, as it seems each instance of zsh keeps its own. History sharing goes via a common file, so maybe that could be done here too... |
|||
|
|
|
@Nifle's code does work. In ~/bin…
In my .profile I have the following:
If you don't have something like that, nt won't work. |
|||||
|
|
If you need to open this new tab right now, without changing your config files or installing new plugins, run this:
Then open a new Terminal tab manually (with ⌘T), and in the new tab:
Warning: this will overwrite the contents of the system clipboard. An alternative, longer method that does not overwrite the clipboard:
Open your new tab.
|
||||
|
|