CTRL+D doesn't work in Visual Studio 2022 - visual-studio

CTRL+D (duplicates) It doesn't work in visual studio 2022 , How to change Ctrl+E,V To CTRL+D ?

I just had the same problem.
The issue for me was that Visual Studio 2022 had set the mapping scheme to Visual C# 2005 instead of (Default).
In the search bar at the top of Visual Studio 2022 (Ctrl+Q), search for key bindings, or go to Options->Environment->Keyboard.
Make sure the keyboard mapping scheme is (Default).
I hope it helps.

Duplicate line is implemented via Ctrl+E,V as explained here.
This operation does leave the clipboard untouched.
Command and respective keys are shown in the Edit Menu.

Go to TOOLS -> Options -> Environment -> Keyboard and then on 'Show commands containing:' search Edit.Duplicate and on 'Press shortcut keys:' press Ctrl+D and click on 'Assign' button.

Related

In Visual Studio, what is the keyboard shortcut and Command ID to "search/query everything box"

In Visual Studio 2021 or above what is the keyboard shortcut (KeyMap) Command ID to the "search everything box"? This box is displayed top right of IDE menu bar. It offers a global search including, IDE actions, menus, commands and symbols within code.
The default Ctrl+Q is NOT assigned on my config, used for something else.
Please see the screenshot:
Could not find the correct command in KeyMap. For information, in JetBrains Rider, this command is called "Search Everywhere".
On my installation of VS 2022 the placeholder text within the search box is "Search (Ctrl+Q)".
Pressing this shortcut in the keyboard mappings yields the Shortcut Window.QuickLaunch
The page you linked to also shows this is the default settings for Window.QuickLaunch.
According to Visual Studio documentation
Use the Ctrl+Q keyboard shortcut to access the search box
Advance Shortcuts:
The search results include tabs for All, Code, Visual Studio. You can save time by using the following keyboard shortcuts for different types of searches:
Ctrl+Q, Ctrl+T for files, types, and members
Ctrl+Q, Ctrl+M for Visual Studio menus, options, components, and templates
Ctrl+Q, Ctrl+E to go to the All tab, for both
Please try with Ctrl+Q it is working fine in visual studio 2022.

How to collapse/expand only regions by keyboard shortcut in Visual Studio 2017?

I've found Quick Launch has CollapseRegions and ExpandRegions which functionality is actually what I need.
But I would like it to be toggled by key in like Ctrl+M,J instead of using Quick Launch like Ctrl+Q > CollapseRegions > Enter.
Is there any way to do that?
In Visual Studio 2017 :
Go to Options -> Text Editor -> C# -> Advance -> activate 'Collapse #regions when collapsing to definitions'
Explicitly to collapse all using Ctrl+M+O and for expand use Ctrl+M+X.

Visual Studio 2015 Ctrl + D (code duplication) not working (keyboard shortcut scheme issue with Resharper)

Ctrl + D in a Visual Studio 2015 Windows10 project is not working at all.. its working in Notepad++. I have tried to reboot my machine, and closed down Visual Studio but nothing works.
I have Windows 10 Threshold 2 and Visual Studio 2015 Version 14.0.23107.0
PS: it was working fine yesterday...
Edit1:
Keyboard mapping is looking good:
RESHARPER is/was the culprit
How to fix:
reset all Visual Studio settings (Tools > Import and Export Settings > Reset all settings)
then go to the Resharper > Options > Keyboard & Menus and re-apply the keyboard shortcut scheme.
and now its working again!
Below steps are worked for me.
Go to Tools > Options >Environment >General> Keyboard
Select visual C# 2005 in keyboard mapping scheme
In Show commands containing, search for Edit.Duplicate
Assign Ctrl + D in shortcut key
Reinstalling ReSharper fixed the issue for me
Just FYI, If you are VS 2019 User:
Extensions > Resharper > Options > Environment > Keyboard
Change Keyboard Scheme to None and save, then go back again and change it to Visual Studio
I was struggling with this problem for a while and this method fixed it.
Goto File->Preferances->keybord Shortcut->On the top search duplicate->Double click on duplicate Selection->ctrl+Shift+D->Press Enter

Visual Studio: Shortcut to close window not working

I changed the shortcut to close a window to Ctrl+W and to close all windows to Ctrl+Shift+W. Close all windows works fine, but Ctrl+W selects the word currently under the cursor but does not close the window.
When I right-click a tab it say Ctrl+W is the shortcut to close it (And also Ctrl+S to save and Ctrl+Shift+W to close all). Why is only the close window shortcut not working?
In Visual Studio (VS 2015 in my case but it's similar down to VS 2010 at least) keyboard shortcuts may have a different meaning depending on the context in which they are executed.
Click Tools / Options / Environment / Keyboard to look up or define shortcuts (you already did that probably). What I called "context" is selected in the combobox labelled "Use new shortcut in:". Most likely you defined the shortcut in "Global" but you want it to work in "Text Editor". In the latter Ctrl+W selects the current word.
Redefine Ctrl+W for "Text Editor" and you should be fine.
I am using Visual Studio 2017 & Visual Studio 2019 and tried the answer from #TobiMcNamobi but it didn't work for me. After few such tries I got it work with below steps.
You should add it as Global shourtcut otherwise it will not work for Designer views.
Add CTRL+W as a Global shortcut for Window.CloseDocumentWindow
Remove the CTRL+W shortcut for Edit.SelectCurrentWord
In Visual Studio 2019 it is Ctrl-F4 by default to CloseDocumentWindow. The action is Window.CloseDocumentWindow. I know this is old but the accepted answer has you change the short-cut key instead. I would rather use the default option.
Tools -> Options -> Environment -> Keyboard
If you're ever unsure go to the path above and you will see the image above then you can click inside the box "Press shortcut key" at the bottom of the form and type the short cut key you're interested in and it will tell you if it is used and what it is currently used for.
You can also reference the docs
https://learn.microsoft.com/en-us/visualstudio/ide/default-keyboard-shortcuts-in-visual-studio?view=vs-2019
2021: For Visual Studio 2019:
See: https://gist.github.com/jpoehls/2030795#gistcomment-2335647
In my case, I had to existing assignments that I had to remove. Thereafter, I could use the hotkey.
In my case, the tabs were not closing because I am using Vim extension. I had to add the following lines to Vim settings:
"vim.handleKeys": {
"<C-w>": false
}
Just press Ctrl + , or Command + , for Mac users, search for Vim and go into Edit in settings.json as the following picture shows:
Screenshot
For Visual Studio 2022, make sure you also remove Ctrl+W from selectCurrentWord command.
In my VS Pro 2019, on Tools / Options / Environment / Keyboard, the first line offers using a premade keyboard mapping scheme, with a drop-down option for VSCode keyborad mapping theme.
I picked it and it seems to have adopted the keyboard shortcuts I was used to from working on VSCode, Ctrl+W included.
For those using linux with VSCode v1.56.2,
File --> Preferences --> Keyboard Shortcuts.
Search for View:Close Editor and as mentioned above, remove any keybinding that has the keybinding you want.

Configure Eclipse to use VS.Net shortcuts?

I've started doing some Python Programming using Eclipse. However, I'm a .Net programmer and I'm use to the keyboard shortcuts in VS.Net 2008. Is there any quick way to reconfigure VS.Net to use the visual studio shortcuts. I've found this other question, but the suggested methods don't work. I've installed CDT and selected the Visual Studio Keys, but it doesn't seem to change any of the key mappings.
That's strange because after installing the C/C++ Development Tools (CDT):
alt text http://img39.imageshack.us/img39/4002/screenshot001ey.png
And picking up the Microsoft Visual Studio scheme (from Windows > Preferences > General > Keys):
alt text http://img64.imageshack.us/img64/9844/screenshot002r.png
My binding are definitely altered as shown below (ok it's just a small example but it illustrates the change and all bindings mentioned by #VonC are there):
alt text http://img4.imageshack.us/img4/1401/screenshot002gd.png
If the CDT Visual Studio mapping does not work, you need to import custom shortcut files for the usual Visual Studio shortcuts.
This SO question mentions this article, with this minimal set:
New PHP File: Ctrl+N
Next Editor: Ctrl+Tab
Previous Editor: Ctrl+Shift+Tab
Find and Replace: Ctrl+F
Find Next: F3
Find Previous: Shift+F3
Open Search Dialog: Ctrl+H
New File: Ctrl+N
Go to line: Ctrl+G
File.Close: Ctrl+W

Resources