Visual Studio equivalent to Delphi bookmarks - visual-studio

I use Delphi for many years, and although I have now moved on to Visual Studio I still fondly remember numbered bookmarks (CTRL+K+1 to set bookmark 1, CTRL+Q+1 to goto bookmark 1).
Is there a Visual Studio equivalent? I'm find the dumb bookmarks in VS a chore after Delphi. I want to bookmark then return to a specific place in the file.

DPack can give you numbered bookmarks in VisualStudio.

Ctrl K + Ctrl K - Add/Remove Bookmark on Line
Ctrl K + Ctrl N - Go to Next Bookmark
Ctrl K + Ctrl P - Go to Previous Bookmark
There are other options as well. Look under Edit->Bookmarks menu,

More a comment on your original question than an actual answer but Delphi has had much easier to remember (and type) keyboard shortcuts than what you quote available for quite some time now:
Set bookmark 1: Ctrl-Shift-1
Go to bookmark 1: Ctrl-1
If you ever go back to Delphi, this should make your life so much easier! ;)

Just to amplify Lars Truijens answer. DPack is a GExperts like plugin for visual studio. I found it great help when moving from the Delphi IDE to Visual Studio.

I find this one also very useful:
CtrlK + CtrlL - Clear alll bookmarks

There is a Bookmark Window. Go to menu View/Bookmark Window (Ctrl+K, Ctrl+W).
In there you can see all your bookmarks and rename them. That is a lot better than just seeing the numbers.
For some reason they don't allow to order that list by clicking in a column header, but you can drag the bookmarks and accommodate them in the order you want.

VSBookmarks gives something like the fantastic Delphi bookmarks feature. Tested and works in Visual Studio 2019.
Extensions > Search "VSBookmarks" (v1.7 at time of writing)
Install and restart Visual Studio
Use Ctrl + Shift + N to set a bookmark
Use Ctrl + N to move to a previous bookmark
There will likely be conflicts with existing keyboard shortcuts. To view and edit these:
Tools > Options > Environment > Keyboard
In "Press shortcut keys" type Ctrl + Shift + 1
See which command(s) are currently assigned to the shortcut
Find the command in the list and remove the shortcut
Repeat for Ctrl + Shift + 1 through Ctrl + 9
VSBookmarks applies only within the current file (which is the Delphi behaviour), but is not configurable with just a single colour for the bookmark.
Delphi is an awesome language and editor. Thanks to Sergey Vinyar and Alessandro Fragnani (for the Numbered Bookmarks extension in Visual Studio Code) for keeping the flame alive.

I use:
CTRL-F2 toggle bookmark
F2 next bookmark
SHIFT-F2 previous bookmark
CTRL-SHIFT-F2 clear all bookmarks
BTW, after using Visual Studio for years I just found about a couple of months ago that you can press ALT and drag mouse to mark a column or a square.

Related

Visual Studio Shortcut for showing list of tabs

I don't know if there is a better way to ask this. But, I mean to open the small down arrow which shows the list of tabs (see following) using a keyboard shortcut
The Command that you are looking for is Window.ShowEzMDIFileList, it can be accessed(at least on my machine) by Ctrl + Alt + Down Arrow

Is there a keyboard shortcut to move the cursor between methods in Visual Studio 2010?

Is there any keyboard shortcut to move the cursor between methods in Visual Studio? Is there any plugins that can do the same job?
All the time when I program, I want to go at the end of the current method and if I could have a shortcut that can move the cursor at the beginning of the next method and then just have to type a couple of up arrow to be where I want would be fantastic.
Thank you.
Note: For VS <2015, the following works only for the VB.NET code editor. In VS 2015+, apparently the C# code editor is also supported.
While there are no default keyboard bindings to jump between methods, you can set them up yourself:
Go to Tools → Customize…, then Keyboard…, and do the following:
Search for the commands by typing Method in the input line at the top.
Locate the two commands Edit.NextMethod and Edit.PreviousMethod.
For each of these, select the command first, then move the input focus to the input field Press shortcut keys, enter an unassigned key combination, and press the Assign button.
(The screenshot above shows that I have previously assigned one of these commands to Ctrl+Shift+<.)
Hi another (cheaper) alternative might be the CTRL+M+M to collapse/expand the current method to it's definition, allowing you to quickly navigate to the next.
Also CTRL+M+O to collapse all members is useful, with CTRL+M+L to expand all again.
Visual Studio doesn't have such a function, but JetBrains' ReSharper does. At least is the only one that I know of to offer this functionality.
For ReSharper the shortcuts are Alt-Up and Alt-Down, for previous/next member.
Try CTRL + ALT + UP. This first takes you to the scope selector where you can select a class if applicable, then press TAB which takes you to the method selector where you can select a method from the selected scope.
Note I use In Visual Studio 2012, don't know if works in other versions.
Jason Malinowski is right on his comment. It even says the shortcut keys are Ctrl+Down Arrow and Ctrl+Up Arrow. I used to use this all the time in VB6, but when I tried it lately using recent versions of visual studio, it didn't work; it would just scroll the edit window up or down one line.
When I went into Tools -> Options, select "Environment" on the left, and then the subcategory of "Keyboard", then type "Edit.ScrollLineDown" it said Ctrl+Down Arrow. When I removed this shortcut (and the one for ScrollLineUp), the next/previous method shortcuts then worked! I'm personally very happy about this.
Obviously, if you can find the right command, you can customize your keyboard shortcuts any way you please here.
I know this is old, but looks like it was added since.
Try Alt+[ or Alt+]
In Visual Studio 2013 with the commercial Visual Assist expansion you can use ALT+M to open a list with all methods in the current file. Select one, hit ENTER and the cursor will jump to it.
do not forget about the excellent, free DPack extension, which will add Alt+m shortcut which will open a list of all methods in the current class. You can type a search string to filter, and what is also great is if you tab down and enter on a method, and then later do Alt+m again, if you tab into the window you will be on the last method you selected. DPack also has many more features, like bookmarks, but I do find that you have to setup the hotkeys, or more exactly, re-assign hotkeys from other functions to DPack: https://marketplace.visualstudio.com/items?itemName=SergeyM.DPack-16348
Its Ctrl + } - by placing the cursot to end of line - using studio 2015
Same will also bring the cursor back to bottom.
so place the cursor at end of function and press Ctrl + }
In Visual Studio 2015:
Alt + Up or Alt + Down

How to sync a code window and solution explorer in Visual Studio?

If a have a code window open in Visual Studio, how can I quickly have the Solution Navigator or Solution Explorer show the current file is open?
Tools -> Options -> Projects and Solutions -> General ->
Track Active Item in Solution Explorer
Resharper?
Alt + Shift + L?
:D
With larger solutions, I find the Track Active Item option annoying as it often rearranges the view in Solution Explorer as I move from one code window to the next.
My preference is to use an extension called Code Maid, which allows you to find the item in the Solution Explorer via a context menu popup or keyboard shortcut. Has other features that you may find useful as well.
http://visualstudiogallery.msdn.microsoft.com/ef4ac3e9-d056-4383-8ca2-11721bd879b4
Here is a plugin which does that. It is also provided with on/off button which makes it comfortable to use.
There is also native shortcut in VS - CTRL + [, CTRL + S by default.
See keyboard shortcut to command SolutionExplorer.SyncWithActiveDocument
No plugins needed since at least VS 2017.

Does VS has any shortcut like ctrl+q in eclipse?

It returns your caret(aka cursor) to the place where you stopped writing code(very useful for fast code browsing)
Ctrl + - will move to the previously browsed line of code (Ctrl + Shift + - will move forward). You can download PDF versions of all the default keybindings in Visual Studio 2010 from this page.
ReSharper has Ctrl+Shift-Backspace to return to previous editing position. Or Ctrl+Shift+, (Comma) to browse some recent edition places.
In addition to what is mentioned in the other answers, you can use the undo/redo trick. As long as you want to navigate to the last edit position in the current file, a quick undo/redo will take you there.
You are looking for View.NavigateBackward. The actual keystroke depends on your personal settings, but it's probably Ctrl + -. If not, go to Tools/Customize/Commands/Keyboard to find out what it is for your setup.
There are ctrl+- and ctrl+shift+- That navigate backward and forward.

What is the shortcut to open a file within your solution in Visual Studio 2008?

What is the shortcut to open a file within your solution in Visual Studio 2008 (+ Resharper)?
Ctrl + T (ReSharper, Goto, type) will open a class file for you.
Looks like Ctrl + Shift + T opens files.
Depending on your keymap, Ctrl + Shift + N will open any file in the solution, or Ctrl + N will open any type.
If the standard toolbar is visible the following will open any file in the solution (resharper is not necessary).
Ctrl + D places you in the Find textbox. >of f will provide a dropdown with all files that start with f with path information after the filename to distinguish name collisions. Complete the filename, or arrow down to the correct one and hit enter to open it in the editor.
I attended a presentation recently where Kirk Jackson showed how to add aliases to the command window in Visual Studio. Bear with me, it gets better.
So it went like this:
Open Command Window and type
alias fo File.FileOpen
Now in your editor window hit Ctrl + / to put the focus into the Find box on the toolbar
If you use the prefix > this is command window (sneaky huh?) so type:
fo
and intellisense kicks in and shows you the names of the folders and files in the solution.
The alias is persistent between Visual Studio sessions.
Not exactly a keyboard shortcut but using this technique you can access any command in Visual Studio from the keyboard.
You should also check out Kirk's list of essential VS tips and tricks
It depends on the key mapping that you have set.
With default keymapping: Do Ctrl + T to open a type and Ctrl + Shift + T to open a file.
With IntelliJ like mapping : Do Ctrl + N to open a type and Ctrl + Shift + N to open a file.
Visit the following links for all your key mapping.
ReSharper 4 Default Keymap: Visual Studio scheme
http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap.pdf
ReSharper 4 Default Keymap: ReSharper 2.x / IDEA scheme
http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap2.pdf

Resources