debugging - 无法在 vscode 中使用 alt+arrow 切换 tmux Pane

标签 debugging visual-studio-code tmux

我是一名 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/

相关文章:

debugging - 用于根据行号设置断点的 CDB 命令

javascript - vscode 不跳转到定义

c# - 如何在 Visual Studio Code 上生成 switch 语句标签?

visual-studio-code - 如何摆脱 VSCode 中的这个弹出窗口?

tmux - 如何使用 bash 命令在 byobu 中创建 byobu session

shell - 导致隐藏状态消息的 tmux 选项是什么?

debugging - 从 REPL 访问 Hunchentoot 请求对象以进行调试

eclipse - 设置 maven+jetty+eclipse 的调试配置

c - 在 Windows 上调试 R 的编译代码

terminal - tmux 命令在创建窗口时不起作用?