19

In Visual Studio 2010 Solution Explorer tree view, how can I remap the F2 key to Rename the Selected File rather than open Object Browser?

Jasper
  • 2,166
  • 4
  • 30
  • 50
Gordon Bell
  • 13,337
  • 3
  • 45
  • 64

3 Answers3

31

Do the following

  • Tools -> Options
  • Expand Environment and select Keyboard
  • Type "File.Rename" into the text box
  • Put the Focus on the "Press Shortcut keys" box and hit F2
  • Click Assign
Jasper
  • 2,166
  • 4
  • 30
  • 50
JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
1

To enable the renaming of an identifier or method, etc. using the F2 key (i.e a variable or a method name), do the following:

  • Tools -> Options
  • Expand Environment and select Keyboard
  • Type "Refactor.Rename" into the text box that says 'Show commands containing'
  • Put the Focus on the "Press Shortcut keys" box and hit F2
  • Click Assign
p.campbell
  • 98,673
  • 67
  • 256
  • 322
EdsonF
  • 2,719
  • 3
  • 30
  • 34
0

I don't know about you, but in my copy of VS2010, F2 in the Solution Explorer DOES rename the file. What exactly do you have selected when you hit F2?

Jasper
  • 2,166
  • 4
  • 30
  • 50
Dan J
  • 16,319
  • 7
  • 50
  • 82