Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
    
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 at 13:55

2 Answers 2

Try setting either:

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

or

bind c new-window -c "$PWD"

I'm using git master and the first option works for me. I saw the second option while looking for a fix to my problem.

Sidenote. 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 but there are an upstream commit removing it from the manpage so it might not be available in the future.

share|improve this answer

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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