Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Can anyone help me set up this configuration?

If I create a new pane, the new pane should start out in the same working directory as the pane I was just in. If I create a new window, the new window should start out in the home directory (or any other global default path).

Is this possible with tmux 1.8?

share|improve this question

marked as duplicate by Jeff Schaller, Stephen Kitt, Kusalananda, sam, mdpc 2 days ago

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Despite I answered here, I consider this question a duplicate of unix.stackexchange.com/q/12032/5576 . Don't know how to ask a moderator to mark this as such. – mmoya Jan 15 '14 at 13:55

Try setting:

bind c new-window -c "#{pane_current_path}"

In my case new panes were failing as well to start in the current directory. Adding -c "#{pane_current_path}" to the split-window bindings fixed that.

I found the pane_current_path trick here. It's also documented in upstream CHANGES.

share|improve this answer
For me, $PWD does not work, but #{pane_current_path} works. – Henry Hu Nov 7 '15 at 4:11

While @mmoya's answer works for tmux version 1.9 and beyond, the -c option for new-window is not present in earlier versions. For earlier versions, this requires a bit of mucking with default-path. Here is how I have it set up in my .tmux.conf file.

set -g default-path "~"
bind % set default-path "" \; split-window -h \; set -u default-path
bind '"' set default-path "" \; split-window -v \; set -u default-path

This makes the new-window command use the global default-path. However, when splitting a window into panes, it makes a local default-path to override it.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.