Override a single Resharper key binding with Visual Studio Key binding - visual-studio

I want to use visual studio's default Alt+Down Arrow key binding instead of Resharper's Alt+Down Arrow binding. I am using Resharper key scheme.
I have tried assigning the key binding from Environment > Keyboard and assigned Alt+Down Arrow to Edit.MoveSelectedLinesDown but it is not working.

First remove the key binding related to resharper, then in the same window, add that key binding of visual studio.
edit: remove the assigned key for ReSharper.ReSharper_GotoNextMethod in keyboard tab of options from all Items in the list of shortcuts (text editor, global, ...).
Then assign alt+down to Edit.MoveSelectedLineDown. i just tested this and it is working.

In TOOLS --> Options | Environment| Keyboard
Select the scope if the shortcut (can be global) in the use new shortcut in: combo box
go in the Press shortcut keys text box, perform your key presses (Alt+Down Arrow) and select the command you want to assign it to in the list above.
Click the Assign button
Click OK

Related

Is there no Ctrl+drag selected text to copy it available in Visual Studio Code?

Is it possible to drag and drop a selected text by pressing and holding a modifier key in Visual Studio Code? Usually, this is Ctrl+Drag. But doesn't seem to work.
If you have the default configuration, there's no need for CTRL key. Just selecting the text and dragging it in place (using left mouse click) does the job.
Version: 1.64.2
Try command (⌘) + click. I believe Apple's "CTRL" key is the "⌘" key, and its "ALT" key is "CTRL" (that's why you right click was happening; ALT + click = right click).

How is right curly brace supposed to be typed in VS2017 editor? [duplicate]

A recent update to Visual Studio has introduced a new or updated shortcut key that on my non-English keyboard allowed me to create closing curly braces (AltGr+shift+*). This shortcut still works as expected outside of VS (e.g. in notepad) but in VS it is now associated to some text selection command (like select text from the cursor position to the bottom of the file).
How can I find the offending shortcut key command among the hundreds in VS? I remembered the existence of a VS add-in that allowed printing out all currently set shortcut keys to attempt generating a list I could quickly search through but I failed at finding it.
This has been driving me crazy for the last week. I tried to disable ReSharper, to reset the keybindings, to repair Visual Studio, all to no avail, I haven't been able to type closing curly braces since then. It never occurred to me that a new shortcut could have been introduced hijacking the keypress until reading your question.
To check if there's a rogue shortcut hijacking your keypresses, open the keyboard options screen using the Tools → Options → Environment → Keyboard menus and click inside the "Press shortcut keys" field (it doesn't matter which command is selected):
Then press the affected keys combination, the combination will appear in the "Press shortcut keys" field and the associated commands - if any is - will be listed in the "Shortcut currently used by" drop-down:
To remove the shortcuts you need to search for every entry listed in the drop-down by typing the command name in the "Show command containing" field, selecting the entry in the filtered list, and removing every entry listed in the "Shortcuts for the selected commands" drop-down by clicking the "Remove" button.

How do I select proper action in the dialog "Resharper - Shortcut Conflict" for a shortcut?

When I press ctrl+R, ctr+R, a dialog comes up
Lets assume that I want to map the shortcut to "Refactor.Rename".
When I clicked OK here, the action was not mapped to the shortcut.
Instead the shortcut became disabled as in not being "available".
Resetting all shortcuts to visual studio defaults and doing this again actually gave me the resharper action upon pressing Ctrl+R, Ctrl+R.
Does it matter when I select in this list before I press OK?
If I select something in the list and also make a radio button selection, what will be the result?
Is there any way for me to use this dialog to select an action without resetting all shortcuts to either visual studio defaults or resharper defaults?
List selection doesn't matter and only radio button selection makes sence. There is no reference to list selection in documentation.
The "shortcut became disabled as in not being "available"" message is displayed even if your code window lost its focus. Are you sure the shortcut really was broken?

Keyboard Shortcuts Not Working in Visual Studio 2013's Find in Files dialog?

I usually access Visual Studio's Find in Files feature with Ctrl-Shift-F, type in what I'm after and press enter.
Everything is working, I can type what I want to find, Ctrl-A will select all text, arrow keys will navigate within the Find What text control only the enter key press does nothing. The dialog still has focus, just nothing happens.
The accelerator keys that are marked on the various buttons also do not do what I expect. Alt-P will open the Project menu, Alt-F the File menu, Alt-A nothing. When the Find in Files dialog is focussed I expect the Find Previous, Find Next or Find All actions to be performed.
The tab key also does not change focus from one control to another while in that dialog.
The escape key will kill the focus in that dialog and return focus back to the file that I have open in the text editor as expected.
I have tried using the Reset button under Tools -> Options -> Environment -> Keyboard to no avail.
I am using Visual Studio Ultimate 2013 Update 4 on Windows 7 x64.
If you're using Resharper, after applying R# keyboard scheme, it will add it's keyboard shortcuts. For example, it adds Alf+F shortcut in Text Editor scope.
Setting your keyboard shortcut in Global scope is not enough if same keyboard shortcut is set by R# for Text Editor.
To override R# shortcut in Global scope, make sure you delete R# shortcut setting in VS keyboard settings modal dialog.
Rarely, strange keyboard shortcut behavior could be also caused by non-US keyboard setting. If you are using non-English keyboard set in Windows Control Panel settings, try this solution:
Set keyboard layout to US
Reset keyboard shortcuts in VS under Tools -> Options -> Environment -> Keyboard
Assign your shortcuts (e.g. Alt-F)
Set keyboard to your local layout

What key shortcuts are to comment and uncomment code?

There were Ctrl+E+C (comment) and Ctrl+E+U (uncomment) in older versions, or Ctrl+K+C and Ctrl+K+U.
But in VS 2012, I can't see key shortcuts:
How to enable those shortcuts?
Keyboard accelerators are configurable. You can find out which keyboard accelerators are bound to a command in Tools -> Options on the Environment -> Keyboard page.
These commands are named Edit.CommentSelection and Edit.UncommentSelection.
(With my settings, these are bound to Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U. I would guess that these are the defaults, at least in the C++ defaults, but I don't know for sure. The best way to find out is to check your settings.)
You can also add the toolbar in Visual Studio to have the buttons available.
View > Toolbars > Text Editor
Use the keys CtrlK,C to comment out the line and CtrlK,U to uncomment the line.
From your screenshot it appears you have ReSharper installed.
Depending on the key binding options you chose when you installed it, some of your standard shortcuts may now be redirected to ReSharper commands. It's worth checking, for example Ctrl+E, C is used by R# for the code cleanup dialog.
This is how I did it,
Menu Tools → Options on the Environment → Keyboard window
One can alter the default shortcuts following the below steps
Select Edit.CommentSelection in the listbox
Click on "Remove" button
Select "Text Editor" option in the dropdown under "Use new shortcut in:"
Press your own shortcut in the textbox under "Press shortcut keys:"
Example: Pressing Ctrl+E and then C will give you Ctrl+E, C
Click on "Assign" button
Repeat the same for Edit.UnCommentSelection (Ctrl+E, U)
I went to menu: Tools → Options.
Environment → Keyboard.
Show command containing and searched: comment
I changed Edit.CommentSelection and assigned Ctrl+/ for commenting.
And I left Ctrl+K then U for the Edit.UncommentSelection.
These could be tweaked to the user's preference as to what key they would prefer for commenting/uncommenting.
"commentLine" is the name of function you are looking for. This function coment and uncoment with the same keybinding
Shift + alt + a
the command palette is great for finding shortcut keys.

Resources