Waiting for second key of chord

2019-01-23 23:24发布

I have assigned the keyboard shortcut Ctrl+E to a command. But when I click Ctrl+E, the status bar says Ctrl+E was pressed. Waiting for the second key of the chord...".

If I hit the Esc key, I get "The key combination (Ctrl+E, Esc) is not a command."

How do I activate the command that has been assigned to Ctrl+E?

I know that this is the same as the question How do you stop Visual Studio from waiting for the second part of a shortcut-combination? . But the answer given there (hit Esc) does not work for me.

3条回答
祖国的老花朵
2楼-- · 2019-01-24 00:04

Key chords are a keyboard shortcut feature of Visual Studio. They consist of a sequence of key presses like (Ctrl+K, Ctrl+C) for comment code or (Ctrl+K, Ctrl+U) for uncomment code.

They are activated by the user pressing one Ctrl+key combination, then another Ctrl+key combo. For example Ctrl+K, Ctrl+C on my install of Visual Studio is used for commenting selected text.

In your case, Ctrl+E is a common chord starter and is used by many chords. For example Ctrl+E, Ctrl+W = Toggle Word Wrap and Ctrl+E, Ctrl+X = Workspace Designer.ExpandAll.

The reason you see the error is because Visual Studio has it mapped to other chords. Because of this, you cannot use Ctrl+E by itself for a keyboard shortcut

But, you can create your own chord, Ctrl+E, Ctrl+D is not in use on my install of Visual Studio 2012.

And your question is not the same as the other question. In that question, the OP has started the chord process (Ctrl+E) and wants to cancel Visual Studio from waiting for the 2nd chord key.

Edit: You can use Ctrl+E as a standalone shortcut under some conditions. It might depend on what developer settings you have enabled in Visual Studio. Also if you remove all key chords that start with (Ctrl+E) then it can work as a non-chord shortcut.

查看更多
Summer. ? 凉城
3楼-- · 2019-01-24 00:13

The selected answer is wrong in stating you cannot use Ctrl+E by itself (at least for Visual Studio 2013).

For those who come from a Mac or other OS background where Ctrl+E takes you to the end of the current line (the End key shortcut by default in VS), this is a really frustrating limitation when switching environments.

I found that in Visual Studio 2013 at least, you can remove all the shortcuts that use the Ctrl+E chord (none of which I will ever use) and set the Edit.LineEnd command to Ctrl+E. It just takes a few minutes tracking down the chords to remove (most of them are under the workspace designer).

查看更多
放我归山
4楼-- · 2019-01-24 00:17
  1. To see which commands are using your keyboard shortcut at the moment, enter it in the "Press shortcut keys:" edit box. Make sure you don't accidentally click "Assign".
  2. In the dropdown box "Shortcut currently used by:" you can browse through and manually remove all commands that currently occupy your desired shortcut combination.

enter image description here

查看更多
登录 后发表回答