Is is possible to open a
new-window with its working directory set to the one I am currently in. I am using zsh, if it matters.
Starting in tmux 1.9 the
A relevant feature landed in the tmux SVN trunk in early February 2012. In tmux builds that include this code, tmux key bindings that invoke
This uses special platform-specific code, so only certain OSes are supported at this time: Darwin (OS X), FreeBSD, Linux, OpenBSD, and Solaris.
This should be available in the next release of tmux (1.7?).
With tmux 1.4, I usually just use
in a shell that already has the desired current working directory.
If, however, I anticipate needing to create many windows with the same current working directory (or I want to be able to start them with the usual <prefix>
in a shell that already has the desired current working directory (though you could obviously do it from any directory and just specify the value instead).
The tmux FAQ has an entry titled “How can I open a new window in the same directory as the current window?” that describes another approach; it is a bit convoluted though.
The current (1.9a) tmux man page lists an optional
By combining these, we can open a new window with the current working directory using
If you want to split the current pane vertically, use
To make the key bindings open new splits and windows with the current working directory by default, add the following to your
With recent versions of tmux (v1.8, but maybe in v1.7 too):
The safest option is in mislav's answer: add
I'm using git master (
There is also another upstream commit removing
Disclaimer: Added this for the sake of completeness, I first answered here but that question is an obvious duplicate of this one.
The other answers does not work for me when I try put them as bindings (specifically
Works, at least, with $(tmux -V) 1.8. See out-commented lines here for a version working for older tmuxes that don't have the show-environment command.