You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode Notebook输出滚动HJKL快捷键配置及聚焦滚动问题

VSCode Notebook输出HJKL滚动配置及聚焦居中问题

一、修复HJKL按键滚动Notebook输出的配置

你当前使用的workbench.action.interactivePlayground.arrowUp/arrowDown是针对交互式Playground的专属命令,无法作用于Notebook输出区域。替换为通用的滚动行命令即可解决:

[
    // 单行上下滚动Notebook输出
    {
        "key": "k",
        "command": "scrollLineUp",
        "when": "notebookOutputFocused"
    },
    {
        "key": "j",
        "command": "scrollLineDown",
        "when": "notebookOutputFocused"
    },
    // 可选:添加横向滚动支持(针对宽输出内容)
    {
        "key": "h",
        "command": "scrollColumnLeft",
        "when": "notebookOutputFocused"
    },
    {
        "key": "l",
        "command": "scrollColumnRight",
        "when": "notebookOutputFocused"
    }
]

保存配置后重启VSCode,聚焦Notebook输出区域时,按K/J就能实现上下滚动,和箭头键效果一致。

二、聚焦Notebook输出并滚动至视图中心的方案

VSCode没有原生的单一命令同时实现“聚焦输出+滚动居中”,但可以通过宏命令组合两个动作完成:

  1. 安装Multi Command扩展(VSCode扩展市场中可搜索到)
  2. 在settings.json中添加宏配置:
"multiCommand.commands": [
    {
        "command": "multiCommand.focusNotebookOutputAndCenter",
        "sequence": [
            "notebook.focusOutput",
            "editorScroll.center"
        ]
    }
]
  1. 绑定自定义快捷键(示例绑定Ctrl+Shift+O,可按需修改):
{
    "key": "ctrl+shift+o",
    "command": "multiCommand.focusNotebookOutputAndCenter",
    "when": "notebookEditorFocused"
}

按下绑定的快捷键后,会自动聚焦当前活动单元格的输出,并将其滚动到视图中心位置。

内容的提问来源于stack exchange,提问作者Kael

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 10:22:13