Visual Studio Code Ctrl D



This extension makes it possible to select multiple occurrences of a selected text for simultaneous editing with multiple cursors. Provides the most common multi-editing features.

Aims to replicate the multi-editing features of Sublime Text/Visual Studio Code for faster coding.

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform.

Ctrl+Shift+D, 1: Debug.ParallelWatch2: Ctrl+Shift+D, 2: Debug.ParallelWatch3: Ctrl+Shift+D, 3: Debug.ParallelWatch4: Ctrl+Shift+D, 4: Debug.Processes: Ctrl+Alt+Z: Debug.QuickWatch: Shift+F9 or Ctrl+Alt+Q: Debug.RefreshWindowsapp: Ctrl+Shift+R: Debug.Registers: Ctrl+Alt+G: Debug.Restart: Ctrl+Shift+F5: Debug.RunToCursor: Ctrl+F10: Debug.SetNextStatement: Ctrl+Shift+F10. If you do not want to add all occurrences of the current selection, you can use ⌘D (Windows, Linux Ctrl+D) instead. This only selects the next occurrence after the one you selected so you can add selections one by one. Column (box) selection. You can select blocks of text by holding Shift+Alt (Shift+Option on macOS) while you drag your mouse. A separate cursor will be added to the end of.

What differs this from the built-in multi-edit of VS 2019?

FeatureSelect Next OccurrenceVisual Studio
Multiple cursorsYesYes
Can undo cursorYesYes
Can select all occurrencesYesYes
Can skip occurrenceYesYes
Can select backwards/upYesNo
Can add caret above/belowYesNo
Can add caret by mouseYesNo
Can convert selection to caretsYesNo
Can search both case insensitive and exactYesNo, only exact
Multi copy/paste across files and to external programsYesNo
Supports VS 2019YesYes
Supports VS 2017YesFrom v15.8
Supports VS 2015YesNo
Multi-cursor IntelliSenseNoNo

Features

  • Select next occurrence of current selection
  • Select next exact occurrence (overrides Find-dialog)
  • Select previous occurrence
  • Select previous exact occurrence (overrides Find-dialog)
  • Select all occurrences
  • Convert a selection into multiple cursors
  • Skip occurrence
  • Undo occurrence
  • Add caret above/below
  • Use multiple carets to edit
  • Add carets by mouse-clicking, press ALT and click to add a new caret or to remove caret/selection at clicked position
  • Copy/paste multiple selections, also to external programs


Options

  • Toggle case-sensitive search by using the 'Match case' setting from the find-dialog (Ctrl+F)
  • Toggle match-whole word search by using the 'Match whole word' setting from the find-dialog (Ctrl+F)
  • Options-dialog: Add cursors by mouse-clicking - true by default
  • Options-dialog: Keep caret on first entry - false by default, activates behaviour to keep caret on first entry when pressing escape


Key-bindings

Go to Tools -> Options -> Keyboard and search for these command names to edit at your choice. Make sure the Use new shortcut in is set to: Text Editor

Command (prefix SelectNextOccurrence.)Recommendation
SelectNextOccurrenceCtrl+D
SelectNextExactOccurrence
SelectPreviousOccurrenceCtrl+E
SelectPreviousExactOccurrence
SelectAllOccurrencesCtrl+K, Ctrl+A
SkipOccurrenceCtrl+K, Ctrl+D
UndoOccurrenceCtrl+U
AddCaretAboveCtrl+Alt+Up
AddCaretBelowCtrl+Alt+Down
ConvertSelectionToMultipleCursorsCtrl+Shift+I or Alt+Shift+I (vscode))


Troubleshooting

  • Nothing happens when pressing assigned keys

Check that the key-bindings are correct and that the Use new shortcut in is set to: Text Editor.

  • Nothing happens when ALT + left-clicking mouse button to add new caret, multiple edits are unresponsive
Visual Studio Code Ctrl D

There is a possibility that other plugins use this functionality too, and a conflict occurs. Please check for other installed plugins with this feature and try to disable.

Visual Studio Code Ctrl D
  • Copy/cut multiple occurrences doesnt work as expected

There is a conflict with the extension Copy As Html, if you have this enabled, try to disable it and see if this helps.

Visual Studio Code Disable Ctrl Click


Visual

Visual Studio Code Ctrl Design

Donations

This is absolutely 100% free, a review or a Github star is much appreciated. If you still would like to support me for whatever reason, I'd accept a donation at https://www.paypal.me/thomaswelen

Visual Studio Code Ctrl D Case Sensitive

Visual studio code ctrl design

(Total amount donated up to 2021-04-04: $20)

Happy coding