乐闻世界logo
搜索文章和话题

How can I change keyboard shortcut bindings in Visual Studio Code?

1个答案

1
  1. Open Keyboard Shortcuts Settings: You can access the Keyboard Shortcuts settings in two ways:

    • Use the shortcut Ctrl+K Ctrl+S (Windows/Linux) or Cmd+K Cmd+S (Mac).
    • Click the settings icon (gear-shaped icon) in the left sidebar and select "Keyboard Shortcuts".
  2. Search and Modify Shortcuts: In the Keyboard Shortcuts interface, you'll see a search bar where you can enter the command name or related keywords to change. For example, to modify the shortcut for "copy", type "copy" in the search bar.

The search results will list all keyboard shortcut bindings related to "copy". Next to the command you want to modify, click the pencil icon (edit button) to enter a new shortcut combination.

  1. Enter New Shortcuts: In the edit box, input the new shortcut combination you want to set. For instance, to change the "copy" command to Ctrl+Shift+C, simply press these keys. Ensure the selected shortcut does not conflict with other critical commands.

  2. Save and Apply Changes: After entering the new shortcut, press Enter to confirm. The system will automatically save your changes. If a conflict arises with an existing shortcut, the system will prompt you; decide whether to keep the change or select a different combination.

  3. Edit via JSON File (Optional): Advanced users can directly modify shortcuts by editing the keybindings.json file. In the top-right corner of the Keyboard Shortcuts interface, click the icon to open the JSON file (looks like a file icon). This will display all custom shortcut bindings; you can edit or add new bindings here:

    json
    [ { "key": "ctrl+shift+c", "command": "editor.action.clipboardCopyAction", "when": "editorTextFocus" } ]

These steps will help you effectively customize and manage keyboard shortcuts in Visual Studio Code, improving your development efficiency.

2024年8月10日 08:18 回复

你的答案