Compartilhar via


Select the Current Word

Keyboard:  CTRL + W
Command:  Edit.SelectCurrentWord
Versions:  2008,2010
Published:  4/5/2010
Code:  vstipEdit0039

 

Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!

 

You can easily select the current word in Visual Studio by simply putting your cursor in the word to select:

image

 

Then press CTRL + W and it will automatically select the current word:

image

Comments

  • Anonymous
    April 04, 2010
    Hi, it's much better to simply click CTRL+LMB (left mouse button). Also, don't forget that you can use ALT+LMB (drag while holding left mouse button) to select an arbitrary region within your code. Looking forward to VS 2010 launch. I'm preparing a major re-install; it's time to clean up after numerous VS/TFS beta installs.

  • Anonymous
    April 04, 2010
    Anders, Good call on the mouse info! Z

  • Anonymous
    April 06, 2010
    Anders, CTRL+LMB requires leaving the keyboard, which is much less efficient.

  • Anonymous
    April 07, 2010
    This does not work for me. Ctrl+W prompts for a second key to be pressed as if Ctrl+W is only reserved for combination commands. Am I missing something?

  • Anonymous
    April 08, 2010
    This is a VS2010 ONLY feature!

  • Anonymous
    April 09, 2010
    But I am using VS2010 and it's still not working.

  • Anonymous
    April 09, 2010
    mrjimmy and lewis, This works in both VS2008 and VS2010.  It is most likely your keyboard mapping scheme.  I use the default mapping scheme for these posts.  Look for a post soon on how to check you have the correct mapping scheme.   Z

  • Anonymous
    April 12, 2010
    Thanks for posting this - it will be handy for the upcoming VS2010 release :)

  • Anonymous
    April 16, 2010
    That explains it. I was on the Visual C# 2005 mapping for some reason. I don't remember ever switching it though. I moved it back to default and it's working fine. Thanks for the heads up!

  • Anonymous
    October 18, 2011
    Ctrl + w is nice, great post. The ctrl + LMB is a little unnecessary imho. Why hold ctrl when you can just double click for the same result?

  • Anonymous
    October 19, 2011
    Greg, Good point! :) Z

  • Anonymous
    July 11, 2013
    Heh, not necessarily a good point.  I use ctrl+LMB all the time to copy/paste multiple items.  And VS2012 changed this to "folow a hyperlink".   Does anybody know how to change that? Thank you!

  • Anonymous
    July 11, 2013
    Hey RH As far as I know you can't bind commands to mouse activity in the editor so you may be stuck with the change. Z