NOTE: This is the legacy version of the extension, supporting Visual Studio 2010. For the current version, go here. This Visual Studio extension adds a "Duplicate Selection" command that you can bind to a keyboard shortcut of your choosing (but I recommend Ctrl+D).When invoked, the command inserts whatever text you have selected in front of the current selection.Alternatively, if you do not have a selection, it duplicates the line the caret is on. Key BindingTo change the keyboard shortcut that the command is bound to, go into Tools > Options > Keyboard, and type "Duplicate" in the search box (the full command string is "Edit.DuplicateSelection"). Here you can bind it to any shortcut in the same way you would for any other command. ExamplesBelow are some before and after screenshots to help illustrate what the command will do in different situations.
If you select multiple lines but the selection does not encompass each line entirely, all lines that your selection touches will be duplicated.
The source code is available on Github: http://github.com/ctlajoie/DupSelection |