Saturday, December 07, 2019

Re: tmux: How to create a new window with the same path (from the current pane)

On 2019-11-26 17:38, Anders Damsgaard wrote:
> * Atanas Vladimirov <vlado@bsdbg.net> [2019-11-26 17:10:14 +0200]:
>
>> So, if I understand your example right, I need to do something like
>> `bind c new-window -c "$PWD"` in my .tmux.conf.
>> The problem is that it works partially - if I'm in
>> `/home/<myhome>/<some_directory>` and start tmux there,
>> the $PWD is correct, but when I change the directory and create a new
>> window with `C-b c` it moves me to the initial $PWD (when the tmux was
>> started)
>> instead of the current directory.
>
> I don't bind in .tmux.conf, but you could do:
>
> bind c send-keys "tmux new-window -c \"$(pwd)\"" C-m
> bind C send-keys "tmux split-pane -c \"$(pwd)\"" C-m
>
> but it needs a shell prompt in the currently active pane.
>
> Cheers, Anders

Thanks Anders,
That works as it should :)

No comments:

Post a Comment