Quick Visual Studio Tip – Delete to End of Line

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.

endoflinedelete

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.

2017-05-29_14-37-42

Now when I hit CTRL + L it removes everything after my cursor, saving me some keyboard strokes.

endoflinedelete2

Hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s