I want to assign a hotkey to a function, but the keys are already used in some other functions' combination.
How can I easely remove this hotkey from all these entries so I free it up and am able to asign it to the function I want?
I am using Visual Studio C# Express 2008, but you can go into Tools/Options/Environment/Keyboard. If you put your cursor in the Press shortcut keys field and type the key you want to remap, it will show you what commands use that key and let you clear or change the assignments.
Go assign the command a shortcut (Tools > Options > Environment > Keyboard). If it's already taken, that will display, but it won't keep you from assigning it to something else (which removes the shortcut from the original task).
Some key shortcuts are layered. So for instance while editing text the Text Editor keys override the Global ones. If you set your shortcut for the priority layer you can ignore whatever is assigned on a lower layer. So for text editing keys assign them under Text Editing and not Global to avoid them being ignored.
Repeat this for as many layers that you run into. I do this part incrementally only if there is some other context I want that same shortcut for.
Related
Very often, I have to type the following:
{\texttt{something}}
Is there some possibility of creating a keyboard shortcut that, after having selected something, added {\texttt{}} to something?
Yes, you can do this with an RStudio Add-in. These are relatively easy to build since they're just R packages containing regular R code, and you can add keyboard bindings for them to set up your own hotkeys. Instructions here for making addins:
https://rstudio.github.io/rstudioaddins/
Within your add-in you can use the rstudioapi package's document manipulation methods to locate the cursor/selected text and replace the range with the same value.
https://rstudio.github.io/rstudioapi/reference/rstudio-documents.html
So, I have some code for a Rect variable mageSection:
And I'd like to copy the same code for a different variable warriorSection. To achieve this:
So I'd like to know if there is a visual studio shortcut for allow you to change variable name in multiple line in visual studio without refactoring the whole variable name.i.e. I don't have to manually change those names from mageSection to warriorSectionfor these 4 lines.
It is a question about shortcut in visual studio rather than writing functions, as I'd like to know the shortcut for this. Many thanks!
Copy and paste the section of code.
Now select the pasted code and hit Ctrl-H to bring up the Quick Replace dialog.
In the top box, type "mageSection".
In the bottom box, type "warriorSection".
Hit Enter and it will find the first occurrence and replace it.
Hit Enter three more times...done.
If I'm understanding your question correctly you should be able to hold down alt while clicking into multiple lines and change them all at once. Then hit ESC to exit multiline editing.
How can I disable all default shortcuts that use key chords? I am trying to add custom shortcuts, but they do not work because there are dozens of shortcuts that use the keys that I want to use as 'key chords.'
I suppose I could find which ones use my keys and go through one by one to remove them, but that would be extremely tedious, since I can only view the command that use it in the 'used by' dropdown, which only shows a few commands at once. I would have to write each of those down, search for them individually, and then remove all the shortcut assignments associated with them.
The shortcuts I intend to use are "ctrl + R" and "ctrl + T", and map them to VS's 'Comment out selected lines' and 'Uncomment out selected lines' functions.
You can go ahead and assign CtrlR to Edit.CommentSelection. Under "Use new shortcut in:", select Text Editor. Visual Studio will automatically remove all hotkey key sequences that begin with CtrlR in the Text Editor context.
I had a similar problem (at VS 2017 (Left Arrow) was pressed. Waiting for second key of chord) and found Resharper's experimental Shortcuts Live View feature invaluable in reporting what actual shortcut had been assigned and are currently active. With that you can identify where a chordal kay has been assigned, and remove it. If you're using the latest Resharper, press the left Ctrl key three times in text editor.
I am using VS 2010 and there is one shortcut I really like which is a shortcut I set myself: ctrl + shift + Q in order to remove all unused usings and sort the remaining ones.
I installed ReSharper and it overwrote my VS shortcuts, so pressing ctrl + shift + Q will generate a comment (/**/).
Is there any way I can disable this single shortcut? (or change it to any other key combination that will allow me to use my old one?
I tried this solution: How to change shortcut keys for a given command in ReSharper? but my shortcut is still set in my VS configs.
Go to Tools > Options > Environment > Keyboard
Search for a command called ReSharper.ReSharper_BlockComment
Remove the current shortcut or reassign another shortcut to the ReSharper command.
I'm guessing that you've set your shortcut in Global context whereas ReSharper has assigned the shortcut to its command in the Text Editor context. The latter takes precedence when you're invoking the shortcut while editing your code.
Also, consider taking a look at ReSharper's own Code Cleanup, which takes care of unused directives, other redundant items, and formatting.
To elaborate on the steps:
Suppose you want to change the binding of "Ctrl +Q"
Open Tools Options Environment Keyboard
Under "Press Shortcut Keys" Enter : Ctrl +Q
This will show you what all commands are currently bound to this shortcut
Then search for the commands in the "Show Commands containg window " and REMOVE the assignment (for the context that you want).
Note that more than 1 command can bind to a shortcut depending on the context and so make sure you remove whatever you need
Then verify that no the binding is gone, by repeating step 2 above
Finally search for the new command that you want to bind the shortcut to and then enter shortcut and bind it in the context that you want to using ASSIGN
Does Visual Studio (any version) offer the ability to select text in either a block or select several snippets at once, to either change or delete? To be clear I'm referring to the actual text-editor interface.
you can certainly do block selection by hold down the Alt key while doing a selection
Go to opening or closing brace and press Ctrl+Shift+].