マスタ*_*ーダー 6 visual-studio-code
我通常使用Ctrl+ n/ Ctrl+p转到 VS Code 中的下一行/上一行。但有时它会让我感到沉闷,因为当我想随意浏览文件时,它的光标只走一行。
有没有办法让光标移动几行或其他更快速的方式来浏览文件(例如转到下一个类或方法定义)?
小智 8
免责声明:这并不完全是您想要的,但也许了解一下也会有用。
\n以下快捷键可用于在 VS Code 中插入新行(重复这些快捷键可根据需要插入任意多行):
\n
\n
\n\n\xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 VS Code使用户能够通过“keybindings.json”配置文件使用移动光标的导航类型命令来自定义键盘快捷键。正确配置“keybindings.json”文件后,您可以使用键盘快捷键向上跳转-lines、向下跳转-lines、向左跳转-chars或向右跳转-chars。
\nnnnn\n
\n- 注意: “
\nn可以等于任何数字”。
\n\n\xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 要在本主题涵盖的样式中导航光标,您将需要配置一些自定义的VS Code 按键绑定(也称为键盘快捷键)。如果这不是您之前做过的事情,则无需担心。将快捷方式绑定到独特的按键组合实际上非常简单,而且也可以是异想天开。它肯定会改善您的VS Code 体验。
\n要开始创建“跳线” 键盘快捷键,请按照以下说明操作。如果您在键绑定创建过程中需要任何额外帮助,您可以使用社区维护的官方VS Code文档作为指南。我已经发布了以下链接:
\nVS Code:键盘快捷键
\n
\xe2\x80\x93 使用按键F1打开“快速输入下拉菜单”
\n\xe2\x80\x93 在“快速输入菜单”中键入“键盘快捷键” 。
\n\xe2\x80\x93 选择“打开键盘快捷键(JSON)”
\n进入文件后keybindings.json,将以下“JSON”块添加到文件中
// "keybindings.json"\n\n{\n {\n "key": "ctrl+1",\n "when": "editorTextFocus",\n "command": "cursorMove",\n "args": {\n "by": "line",\n "to": "down",\n "value": 1\n }\n },\n\n {\n "key": "ctrl+2",\n "when": "editorTextFocus",\n "command": "cursorMove",\n "args": {\n "by": "line",\n "to": "down",\n "value": 5\n }\n },\n\n {\n "key": "ctrl+3",\n "when": "editorTextFocus",\n "command": "cursorMove",\n "args": {\n "by": "line",\n "to": "down",\n "value": 10\n }\n },\n\n {\n "key": "ctrl+shift+1",\n "when": "editorTextFocus",\n "command": "cursorMove",\n "args": {\n "by": "line",\n "to": "up",\n "value": 1\n }\n },\n\n {\n "key": "ctrl+shift+2",\n "when": "editorTextFocus",\n "command": "cursorMove",\n "args": {\n "by": "line",\n "to": "up",\n "value": 5\n }\n },\n\n {\n "key": "ctrl+shift+3",\n "when": "editorTextFocus",\n "command": "cursorMove",\n "args": {\n "by": "line",\n "to": "up",\n "value": 10\n }\n },\n}\n\nRun Code Online (Sandbox Code Playgroud)\n\n\n"以上仅用于测试目的,因为键绑定很简单,并且会覆盖默认的 VSCode 键绑定。但是,您必须决定哪种键绑定最适合您;如果将上述内容添加到您的“keybindings.json”文件中,您将获取以下 键盘快捷键“
\n
cursorMove命令 @ 的信息:| 归档时间: |
|
| 查看次数: |
13121 次 |
| 最近记录: |