SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Siegfried Pammer

Tip No. 1: Ctrl+W

Even as core developers of SharpDevelop we sometimes stumble across features in our own product, we did not know about before. Hence we decided to create a SharpDevelop Tips&Tricks section on our blog(s), to let you know all the cool features you can use to speed up your work. Today I want to start with something simple.


It often happens that you want to select of the code, whole methods or statements, or even (parts of) expressions. Of course you can do that by using the mouse or use Shift + the arrow keys, but it feels very clumsy and is inaccurate and error-prone.


To avoid this a small hidden feature comes in very handy: Control + W. It is simple to use: Place the caret (the "keyboard cursor") somewhere inside of a piece of code you want to select.

Then hit Ctrl+W and the innermost expression, statement or member will be selected. Hit Ctrl+W again to extend the selection. You can repeat this as many times as you want; you will end up having selected the whole file.


Imagine how this feature can be used in conjunction with other features like surround with (Ctrl+J) or extract method. In the future there could be a Introduce variable/constant refactoring, which extracts an expression into a variable/constant initializer.

Quick note: currently it is not possible to undo or shrink the selection. Would you like to have something like that too? If so, which keyboard shortcut would you choose to make it easy to use?

Update: Shrink selection was added as Ctrl+Shift+W in SharpDevelop 4.2 alpha builds. Thank you for your feedback.

Version Information

This feature is available in SharpDevelop 4.0 and newer.

Published Sep 29 2011, 08:00 PM by siegi44
Filed under:



Tomas Novotny said:

What about CTRL+SHIFT+W for "undo" shrink? (Like TAB, SHIFT+TAB, etc.)

September 29, 2011 10:13 PM

jbuedel said:

+1 for Ctrl+Shift+W

September 30, 2011 4:05 AM

Andrei Balint said:

+1 for Ctrl+Shift+W . I actually tried the Ctrl+Shift+W, and a CMD window popped up, so I suppose the "CMD" trigger would need to be restricted for the text editor (I don't know what I does in the first place though)

October 3, 2011 9:34 AM

siegi44 said:

Update: Shrink selection was added as Ctrl+Shift+W in SharpDevelop 4.2 alpha builds. Thank you for your feedback.

October 31, 2011 9:00 PM

Chad Joan said:

Experience report:

Ctrl-W is commonly used as the default "close tab" key.  As such, I used Ctrl-W expecting my tab to be closed, but it did text selection instead.  I could find no way to re-bind this key combination.  You may want to consider a different shortcut for this feature, or at least make it assignable within SharpDevelop.

This table shows a reasonable amount of agreement on the use of Ctrl-W on different platforms/programs:

April 8, 2015 1:04 AM
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this ( email address.