我有这个+x脚本
~/bin/tmux-test.sh
:
#!/usr/bin/bash
tmux neww
在我的
.tmux.conf
:
bind -n M-g run-shell `~/bin/tmux-test.sh`
它有效...
...但是如果我将
tmux neww
更改为 tmux new
(用于创建新会话),那么当我按下 keybind tmux 时,屏幕上会显示此错误:
'/home/me/bin/tmux-test.sh' returned 1
我做错了什么?
首先,tmux 不支持
`..`
样式引用。
默认情况下,如果您已经在 tmux 中,
tmux
将拒绝创建新会话:
$ echo $TMUX
/private/tmp/tmux-502/default,2554,0
$ tmux new
sessions should be nested with care, unset $TMUX to force
您可以使用
tmux new -d
创建一个 detached 会话,然后切换到它。
tmux new -d -s foo
tmux switch-client -t foo
true
bind -n M-g run-shell ~/bin/tmux-test.sh