如何恢复VS Code中Ctrl+D的选择性多选中编辑快捷键?
Got it, let's get your Ctrl+D working again—this is such a handy feature, so I totally get why you want it back!
The issue here is that your keybindings.json has a disabled version of the Ctrl+D command. That leading - in the command field tells VS Code to override and turn off the default binding. Here's how to fix it in two straightforward ways:
Option 1: Remove the Disabled Binding (Quickest Fix)
- Open the command panel with
Ctrl+Shift+Pand runPreferences: Open Keyboard Shortcuts (JSON)(you already nailed this step, nice!). - Delete the entire entry that looks like this:
{ "key": "ctrl+d", "command": "-editor.action.addSelectionToNextFindMatch", "when": "editorFocus" } - Save the
keybindings.jsonfile (just hitCtrl+S).
VS Code will automatically fall back to its default key binding for Ctrl+D, which is exactly the multi-select functionality you need.
Option 2: Explicitly Re-Enable the Command
If you prefer to have a clear, custom binding (maybe to avoid future mix-ups), you can modify the existing entry instead of deleting it:
- In the same
keybindings.jsonfile, change thecommandvalue by removing the leading-so it looks like this:[ { "key": "ctrl+d", "command": "editor.action.addSelectionToNextFindMatch", "when": "editorFocus" } ] - Save the file.
Check if It Works
Head back to any editor tab, select a word, and press Ctrl+D—you should see the next matching word get selected, and pressing it again will keep adding more matches as expected.
If you still run into issues, you can check for conflicting bindings: open the regular keyboard shortcuts menu (Ctrl+K Ctrl+S), search for editor.action.addSelectionToNextFindMatch, and make sure no other key combo is overriding Ctrl+D.
内容的提问来源于stack exchange,提问作者user6746919

