Whats the visual studio equivalent to eclipse alt + arrow Left - visual-studio-2010

From Eclipse i'm confortable with
F3 to enter a method and ALT + <-
In visual studio (2010) its F12 to enter the method, but how do i get back to the call, where i jumped in?

You can use Shift + F12 to list all references, and the original method will be listed.
Ctrl + - will navigate backward, whilst Ctrl + Shift + - will navigate forward (in the context of where you were working in your code).
Ctrl + , will allow you to search for a method to navigate to.

In my VS Code V 1.20.1 the shortcut is:
Ctrl + Alt + - for backward.
For going forward is Ctrl + Shift + -.
We can change these shortcuts just like in Eclipse by selecting the menu File -> Preferences -> Keyboard shortcuts, and type on the search field for Go Back or Go Forward.

To do this on MacOS VS Code
^+- to go backward.
^ + shift + - to go forward.
Note that^ is control on your keyboard.
Full list of other mac keyboard shortcuts here: https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf

Related

Is there any shortcut for CodeBlocks to format the code?

Is there any shortcut for CodeBlocks to format the code?
I haven't find any tip in google.
I found only "format use AStyle", but it come up with right mouse button only...
probably not by default but you should be able to assign it there:
Settings -> Editor -> Keyboard shortcuts -> Plugins -> Source code formatter (AStyle)
My favourite = Ctrl + A then Ctrl + Shift + F.
You (these are the default settings I believe) can select a block of code and press the Tab key. This will indent the entire block.
So for indenting a whole file: Ctrl + A, then Tab.
In addition, you can use Shift + Tab on a selected block to "unindent"
You can move through the open tabs with Ctrl + Shift + Tab.
As for the best shortcuts:
I like Ctrl + D to duplicate a line and
Ctrl + L to copy it.
Anyway, you can set whatever shortkeys you like in the Editor menu (there you will also be able to find all shortkey currently set).

How to uncomment multiple lines of code in Visual Studio

I did a ctrl K + ctrl C (adds // to a line) on a lot of lines of code that I need uncommented. What is the quick key method to uncomment code in Visual studio?
Ctrl+K, Ctrl+U removes the // comments
I believe it is Ctrl + K, Ctrl + U.
Ctrl + K, Ctrl + U.
There is also a button for it on the Standard toolbar.
ctrl + /
can be used for adding and removing comments.
Try + U or click the little icon on the toolbar.
If you're using Resharper, there is a much nicer alternative:
just right Alt + / for both
By using this single shortcut, you can simply toggle between commenting/uncommenting code, without having to remember/switch between two shortcuts for each.
Ctrl + K + C (to comment) and Ctrl + k + U (to uncomment the code)
Or
or use Ctrl + / (for the same)
Qwerty: Ctrl + /
Azerty: Ctrl + :
Just wanted to add, that in the latest version of VS, ctrl + u makes it caps. They instead made it a toggle command, so it is actually just ctrl + k again to make it uncommented.
I have the german keyboardlayout.
VSCode-x64-1.52.1
To leave a comment:
You have to highlight the code, then push
Ctrl + #
or
Ctrl+K, stay at Ctrl and push C
to commen out:
Ctrl + #, it toggles on/off the comment
or
Ctrl + K, stay at Ctrl and push U
Mine was a bit different. It is ctrl-shift-C to comment and ctrl-shift-alt-C to uncomment.
I am using Visual Studio Community 2017.
Ctrl + Q alternates between comment and uncomment.
Unfortunately Ctrl K Ctrl U does not work in few environments, rather it adds instead of removing. My case on windows, using composer file I faced Ctrl K Ctrl U not working.
I m using VS Code, ver 1.36.1
links to all keys short cuts: https://code.visualstudio.com/docs/getstarted/keybindings
In Visual C++ 2019 Ctrl + Shift + / both comments and uncomments.

Is there a way to delete a line in Visual Studio without cutting it?

I want to delete a line just like hitting Ctrl + X without anything selected, but without saving the line to the copy stack. Is this possible?
I'm using Visual Studio 2010.
Edit.LineDelete is the name of the command. By default it's bound to Ctrl + Shift + L, but you can give it whatever you like in Tools | Options | Keyboard.
Edit: Corrected default shortcut info.
Ctrl + Shift + L will delete the line and not copy to the clipboard.
I mapped Ctrl + L (Global) to Edit.LineDelete. Otherwise, the shortcut key is Ctrl + Shift + L, which is awkward. Go to Tools > Options > Environment > Keyboard as shown below.
Correction in my answer
Ubuntu 16 &
Visual studio Version: 1.30.1
To cut line
Shift + del
To delete line Shift + Ctrl + k
CTRL + L (Visual Studio 2019 Windows)
Its Cmd + Shift + K on mac by default.
But it can be modified according to user needs from the settings (Preferences -> Keyboard Shortcuts) -> search for Delete Line key value.
Valid Answer By 2022 for VS Code (with image)
All the above answers regarding Ctrl + Shift + L are now deprecated.
The correct default behavior is Ctrl + Shift + K
(⌘ + Shift + K if you're a MAC user).
To change this default behavior:
1- Go to File > Preferences > Keyboard Shortcuts (OR click Ctr+K Ctrl+S)
2- Type in the search bar delete line
Here you will find the corresponding behavior. You can change it just by double-clicking on it and pressing any desired combination of keys on your keyboard (pay attention of conflicting shortcuts).
By default, if you are using the C# default profile, you can delete a line using Ctrl + Shift + L.
You can customize this using Tools->Customize. Select "Keyboard". Look for the command Edit.LineDelete to assign it to whichever keyboard shortcut you like.
Source
If you got here looking for an answer for Visual Studio Code the default shortcut is:
ctrl + shift + K for Windows
⌘ + shift + K for MacOS
However, you can change on File > Preferences > Keyboard shortcuts
{
"key": "ctrl+shift+delete",
"command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
}
Source
none of the above answers worked for me. to delete a line in visual studio code use :shift+del
All the answers were helpful but didn't seem to work for me.
So I found the solution --> for Visual Studio 2017 (and certainly 2019):
Tools > Options > Environment > Keyboard > on the right pane select Edit.LineEdit.
Below there is a ComboBox Use new shortcut in: with Global written --> Change it to Text Editor.
On the right there is a Text input Press shortcut keys:, so use the shortcut of your choice.
Then click on Assign PushButton on the right (otherwise it won't be applied).
Finally > OK.
You can now open a .CPP file and use your shortcut to remove a line.
On Visual Studio 2019 for Mac, it's CTRL + K to cut the whole line by default.
Here is a url for the keyboard short cut reference for windows:
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
For windows: Ctrl + Shift + k
The other answers are specific to Visual Studio, which is what was requested by OP, however if anyone is looking for a more generalized way to do this for most Windows programs, you can also Triple-Click to select any block of text, then just press the Delete key. This works for any Windows text editors or TextBoxes, including password boxes, search boxes, browser web address boxes, etc. For text editors such as Visual Studio, a block of text is typically one line of code. Obviously you can do other things too, such as triple-click to select a line of code, then Ctrl-X, Ctrl-V to cut/paste, etc, or just triple-click and type over it to replace a line.

Visual Studio 2010 Keyboard Shortcut Chords

I started out with VB6 default shortcuts where Ctrl + R brings up the Solution Explorer window.
Now when I hit Ctrl + R I see a status message saying that VS is waiting for me to hit the next sequence in the chord, suggesting to me that I have shortcuts that begin with Ctrl + R but require another keystroke.
This suggests to me that having one or more shortcut sequences that begin with Ctrl + Rinvalidates the Ctrl + R shortcut, which I can understand, but the question is, how do I find what those command are so I can assign a different sequence to them?
Also, shouldn't VS warn me when assigning the first chord shorcut that begins with Ctrl + R that this will invalidate my Ctrl + R shortcut or, it should clear it out so Ctrl + R is no longer a shortcut for the Solution Explorer window.
Anyway, I guess the question is how do I locate the commands that begin with Ctrl + R so I can change them so they dont collide with my Solution Explorer shortcut Ctrl + R?
In VS 2010, Tools | Options | Environment | Keyboard gets you to the right place. Now, put the cursor in Press shortcut keys, and press the keys you are interested in (so Ctrl + R). The Shortcut currently used by dropdown will then show you all the shortcuts that currently involve the keys you have pressed.
I agree it would be a 'nice to have' for VS to warn about overlapping shortcuts, but note that different shortcuts can have different scopes of effect (in the Use new shortcut in dropdown), so this might not be as easy as it sounds.
The keybindings poster from MSDN might be helpful. It looks Ctrl + R behaves differently depending on if you are debugging or not.
Have a look at IntelliCommand Plugin. This helped me out a lot in learning and remembering the chrod combinations.
Also Learn the shortcut Plugin is pretty cool too.

Visual Studio 2008 - jump to line number shortcut

I can go to a specific line number by double clicking in the status bar in Visual Studio. Is there a keyboard shortcut that does the same thing?
Ctrl + G
Check out all the keyboard shortcuts at:
http://www.microsoft.com/downloads/details.aspx?familyid=e5f902a8-5bb5-4cc6-907e-472809749973&displaylang=en
Ctrl + G works for me.
If it doesn't work for you, you can always map whatever shortcut you want under Tools | Options | Environment | Keyboard.
EDIT: Yes, as #Brian mentions, the command in this case is Edit.GoTo
I just realised that the default in C# settings for this command is Ctrl + G, whereas in VB Settings, there is no default keyboard short - it's mapped to show the immediate window - strange I think. I swapped the mappings so that the two environment behave the same.
Every IDE or even text editor I have ever used either uses Ctrl + L or Ctrl + G for this purpose.
I assume this could stand for Ctrl + Line or Ctrl + Goto
Yep Ctrl + G.
From this answer you can get a nice Shortcut poster.

Resources