Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iTerm2 and tmux: open new tab in working directory of current tab

When I open a new tab (via ⌘T) on a remote shell using iTerm2 and tmux, I almost always want the new tab to have the same working directory as the current tab. The best I can do is make iTerm2 open up the new tab in the same directory in which I ran tmux -CC or tmux -CC attach. (This behavior can be configured by navigating to Preferences → Profiles → General → Working Directory.)

This directory will not necessarily be the working directory of the current tab. Is there any way to get the behavior I'm looking for? I searched online for a while but could not find any helpful information.

like image 289
void-pointer Avatar asked Apr 18 '15 14:04

void-pointer


1 Answers

When using Iterm2, if you want a new tab to open in the same directory as the current tab via ⌘T, there is an option available in your profile under preferences.

From the iTerm2 main menu:

Iterm2 -> Preferences -> profiles -> working directory -> Reuse Previous Session Directory

like image 134
Parker Tailor Avatar answered Sep 22 '22 12:09

Parker Tailor