我是一名 tmux 用户,个人更喜欢使用 alt
+arrow
切换面板。但是,在 vscode 中,它不起作用。甚至我尝试删除默认键绑定(bind)以防止重叠。
我尝试绑定(bind)到 alt
+u/h/j/k
并且它工作正常。我认为 vscode 中的 alt
+arrow
键绑定(bind)有问题。是否有任何我没有找到的设置或它是一个错误?
keybinding.json - vscode
{
"key": "alt+up",
"command": "-workbench.action.terminal.focusPreviousPane",
"when": "terminalFocus"
},
{
"key": "alt+down",
"command": "-workbench.action.terminal.focusNextPane",
"when": "terminalFocus"
},
{
"key": "alt+left",
"command": "-workbench.action.terminal.focusPreviousPane",
"when": "terminalFocus"
},
{
"key": "alt+right",
"command": "-workbench.action.terminal.focusNextPane",
"when": "terminalFocus"
}
.tmux.conf
# switch panes with "(alt) + (↑ ↓ ← →)"
## This does not work in vscode integrated terminal
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
## This do work
bind -n M-u select-pane -U
bind -n M-j select-pane -D
bind -n M-h select-pane -L
bind -n M-k select-pane -R
最佳答案
when
子句已更改,因此这些键绑定(bind)实际上并未被删除。您可以通过更改日志级别来跟踪和查看 devtools 控制台来检查这一点。
忽略这些键绑定(bind)的更好方法是通过此设置将它们从发送序列到 shell 的优先级中移除:
"terminal.integrated.commandsToSkipShell": [
"-workbench.action.terminal.focusPreviousPane",
"-workbench.action.terminal.focusNextPane",
"-workbench.action.terminal.focusPreviousPane",
"-workbench.action.terminal.focusNextPane",
],
关于debugging - 无法在 vscode 中使用 alt+arrow 切换 tmux Pane ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60148184/