Visual Studio 2010: How Can I remap F2 to Rename File rather than Open Object Browser
Asked Answered
R

3

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?

Retardation answered 30/7, 2010 at 21:22 Comment(0)
B
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
Boehike answered 30/7, 2010 at 21:25 Comment(1)
Works for Visual Studio 2012 too!Chlorophyll
S
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
Spangler answered 30/7, 2010 at 21:22 Comment(0)
G
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?

Ginder answered 30/7, 2010 at 21:24 Comment(4)
The OP likely selected the Visual Basic profile which maps F2 to object browser.Boehike
It opens the Object Browser for me, Visual Studio 2010 Ultimate.Retardation
Jared, you're probably right - my keyboard mapping was set to Vis C# 2005 mode. Was just about to edit my answer to provide actual content, but you beat me to it. +1Ginder
See Jared's answer to this question, Gordon. :)Ginder

© 2022 - 2024 — McMap. All rights reserved.