Ctrl+K was pressed. Waiting for second key of chord - visual-studio-2013

I'm using Visual Studio 2013 Ultimate and when I select a code to be comment I press Ctrl+K but it show me this once I pressed Ctrl+K was pressed. Waiting for second key of chord... any idea how to fix it?

There is a command Ctrl K+C to comment any line, and Ctrl K+U to uncomment.

You can see what the keyboard binding is under Edit > Advanced > Comment Selection (2010):
And 2013:
Additionally, you find keyboard bindings under Tools > Options > Environment > Keyboard. Here if you search for "Comment", you can find the Edit.CommentSelection (and Edit.UncommentSelection) which you can assign whichever shortcut you prefer.

You can look after and manage your shortcuts in Tools / Options, Environment / Keyboard.
You should see a dropdown menu where all shortcuts are listed.
There you can change your existing shortcuts or reset them to the default.
The default shortcut for me (Visual Studio 2015 Community Edition) to comment was Ctrl K + C and to uncomment Ctrl K + U.

Related

Visual Studio: Shortcut Info

for some/most of the functions in Visual Studio there do exist shortcuts. Sadly it's hard to find them.
I'm looking for a addin/tool that will display me information for a shortcut.
For example:
I comment a line with // and the tools gives me information that the shortcut for this is STRG + K, C.
I press some button, let's say debug and it shows me that the shortcut would be F5
For offline use there's the posters with key bindings, but inside VS I'd recommend the IntelliCommand extension which will show you key combinations when you press ctrl (+ some other key).
No other addin/tool required. In Visual Studio, under Tools > Options > Environment > Keyboard, you can find all available shortcuts.

Shortcut key to Toggle Results Pane SQL Editor Visual Studio 2012

In Visual Studio 2012, I'm trying to use Ctrl+R and it is not hiding results pane in SQL Editor window.
Ctrl+D, R.
Do notice that it is NOT Ctrl+D, Ctrl+R, i.e. you will have to lift your finger from Ctrl key when you press R
Go to Tools > Options > Environment > Keyboard / General.

What's the equivalent for eclipse's ALT+UP/DOWN (move line) in Visual Studio?

In Eclipse, selecting a line and pressing Alt + ↑/↓ will move the line up and down, a quick way to avoid copy&paste.
Is there an equivalent in Visual Studio?
In Visual Studio 2013 and later, this functionality is built in. ALT + UP/DOWN will move a line up or down.
If you need this functionality in VS2012 (works with VS2010 too), take a look at the MoveLine Visual Studio Extension or the Productivity Power Tools suite.
ReSharper's Ctrl + Shift + Alt + ↑/↓/←/→ is even more powerful - when on the beginning of the line, it will move the entire line, but can also be used to move entire methods, change the order of parameters, etc.
For me in Visual Studio 2019 it comes default closed.
For open it:
Tools -> Options -> Keyboard then select Edit.MoveSelectedLinesUp, click "Press shortcut keys" input and press Alt + Up (or whatever you want for it). And the other one is Edit.MoveSelectedLinesDown, click "Press shortcut keys" input and press Alt + Down (or whatever you want for it).
This is now working out of the box with Visual Studio 2013, same way as in Eclipse.
For Visual Studio 2013:
Tools -> Options -> Keyboard then select Edit.MoveSelectedLinesDown, click "Press shortcut keys" input and press Alt + Down. You also have to select the scope of the shortcut to be within "Text Editor".
In Visual Studio 2013 and later, you can move lines up and down using Alt + ↑ / Alt + ↓. Unfortunately this will not adjust the indentation if you move between blocks, as of today only ReSharper (and all other IDE's by Jetbrains including Rider) can help you with that.
To move entire blocks of code around you can move the cursor to its head and press Ctrl + m twice fast to collapse it, and then use the command above to move it around.
Here is a neat reference to all default keyboard shortcuts in different versions of Visual Studio.
With the VSCommands extension, you have exactly that keyboard shortcut. And, by the way, a Stack OVerflow notification toolbar :)

Shortcut for "Find Result 1" in Visual Studio?

Shortcut for "Find Result 1" in Visual Studio?
Hotkeys for Visual Studio 2010 - Alt + vn1
Hotkeys for Visual Studio 2015 - Alt + vnnEnter1
Hotkeys for Visual Studio 2017 - Alt + vnnnEnter1
If you don't feel like customizing your own shortcuts, or you use different environments where you can't always rely on your customization being present, you can always go the old school route of just navigating the menus via hotkeys.
For instance, in Visual Studio 2010, you can just type Alt + vn1.
Typing Alt + v opens up the "View" menu.
Typing n opens up the "Find Results" menu item in the View menu.
Typing 1 selects the "Find Results 1" menu item, thereby opening and setting focus to the "Find Results 1" window.
Likewise, Alt + vn2 opens up the "Find Results 2" window.
If you do this enough, it's like any other keyboard shortcut, and becomes second nature.
ProTip
You can discover the hotkey shortcut to any menu item you need by just hitting Alt, and looking at the letters that are underlined in the menus. This applies to pretty much any windows program you will ever use.
There's no predefined shortcut for that (at least in VS 2005) but just select Customize... from the Options menu, press the Keyboard... button and then create a suitable shortcut for View.FindResults1.
In Visual Studio Professional 2013 (not sure about the other version) the function key "F8" will take you to the next result in the Find Results window, and "Shift-F8" will take you in the reverse direction (i.e. find previous result).
You can assign keyboard shortcuts as you please through Tools > Customize > keyboard.
In the show commands containing textbox type View.FindResults1.
In the Press shortcut keys textbox type in the shortcuts you want to add and then press the Assign button.

Visual studio or resharper shortcut to close currently selected file in IDE

Is there a shortcut in VS 2005 or resharper to close the current file. or "save and close" would be even better
Ctrl + F4
Save and close would
Ctrl + S followed with Ctrl + F4
Visual Studio 2015 + Resharper
The question is a bit old. Just wanted to update it with the current solution.
As you can see below, you can also completely customize your shortcuts:
just navigate to Tools > Options
on the left pane, go to Environment > Keyboard
now use the field Show commands containing to search for file.close
select File.Close on the list
click the field Press shortcuts keys
type your desired shortcut, for example, <Ctrl> + W
finally, click Assign
And you're good to go!
Ctrl+S, Ctrl+F4 will save and close the current file.
Tools -> Options -> Keyboard
Find "Windos.CloseDocumentWindow"
And for me, need to set "Use new shortcut in" to "text editor" to override old ctrl+w without delete

Resources