How to split the window that ran the âtmux split-windowâ command instead of the current one?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
For example, if I run from window 0:
sleep 2;tmux split-window -h
and switch to another window 1 with prefix-n before the sleep is over, the window split happens on the new window 1.
How to make the split always happen on window 0 when the command is run from window 0, regardless of the current window?
I have found this possibility:
win="$(tmux display-message -p '#I')";sleep 2;tmux split-window -h -t "$win"
based on: https://superuser.com/questions/385472/get-current-window-number-for-bash-prompt but I don't like it forces me to run an extra command before sleep 2 (which is a real useful command that takes a long time to finish in my use case), which is cumbersome.
Tested on tmux 2.5.
https://groups.google.com/forum/#!topic/tmux-users/ZtEuCZQS_lI
tmux
add a comment |Â
up vote
0
down vote
favorite
For example, if I run from window 0:
sleep 2;tmux split-window -h
and switch to another window 1 with prefix-n before the sleep is over, the window split happens on the new window 1.
How to make the split always happen on window 0 when the command is run from window 0, regardless of the current window?
I have found this possibility:
win="$(tmux display-message -p '#I')";sleep 2;tmux split-window -h -t "$win"
based on: https://superuser.com/questions/385472/get-current-window-number-for-bash-prompt but I don't like it forces me to run an extra command before sleep 2 (which is a real useful command that takes a long time to finish in my use case), which is cumbersome.
Tested on tmux 2.5.
https://groups.google.com/forum/#!topic/tmux-users/ZtEuCZQS_lI
tmux
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
For example, if I run from window 0:
sleep 2;tmux split-window -h
and switch to another window 1 with prefix-n before the sleep is over, the window split happens on the new window 1.
How to make the split always happen on window 0 when the command is run from window 0, regardless of the current window?
I have found this possibility:
win="$(tmux display-message -p '#I')";sleep 2;tmux split-window -h -t "$win"
based on: https://superuser.com/questions/385472/get-current-window-number-for-bash-prompt but I don't like it forces me to run an extra command before sleep 2 (which is a real useful command that takes a long time to finish in my use case), which is cumbersome.
Tested on tmux 2.5.
https://groups.google.com/forum/#!topic/tmux-users/ZtEuCZQS_lI
tmux
For example, if I run from window 0:
sleep 2;tmux split-window -h
and switch to another window 1 with prefix-n before the sleep is over, the window split happens on the new window 1.
How to make the split always happen on window 0 when the command is run from window 0, regardless of the current window?
I have found this possibility:
win="$(tmux display-message -p '#I')";sleep 2;tmux split-window -h -t "$win"
based on: https://superuser.com/questions/385472/get-current-window-number-for-bash-prompt but I don't like it forces me to run an extra command before sleep 2 (which is a real useful command that takes a long time to finish in my use case), which is cumbersome.
Tested on tmux 2.5.
https://groups.google.com/forum/#!topic/tmux-users/ZtEuCZQS_lI
tmux
edited Apr 22 at 20:13
asked Apr 20 at 21:55
Ciro Santilli æÂ°çÂÂæÂ¹é ä¸Âå¿ å ÂÃ¥ÂÂäºÂä»¶ æ³Âè½®åÂÂ
4,04613533
4,04613533
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
$TMUX_PANE
tmux automatically defines this variable for us, and it just works:
sleep 2;tmux split-window -h -t $TMUX_PANE
This gives focus to the split when it gets created, this can be prevented with -d:
sleep 2;tmux split-window -dh -t $TMUX_PANE
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
$TMUX_PANE
tmux automatically defines this variable for us, and it just works:
sleep 2;tmux split-window -h -t $TMUX_PANE
This gives focus to the split when it gets created, this can be prevented with -d:
sleep 2;tmux split-window -dh -t $TMUX_PANE
add a comment |Â
up vote
0
down vote
$TMUX_PANE
tmux automatically defines this variable for us, and it just works:
sleep 2;tmux split-window -h -t $TMUX_PANE
This gives focus to the split when it gets created, this can be prevented with -d:
sleep 2;tmux split-window -dh -t $TMUX_PANE
add a comment |Â
up vote
0
down vote
up vote
0
down vote
$TMUX_PANE
tmux automatically defines this variable for us, and it just works:
sleep 2;tmux split-window -h -t $TMUX_PANE
This gives focus to the split when it gets created, this can be prevented with -d:
sleep 2;tmux split-window -dh -t $TMUX_PANE
$TMUX_PANE
tmux automatically defines this variable for us, and it just works:
sleep 2;tmux split-window -h -t $TMUX_PANE
This gives focus to the split when it gets created, this can be prevented with -d:
sleep 2;tmux split-window -dh -t $TMUX_PANE
edited Apr 22 at 21:12
answered Apr 20 at 21:55
Ciro Santilli æÂ°çÂÂæÂ¹é ä¸Âå¿ å ÂÃ¥ÂÂäºÂä»¶ æ³Âè½®åÂÂ
4,04613533
4,04613533
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f439031%2fhow-to-split-the-window-that-ran-the-tmux-split-window-command-instead-of-the%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password