你可以快速在VS Code中水平滚动吗?

huangapple go评论63阅读模式
英文:

How can I quickly scroll horizontally in VS Code?

问题

垂直滚动时,我习惯使用页面上和页面下键盘按键。我还知道我可以按住 alt 键,使用滚轮/触摸板来快速垂直滚动。在VS Code中有类似的快速水平滚动操作吗?

英文:

For vertical scrolling, I am used to using page up and page down keyboard keys. I also know that I can hold <kbd>alt</kbd> to scroll quickly vertically with the scrollwheel / touchpad. Are there analogous actions for scrolling horizontally quickly in VS Code?

答案1

得分: 0

据我所知,在撰写此文时,Visual Studio Code 中没有用于按页面水平滚动的键盘快捷命令,但您可以通过使用 runCommands 并将键盘快捷方式绑定到多次调用水平滚动命令的方式来实现一个简陋的解决方案。例如:

{
    "key": "ctrl+alt+left",
    "command": "runCommands",
    "args": {
        "commands": ["scrollLeft","scrollLeft","scrollLeft","scrollLeft","scrollLeft"],
    },
},
{
    "key": "ctrl+alt+right",
    "command": "runCommands",
    "args": {
        "commands": ["scrollRight","scrollRight","scrollRight","scrollRight","scrollRight"],
    },
},

如果您喜欢历史记录,添加水平滚动命令的功能请求是 Add keyboard shortcuts for scrolling horizontally
#143466

至于滚轮和触控板,相同的 <kbd>alt</kbd> 功能应该适用于水平滚动(通过按住 <kbd>shift</kbd> 实现),因此您可以在滚动时同时按住 <kbd>shift</kbd>+<kbd>alt</kbd>。

英文:

As far as I'm aware, at the time of this writing, there is no keyboard shortcut command in VS Code for scrolling horizontally by pages, but you can hack a shoddy solution by just using runCommands and binding keyboard shortcuts to invoke the horizontal scroll commands multiple times. Ex.

{
    &quot;key&quot;: &quot;ctrl+alt+left&quot;,
    &quot;command&quot;: &quot;runCommands&quot;,
    &quot;args&quot;: {
        &quot;commands&quot;: [&quot;scrollLeft&quot;,&quot;scrollLeft&quot;,&quot;scrollLeft&quot;,&quot;scrollLeft&quot;,&quot;scrollLeft&quot;],
    },
},
{
    &quot;key&quot;: &quot;ctrl+alt+right&quot;,
    &quot;command&quot;: &quot;runCommands&quot;,
    &quot;args&quot;: {
        &quot;commands&quot;: [&quot;scrollRight&quot;,&quot;scrollRight&quot;,&quot;scrollRight&quot;,&quot;scrollRight&quot;,&quot;scrollRight&quot;],
    },
},

If you like history, the feature-request that got the horizontal scrolling commands added was Add keyboard shortcuts for scrolling horizontally
#143466
.

As for the scrollwheel and touchpad, the same <kbd>alt</kbd> feature should work for horizontal scrolling (which is done by holding <kbd>shift</kbd>), so you'd hold <kbd>shift</kbd>+<kbd>alt</kbd> while scrolling.

huangapple
  • 本文由 发表于 2023年7月6日 17:21:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76627334.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定