There are tons of times where you want to delete from the right of your cursor, while preserving everything to the left of your cursor.
Today the most common way is to do SHIFT + END to highlight it all and then hit DEL, such as below.
However, there’s a way to delete to the end of the line by binding a keyboard shortcut to Edit.DeleteToEOL. By default this is not bound to any keyboard shortcut, so you’ll have to pick one.
If you haven’t overrode a keyboard shortcut before, you can go to Tools => Options => Keyboard, and then type Edit.DeleteToEOL in the “Show commands containing” text box. You can then type a keyboard
I removed all previous bindings to CTRL + L and bound Edit.DeleteToEOL to that, but you can pick whatever you want.
Now when I hit CTRL + L it removes everything after my cursor, saving me some keyboard strokes.
Hope this helps.
6 thoughts on “Quick Visual Studio Tip – Delete to End of Line”
Thanks for the tip, this saved me a lot of time. You might want to add how exactly you removed all other bindings to the chosen shortcut key. The window isn’t very intuitive, if you haven’t seen it before 🙂
Glad to hear this helped. And yeah that window is like the worst UI ever.
As of now (version 1.59) there is no Edit.DeleteToEOL command in VS Code…
Hey Laco – this is for full Visual Studio, not Visual Studio Code
Do you know how to “send” the deleted segment to the buffer for pasting later?
Hey Jim – I do not without creating an extension.