new-window but from which pane ?

20 views
Skip to first unread message

M Kelly

unread,
Sep 22, 2020, 2:51:43 PM9/22/20
to tmux-users
Hi,

I have this binding -
bind-key  -T prefix  c  new-window -c "#{pane_current_path}"

Is there a way to know what pane this was typed from ?
And then can I execute a cmd "in that pane" before starting a new window ?
I want to get the env and history from the pane/shell the prefix-c was typed from and set something as part of the new window/shell.

thx for awesome tmux,
-mark

Nicholas Marriott

unread,
Sep 22, 2020, 3:00:26 PM9/22/20
to M Kelly, tmux-users
If you run a command without -t it will work out the best pane which if it is run from a key binding will be the active pane in the current window in the attached session, so you should be able to do for example:

bind c send abcdef \; new-window -c "#{pane_current_path}"



--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/f38a41ad-becb-4821-823f-a03b98116faan%40googlegroups.com.

M Kelly

unread,
Sep 22, 2020, 3:24:42 PM9/22/20
to tmux-users
Hi,

ok, great.
Easier than I thought!

take care,
-m

M Kelly

unread,
Sep 22, 2020, 4:59:27 PM9/22/20
to tmux-users
Hi,

Well, I couldn't do a run-shell because that always seemed to spawn from tmux server.
But I could run-shell a cmd and pass in #{pane_pid} as an arg and get the env from that and do what I needed.
So cool.

thx,
-m

Reply all
Reply to author
Forward
0 new messages