Bug 445 - Conflicting key bindings in Default Scheme
Summary: Conflicting key bindings in Default Scheme
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: 2.6 RC 1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
URL:
: 1658 ()
Depends on:
Blocks:
 
Reported: 2011-08-25 15:40 UTC by guivho
Modified: 2012-04-25 13:06 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Conflicting Key Bindings (131.79 KB, image/png)
2011-08-25 15:40 UTC, guivho
Details
List of Xcode 4 commands and shortcuts (4.10 KB, text/plain)
2011-08-30 19:05 UTC, Mikayla Hutchinson [MSFT]
Details
xcode-keybindings.patch (9.36 KB, patch)
2011-08-31 12:07 UTC, Jeffrey Stedfast
Details
keybinding-conflicts.patch (3.77 KB, patch)
2011-08-31 16:08 UTC, Jeffrey Stedfast
Details
keybindings.patch (4.52 KB, patch)
2011-09-02 10:28 UTC, Jeffrey Stedfast
Details
keybindings2.patch (5.00 KB, patch)
2011-09-02 11:10 UTC, Jeffrey Stedfast
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description guivho 2011-08-25 15:40:04 UTC
Created attachment 190 [details]
Conflicting Key Bindings

The Default scheme has some conflicting key bindings as can be seen on the
attachment.

Shift+Meta+K - Clean
Shift+Meta+K - Toggle code focus

Shift+Meta+T - Go to Type...
Shift+Meta+T - Step Out

Shift+Meta+D - Go to File...
Shift+Meta+D - Find References
Comment 2 guivho 2011-08-26 09:52:33 UTC
Sebastien, please explain.
Comment 3 Jeffrey Stedfast 2011-08-26 09:59:36 UTC
guivho: I think he was just pointing to a similar report of conflicting keybindings.
Comment 4 Miguel de Icaza [MSFT] 2011-08-29 18:42:30 UTC
Jeff, 

Could you review the default keybindings and propose the changes that we should make?

Additionally, the Home, End, Shift-Home and Shift-End seem to not have the right defaults in MonoDevelop (go to start of line, end of line, extend selection to start of line, and extend selection to end of line).
Comment 5 Jeffrey Stedfast 2011-08-30 17:50:56 UTC
Looks like guivho's list is complete.

That said, looking at these keybindings I have to wonder:


Clean vs Toggle code focus
-----------------------

What the heck is "Toggle code focus" and who uses that? Where is it in the menus? Right now, Shift+Meta+K invokes Build/Clean so it seems clear to me that no one could possibly be using "Toggle code focus" with the current bindings so unless there's a menu item for it, we could simply remove its binding and no one would ever know.

That said, I doubt Build/Clean is used often enough to require a keybinding, so if Toggle code focus is important to have a binding for, that might be worth considering.



Go to Type vs Step Out
-------------------

Both important commands IMHO, but I'd vote that Step Out is probably far more widely needed.



Go to File vs Find References
------------------------

Shift+Meta+D probably belongs with Go to Reference more, simply because it pairs with Go To Declaration which is bound to Meta+D.

The default keybinding in Visual Studio for "Edit.Find All References" is Shift+F12, though, if we want to be more consistent with VS. Go to Definition is simply F12 in VS. Then again, F12 and SHift+F12 are bound to VolumeUp (and QuietVolumeUp) on MacOSX and you can't seem to override them.

Go to File seems to open up a dialog with a "search" textbox at the top and a really big empty listbox below it. While I can see this being handy in big projects, I'm not sure it deserves a key binding by default (unless we can find an unused one). Or how about Shift+Meta+O since really it's just File/Open with some special semantics to make it easier to find the file in the project. Of course, assigning Shift+Meta+O conflicts with StepOver so that would have to be reassigned...



Okay, how about this?

Toggle code focus --> <nothing>
Go to File --> Shift+Meta+O
Step Into  --> Meta+I
Step Out  --> Shift+Meta+I
Step Over --> Shift+Meta+U

I think the debugger stepping keybindings should be close to one another (as does Microsoft with VS, unfortunately they use F10 for Step Over and F11/Shift+F11 for Step Into/Step Out which we can't seem to capture on MacOSX)
Comment 6 Mikayla Hutchinson [MSFT] 2011-08-30 18:12:28 UTC
Code focus is this: http://mjhutchinson.com/journal/2011/03/monodevelop_tips_code_focus

Clean should have a keybinding, all major IDEs do. And Go to File is *really* important to anyone who's actually used it.

For an explanation of how we choose default keybindings, see http://mjhutchinson.com/journal/2011/02/06/key_bindings

Generally on Mac we prefer Xcode's bindings for the default scheme.  A number, including most of these, need to be updated to Xcode 4, which changed substantially from Xcode 3.

It would be nice to have a separate VS-like keybinding scheme, but as you note, VS replies heavily on F keys that aren't easily accessible on Mac (you need to use the Fn-key to access them).

Home and End keybindings are correct, that's how they work on Mac. Use command-left, command-right fir functionality equivalent to Home and End on other OSes.
Comment 7 Jeffrey Stedfast 2011-08-30 18:26:10 UTC
Build/Clean isn't bound to anything in Visual Studio.

That said, Xcode4's bindings are as follows:

Clean: Shift+Meta+K (same as what MD is now)
Step Into: F7
Step Over: F6
Step Out: F8

All those F-keys are available for use in MD if we want them.

Then it's easy to assign Shift+Meta+O to Go to File (which makes more sense as a binding than what we have now)

All we'd have to do is find a new binding for Toggle code focus...

How about Control+F? It's currently unused...
Comment 8 Mikayla Hutchinson [MSFT] 2011-08-30 19:05:05 UTC
Created attachment 217 [details]
List of Xcode 4 commands and shortcuts

Let's not bind Toggle Code Focus. I'm not sure why we made it a command at all, it should have been a pref.

I'm in two minds about just taking the bindings from Xcode. There's some value in matching the big Mac IDE, but also some value in taking good ideas from other sources like TextMate, and it's also nice to have some consistency in MD across platforms and/or versions.

Since the debugger stepping keys came from Xcode, it makes sense to update them, though 
using F keys will suck for people who don't know how to access use the function keys on Mac. Note that Cmd-Shift-O is more akin to MD's "navigate to" than MD's "go to file" (see my blog for the difference, maybe we don't need Go to File bound).

It would be good to audit some other bindings to match Xcode. I've attached a full list of Xcode 4.0 commands and bindings I made some time back.

I suppose once we start using F keys there's no excuse not to have a VS-like keybinding scheme. But bear in mind that VS has about 4 different schemes depending what you choose when it first starts up.
Comment 9 guivho 2011-08-31 04:57:09 UTC
The Keyboard Preferences on a Mac present the option to
[Use all F1, F2 etc. keys as standard function keys.
When this option is selected, press the Fn key to use the special
features printed on each key.]

I realize it's my personal preference, but as a developer I have this
option turned on. This allows me to use directly function keys mapped in
my .vimrc as well as in .emacs, and I just use Fn + whatever to use the
other functionality.

Basically I just want to say that you might well map Function keys, and
OSX users have the option to use them with or without the fn key.
Comment 10 Jeffrey Stedfast 2011-08-31 07:53:51 UTC
guivho: ah, I did not know that - thanks for the info!

I think I'll be turning on that option... ;-)

I almost *never* want to hit volume-up/down and I'm always hitting those keys.

Michael: If we decide to follow VS keybindings for Windows, I'd recommend using the scheme you get when you choose C# as your default language.
Comment 11 Jeffrey Stedfast 2011-08-31 12:07:07 UTC
Created attachment 224 [details]
xcode-keybindings.patch

This patch is a first-pass at a new keybinding scheme for MacOS X which tries to mimic Xcode4's keybindings where ever possible.

Also, no more conflicts :-)
Comment 12 Mikayla Hutchinson [MSFT] 2011-08-31 13:02:16 UTC
Looks good to me on a quick skim, except for one thing - why remove the dynamic abbrev binding? Would  alt-/ conflict with any other MD or Xcode binding?
Comment 13 Jeffrey Stedfast 2011-08-31 13:12:05 UTC
Yes, it conflicts with CommentSelection
Comment 14 Mikayla Hutchinson [MSFT] 2011-08-31 13:16:03 UTC
That's command-/
Comment 15 Jeffrey Stedfast 2011-08-31 13:20:42 UTC
Dynamic Abbrev was set to Command+/, not Alt+/ (remember to look at the macShortcut, not shortcut)
Comment 16 Mikayla Hutchinson [MSFT] 2011-08-31 13:24:31 UTC
I know, I was asking why you didn't change it instead of removing it :)
Comment 17 Jeffrey Stedfast 2011-08-31 13:31:59 UTC
Ohhh. Yea, I suppose we could make Dynamic Abbrev Alt+/ instead. I don't think would conflict with anything. I'll check in a bit.
Comment 18 Jeffrey Stedfast 2011-08-31 16:08:41 UTC
Created attachment 225 [details]
keybinding-conflicts.patch

Okay, so the previous patch was too invasive for 2.8...

Now for a simpler change:

How about this?

Dynamic Abbrev: Command+/ => Alt+/  (so we can bind Command+/ to Comment Selection)

Toggle Code Focus: Control+Shift+K => <nothing>  (conflicts with Clean Build)

Comment Selection: <nothing> => Command+/ (same as xcode4 and also a logical binding)

Fold Methods & Properties: <nothing> => Alt+Command+Shift+Right (same as in xcode4)

Format Document: <nothing> => Control+I (same as in xcode4)

Find & Replace: <nothing> => Alt+Command+F (same as xcode4)

Replace in Files: <nothing> => Alt+Command+Shift+F (same as xcode4)

Goto Type: Command+Shift+T => Alt+Shift+T (to prevent conflicts with Step Out)

Goto File: Command+Shift+D => Alt+Shift+O (to prevent conflicts with Find References)


With these bindings, the Goto XYZ commands now all use Alt+Shift+Letter and the debugging commands are all Command+Shift+Letter
Comment 19 Jeffrey Stedfast 2011-09-01 13:26:28 UTC
I committed the latest patch
Comment 20 Jeffrey Stedfast 2011-09-02 10:28:11 UTC
Created attachment 242 [details]
keybindings.patch

Okay, this new patch keeps Command+Shift+T bound to Goto Type (which I think I prefer) and changes the binding for Step Out to be Command+Shift+U (which puts all of the debugger commands next to one another on the keyboard, added bonus - "U" seems kinda intuitive for "step up")
Comment 21 Jeffrey Stedfast 2011-09-02 11:10:31 UTC
Created attachment 243 [details]
keybindings2.patch

Even simpler patch...

* Rebind "Step Out" to Command+Shift+U (now consistent with Command+Shift+I and Command+Shift+O for "Step In" and "Step Over"; was Command+Shift+T; conflicted with "Goto Type")

* Rebind "Find references" to Command+Shift+R (was Command+Shift+D; conflicted with "Goto File")

* Rebind "Dynamic abbrev" to Alt+/ (was Command+/)

* Bind "Comment selection" to Command+/

* Remove binding for "Toggle code focus"

* Added bindings to previously unbound commands:
  + Bind "Fold Definitions" to Command+Alt+Shift+Right (same as xcode)
  + Bind "Format Document" to Control+I (same as xcode)
  + Bind "Search & Replace" to Alt+Command+F (same as xcode)
  + Bind "Find Next" to Alt+Command+Shift+F (same as xcode)
Comment 22 Jeffrey Stedfast 2011-09-06 18:38:11 UTC
Miguel: ping
Comment 23 guivho 2011-10-06 12:29:09 UTC
Switched to 2.8 yesterday.
Same conflicting keybindings are still present :(
Comment 24 Jeffrey Stedfast 2011-10-06 13:37:51 UTC
yea, my patch is still sitting in limbo...
Comment 25 Mikayla Hutchinson [MSFT] 2011-10-24 07:26:09 UTC
*** Bug 1658 has been marked as a duplicate of this bug. ***
Comment 26 Jeffrey Stedfast 2012-04-25 13:06:40 UTC
fixed in git master