gpt4 book ai didi

visual-studio-code - Visual Studio Code - 如何使用 [Alt]+[Left/Right] 逐字跳转

转载 作者:行者123 更新时间:2023-12-04 14:47:47 27 4
gpt4 key购买 nike

我已经开始在 MacOS 上使用 Visual Studio Code。

使用 Alt+Left/Right 跳转真的很烦人,因为它会跳转到完整的标识符,而不仅仅是一个单词。

例子:

  • ▼create_foo() Alt+Right create_foo▼()
  • ▼createFoo() Alt+Right createFoo▼()

  • 我想例如Ctrl+Right 执行上述操作并修改 Alt+Right 的行为,使其按单词跳转。

    我想要的行为:
  • ▼create_foo() Alt+Right create_▼foo()
  • ▼create_foo() Ctrl+右键 create_foo▼()

  • 解决方案:

    我的期末 keybindings.json使用添加的 Shift(选择)选项进行配置:
    [
    {
    "key": "alt+left",
    "command": "cursorWordPartLeft",
    "when": "editorTextFocus",
    },
    {
    "key": "alt+right",
    "command": "cursorWordPartRight",
    "when": "editorTextFocus",
    },
    {
    "key": "shift+alt+left",
    "command": "cursorWordPartLeftSelect",
    "when": "editorTextFocus"
    },
    {
    "key": "shift+alt+right",
    "command": "cursorWordPartRightSelect",
    "when": "editorTextFocus"
    },
    {
    "key": "ctrl+left",
    "command": "cursorWordStartLeft",
    "when": "editorTextFocus"
    },
    {
    "key": "ctrl+right",
    "command": "cursorWordEndRight",
    "when": "editorTextFocus"
    },
    {
    "key": "shift+ctrl+left",
    "command": "cursorWordStartLeftSelect",
    "when": "editorTextFocus"
    },
    {
    "key": "shift+ctrl+right",
    "command": "cursorWordEndRightSelect",
    "when": "editorTextFocus"
    },
    ]

    最佳答案

    你正在寻找

    cursorWordPartRight

    绑定(bind)到 Shift-Alt-Q。

    Alt-Right 绑定(bind)到“ Go Forward”命令,您可以删除该绑定(bind)并将其用于 cursorWordPartRight命令。
    {
    "key": "alt+right",
    "command": "cursorWordPartRight",
    "when": "editorTextFocus",
    },
    {
    "key": "alt+left",
    "command": "cursorWordPartLeft",
    "when": "editorTextFocus",
    }

    它可能需要每个语言解析器都支持它。它确实在 JavaScript 中工作。
    cursorWordPartLeft (command exists but is unbound by default).

    还有这些其他未绑定(bind)的相关命令:
    cursorWordPartRightSelect
    cursorWordPartLeftSelect
    cursorWordPartStartLeft
    cursorWordPartStartLeftSelect

    关于visual-studio-code - Visual Studio Code - 如何使用 [Alt]+[Left/Right] 逐字跳转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54746506/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com