Is it possible to implement a "Vim" toggle in Visual Studio? - visual-studio-2010

Ie, specify [ctrl][alt]+v or something...and that would instance vim inside that text editor window... because that would be really cool.
And/Or: is there a way to do it yourself, if you wanted to? Ie, can you attach custom functions to the keyboard keys and whatnot? I noticed that a lot of the Add-Ins seem to be able to kindof accomplish that level of customizability...

There are a few projects that incorporate vim keybindings directly into the Visual Studio editor.
Here's one: VsVim

I'm using VsVim
You download the plugin from the link above, double click on it and it will be installed in all VisualStudios you have installed in your computer.
About toggling VIM in VisualStudio:
I don't think you can enable/disable it per tab or file openned: either is enabled or disabled in all files.
What you could do is this: add a new shortcut to enable or disable it when you need it.
Tools -> Options... -> Environment -> Keyboard
On the "Show commands containing" input type "VsVim.ToggleEnabled". For me this command wasn't bind it with anything. I added the shortcut
Ctrl Q, Ctrl V

Related

Visual Studio Code shortcut to display autocomplete list before typing on macOS

I am trying to display all possible words after putting the cursor in certain place in the code.
The autocomplete list appears when I start writing/typing:
However, I would like to see all suggested words even before typing.
I tried command + space, however it was a system shortcut for Search in macOS:
Any thoughts?
In case you are a CJK user using Mac, Ctrl+Space will not work, since it is used to switch IMEs.
There is another keyboard shortcut for triggering suggestions:
Option+Esc (Mac)
Alt+Esc (Windows)
Also see this post.
VS code version: 1.41.1
I solved this problem using fn+control+space.
Hope it helps you.
"change input source" keyboard shortcut should be disabled
To disable it->
Go to system preferences -> keyboard -> input sources
add a new input source (choose ABC)
Go to shortcuts tab (inside of keyboard settings)
Click on input sources on the left
disable the "select previous input source" shortcut
restart your vs code and now ctrl+space will show quick suggestions.
You can use the following alternative keyboard shortcuts:
⌘+I (mentioned in the official VS Code documentation for "Trigger suggestion")
⌥+esc
fn+control+space
The shortcut for the "Trigger Suggest" command is ⌃Space (ctrl+space) — as mentioned in the comments.
Most default shortcuts can be found in the documentation, which will automatically show the correct keybindings for the system you're on. In other words, if you visit the page on a Mac, you'll see Mac keybindings.
Additionally, you can:
go to Code > Preferences > Keyboard Shortcuts (on a Mac) and search for keybindings based on the command you want to execute
open up "show all commands" (⇧⌘P on a Mac) and search for the command there, allowing you to either view the keybinding for that command, or simply navigate to it directly from the search
Of course you'd have to have some idea of what the command's name might be. And in this case, a search for "suggest" would suffice.
If you use too many keyboard layouts, maybe the MacOS shortcut might be active. You can disabled ^(Ctrl)+Space shortcuts for MacOS.
System Preferences>Keyboard>Shorcuts>Input Sources> Disable Select the previous input source.
You can use next shortcut for change input sources.Ctrl+Alt+Space
when I was set up 2 keyboards with different layouts, and it turn out it overrides the ^+Space behavior, so this is how fix it:
Go to system preferences -> Keyboard -> Keyboard shortcuts
Click on input sources
and disable the "select previous input source" shortcut

How to map Visual Studio shortcut keys in Github Atom

How to map the shortcut keys in GitHub Atom just like Visual Studio.
If anyone have keymap file kindly share.
I tried to implement (Ctrl+K ,Ctrl+C) in github atom for comment. It didnt work.
Also Ctrl-K,Ctrl-U to turn off comment
'atom-text-editor':
'ctrl-k+ctrl-c': 'editor:toggle-line-comments'
Open the Settings panel by pressing ctrl-, on windows cmd-, on mac and select the Keybindings tab. It will show you all the keybindings currently in use.
You can also open the keybinding resolver using ctrl-. and press ctrl-k and see what keybinding it displays.
To assign custom keybindings, go to File -> Open Your Keymap. It will open keymap.cson file.
Add the following to the keymap.cson file.
'atom-workspace atom-text-editor:not([mini])':
'ctrl-k ctrl-c': 'editor:toggle-line-comments'
Now you can use 'ctrl-k ctrl-c' to comment/uncomment your code.

key bindings visual studio 2013 to switch tabs

I was wondering if there are any hotkeys by default key bindings I can add to Visual Studio 2013 to switch tabs. I know you can ctrl+tab and shift+ctrl+tab to go forward and backwards in VS13's list of open tabs, but I prefer i Xcode or sublime text where you can just cmd+shift+] or cmd+shift+[ to go to the right tab or left tab respectively. Does anyone know if there is a way for this? I can't seem to find one. Thanks.
I guess you can do it. I don't know why I couldn't find this before:
http://www.jetbrains.com/resharper/webhelp/Configuring_Keyboard_Shortcuts.html
Keyboard shortcuts in VS can be configured in Tools -> Options -> Environment -> Keyboard. You can find commands either by searching for their name ("Show commands containing:") or by pressing a known shortcut and seeing which commands it's mapped to ("Press shortcut keys:").
It looks like you need to set Window.NextDocumentNav and Window.PreviousDocumentNav.

visual studio shell F# keyboard shortcuts

I've started using F# with the visual studio shell and I like the capability to be able to send lines to fsi by highlighting them, but the alt+Enter shortcut is really awkward and I would be much happier with this being on shift+Enter. (mainly since shift+ up/down arrow is select lines already)
Does anyone know how to change this? Thanks.
You can alter the keyboard mappings within Visual Studio. If you go to Tools -> Options -> Environment -> Keyboard, you'll see a window like the image below.
In order to check existing bindings, place the cursor in the "Press shortcut keys:" box and hit "Shft+Enter". You'll then see any potential conflicts in the drop-down box as shown.
In the example below, I'm searching through Global, which means shortcuts for anything in the application. You can switch it to be just the console or whatever you like.
Once you're happy with the shortcut you want to use, you need to select the command from the window containing all of the Action.* lines and then press Assign.
So I don't mean to be trite, but have you tried mapping the key?
So for F# Interactive I see Alt+Enter mapped to:
ClassViewContextMenus.ClassViewMultiselectProjectreferencesItems.Properties
Have your tried mapping Shift+Enter (or whatever) to that command?
Tools->Options->Environment->Keyboard
You should be able to get it all working from there.

How can I disable ReSharper in Visual Studio and enable it again?

I installed ReSharper, and it works in Visual Studio, but how can I disable it?
Whenever I search in the ReSharper menu, I can't find a disable option.
You can disable ReSharper 5 and newer versions by using the Suspend Now button in menu Tools → Options → ReSharper.
If you want to do it without clicking too much, open the Command Window (Ctrl + W, A) and type:
ReSharper_Suspend or ReSharper_Resume depending on what you want.
Or you can even set a keyboard shortcut for this purpose. In Visual Studio, go to Tools -> Options -> Environment -> Keyboard.
There you can assign a keyboard shortcut to ReSharper_Suspend and ReSharper_Resume.
The Command Window can also be opened with Ctrl + Alt + A, just in case you're in the editor.
Bind ReSharper_ToggleSuspended to a shortcut key.
Steps:
Tools>Options
Click Keyboard on the left hand side
Type "suspend" in the "Show commands containing:" input box
Pick the "ReSharper_ToggleSuspended"
Press shortcut keys: and
Press the "Assign" button.
Binding ReSharper_ToggleSuspended to a shortcut key (in my case: Ctrl-Shift-Q) works very well. With ReSharper not supporting the async CTP yet (as of mid-2011), when dipping into the code the uses the async keyword, this shortcut is invaluable.
I always forget how to do this and this is the top result on Google. IMO, none of the answers here are satisfactory.
So the next time I search this and to help others, here's how to do it and what the button looks like to toggle it:
Make sure Resharper is currently enabled or the commands may fail.
Open package manager console via the Quick Launch bar near the caption buttons to launch a PowerShell instance.
Enter the code below into the Package Manager Console Powershell instance:
If you want to add it to the standard toolbar:
$cmdBar = $dte.CommandBars.Item("Standard")
$cmd = $dte.Commands.Item("ReSharper_ToggleSuspended")
$ctrl = $cmd.AddControl($cmdBar, $cmdBar.Controls.Count+1)
$ctrl.Caption = "R#"
If you want to add it to a new custom toolbar:
$toolbarType = [EnvDTE.vsCommandBarType]::vsCommandBarTypeToolbar
$cmdBar = $dte.Commands.AddCommandBar("Resharper", $toolbarType)
$cmd = $dte.Commands.Item("ReSharper_ToggleSuspended")
$ctrl = $cmd.AddControl($cmdBar, $cmdBar.Controls.Count+1)
$ctrl.Caption = "R#"
If you mess up and need to start over, remove it with:
$ctrl.Delete($cmdBar)
$dte.Commands.RemoveCommandBar($cmdBar)
In addition to adding the button, you may wish to add the keyboard shortcut
ctrl+shift+Num -, ctrl+shift+Num - that is: ctrl+shift+-+-
EDIT:
Looks like StingyJack found the original post I found long ago. It never shows up when I do a google search for this
https://stackoverflow.com/a/41792417/16391
If resharper is completely missing from the options menu, it could be because the extension itself has been disabled.
In Visual Studio 2017 ReSharper 2018.X.X can be enabled and disabled by going to Help > Manage Visual Studio Performance. Then select JetBrains ReSharper ... under Extensions.
In Visual Studio 2019, you would go under Extensions->Manage Extensions->Installed
You can add a menu item to toggle ReSharper if you don't want to use the command window or a shortcut key. Sadly the ReSharper_ToggleSuspended command can't be directly added to a menu (there's an open issue on that), but it's easy enough to work around:
Create a macro like this:
Sub ToggleResharper()
DTE.ExecuteCommand("ReSharper_ToggleSuspended")
End Sub
Then add a menu item to run that macro:
Tools | Customize...
Choose the Commands tab
Choose the menu you want to put the item on
Click Add Command...
In the list on the left, choose "Macros"
In the resulting list on the right, choose the macro
Click OK
Highlight your new command in the list and click Modify Selection... to set the menu item text etc.
You need to goto Tools-->Options--->Select Resharper--->Click on suspend now,to disable it
Now Resharper supports Suspend & Resume argument at devenv.exe
(ReSharper 2019.2.3)
Run VS & Suspend R#:
devenv.exe /ReSharper.Suspend
Run VS & Resume R#:
devenv.exe /ReSharper.Resume
Here's an example usage:
In case the solution did not help to just suspend resharper (STRG+R, STRG+R did still not work for example) I decided to disable the plugin and restart visual studio.
VisualStudio > Extras > Extensions > Resharper > Disable
https://learn.microsoft.com/en-us/visualstudio/extensibility/how-to-diagnose-extension-performance
In ReSharper 8:
Tools -> Options -> ReSharper -> Suspend Now
For ReSharper 2017.2.2, go to ReSharper | Options | Product and features.
Tools -> Options -> ReSharper (Tick "Show All setting" if ReSharper option not available ). Then you can do Suspend or Resume. Hope it helps (I tested only in VS2005)
Very simple steps:
Go to Extensions → Manage Extensions
Click on Installed section at the top left and search for "resharper"
You will see disable button over the extension, click to it then restart Visual Studio and that's it!

Resources