I recently moved from GNU screen to tmux.
I find it quite similar but with bigger support (I switched due to problem with escape-time in neovim– resolution was only for tmux).
Unfortunately in tmux I'm unable to find a similar command to this:
screen -X eval "chdir $(some_dir)"
The command above changed the default directory for new window/screen/pane from within the GNU screen so when I pressed Ctrl+a (similar to tmux Ctrl+b)- new window opened in the $(some_dir)
directory.
Is there a similar thing in tmux?
ANSWER:
I have used @Lqueryvg answer and combined it with @Vincent Nivoliers suggestion froma a comment and that gave me a new binding for a command attach -c "#{pane_current_path}"
which sets my current directory as a default one.
Thanks.
Best Answer
Start
tmux
as follows:Now, any new windows (or panes) you create will start in directory
/aaa/bbb
, regardless of the current directory of the current pane.If you want to change the default directory once
tmux
is up and running, useattach-session
with-c
.Quoting from the
tmux
man page forattach-session
:For example:
Ctrl+b :
attach -c /ddd/eee
New windows (or panes) will now start in directory
/ddd/eee
, regardless of the directory of the current pane.