如何有效地重新排序tmux中的窗口?例如,拥有这组窗口:
0:zsh 1:elinks 2:mutt 3:irssi 4:emacs 5:rss 6:htop要将rss移到elinks和mutt之间,我需要做什么呢?
0:zsh 1:elinks 2:rss 3:mutt 4:irssi 5:emacs 6:htop我知道如何使用move-window将窗口移动到一个尚未使用的索引中,我可以使用其中的一系列来实现这一点--但显然,这非常繁琐。
发布于 2014-08-21 08:03:41
swap-window可以帮助您:
swap-window -t -1它将当前窗口向左移动一个位置。
来自曼图克斯:
swap-window [-d] [-s src-window] [-t dst-window]
(alias: swapw)
This is similar to link-window, except the source and destination windows are swapped.
It is an error if no window exists at src-window.您可以将其绑定到一个键:
bind-key -n S-Left swap-window -t -1
bind-key -n S-Right swap-window -t +1然后可以使用Shift+Left和Shift+Right更改当前窗口位置。
发布于 2019-06-19 05:43:33
虽然在最近的tmux版本中的行为显示交换窗口命令不能让您保持在同一个窗口上,但这个被接受并被高度支持的答案是正确的。因此,它的工作非常不直观,您的活动窗口将被交换到该方向,但您将停留在同一插槽!
要解决这个问题,只需增加绑定以遵循它。例如,在我的tmux配置中:
bind -n C-S-Left { swap-window -t -1; previous-window }
bind -n C-S-Right { swap-window -t +1; next-window }发布于 2016-01-21 12:32:19
如果tmux是1.7或更高版本
move-window -r或
set-option -g renumber-windows on在.tmux.conf中自动完成,在将来。
https://unix.stackexchange.com/questions/151329
复制相似问题