'How to customize functionality of "Delete Line" hotkey in Visual Studio Community 2022?
In most IDE's I've used, including VS Code, the "Edit.LineDelete" keyboard shortcut deletes the line and tries to keep the cursor in the same place on the following line. For example, this shortcut is Ctrl+Shift+K in VS Code and Ctrl+Y in IntelliJ, and does the following:
// I've used a pipe here to represent the cursor movement...
/* BEFORE line delete */
{
...
int foo = 0; |
foo++;
}
/* AFTER line delete */
{
...
int foo = 0;
foo++;|
}
However, Visual Studio Community Edition (both 2017 and 2022) seem to have a unique way of handling this. Instead of trying to keep the cursor in the same position, it immediately sends the cursor to the very beginning of the line (even before tab spaces). See the following:
/* AFTER line delete on Visual Studio Community */
{
...
int foo = 0;
| foo++;
}
This is extremely annoying for me, as it requires extra work (mouse or End key) to get the cursor back to a useful location. I'm not even sure why they would make this work nicely in VS Code but not VS Community Edition.
Is there a way to change this functionality to mirror the behavior in VS Code or IntelliJ? I don't know of any built-in support for macros, and it seems like overkill to get an extension just for this change. Am I missing something?
NOTE: A similar question was asked here, but I'm looking to do the exact opposite.
Solution 1:[1]
The default shortcut is Ctrl + Shift + L
see: https://visualstudio.microsoft.com/keyboard-shortcuts.pdf
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Luca |
