visual-studio-code - Visual Studio Code : How to define key bindings for page-home and page-end

标签 visual-studio-code key-bindings

在编写代码时,我经常发现自己需要跳转到文件的顶部或底部,但我找不到通过一次按键即可快速完成此操作的方法。我试图在键绑定(bind)中定义一个快捷方式,但我找不到像“page-home”和“page-end”这样的功能。我打算使用带有主页按钮的 alt 键跳转到页面顶部,并使用 alt+end 跳转到底部。

即我期望能够定义说:

{ "key": "alt+home", "command": "[what is page home command]", "when": "terminalFocus"}

那么,是否有这样的函数 page-home/page-end (我可能有这个错误,也许它被定义为其他东西)。

我发现了一个绑定(bind)到“workbench.action.terminal.scrollToTop”的“cmd+home”绑定(bind),这听起来像是正确的函数(和“cmd+end”的类似函数),但它们不是工作。

更新:我已经尝试通过键绑定(bind)页面,通过定义我之前提到的击键来对键绑定(bind)应用更改,但它仍然不起作用。除非我做错了什么,否则我 .认为有一个错误需要报告,除非有人另有说明。

谢谢。

最佳答案

答案在this GitHub post中.您要查找的命令是 cursorTopcursorBottom

打开命令选项板(CTRL + SHIFT + P 在 Windows 上)并选择 Preferences: Open Keyboard Shortcuts File

keybindings.json 中添加以下设置:

{
    "key": "ctrl+home",
    "command": "cursorTop",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+end",
    "command": "cursorBottom",
    "when": "editorTextFocus"
}

用您喜欢的任何快捷方式替换该键。

关于visual-studio-code - Visual Studio Code : How to define key bindings for page-home and page-end,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50887550/

相关文章:

javascript - 我如何解决 'Property ' 宽度'在类型 'HTMLElement' 上不存在。'在 vscode 中使用//@ts-check 类型检查 Javascript(不是 Typescript)时?

c++ - VSCode C++编译错误: How to link an additional library (*.lib)?

sublimetext3 - 如何在 Sublime Text 3 中绑定(bind) double shift [shift+shift] 快速打开文件?

emacs:将数字行的绑定(bind)切换为等效的 <shift>-ed

java - Keymap、InputMap、ActionMap、KeyListener — 选择重载

c# - VS Code 1.19.3 调试.net core 2 总是遇到 "Only 64-bit processes can be debugged"

visual-studio-code - "code ."命令不起作用

visual-studio-code - 如何在 VS Code 中将文件从一台计算机同步/共享到另一台计算机?

java - 如何为 java.awt.Frame 进行键绑定(bind)?

Java:覆盖后调用原始按键操作