英文:
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.
{
"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"],
},
},
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论