Bookmarking with Visual Studio and ReSharper 5.0
Posted by Vadim on January 8, 2010
When I code in my favorite IDE (these days it’s Visual Studio), I use bookmarks very heavily. It’s one of my favorite ways to navigate in my code.
I press Ctrl-K + Ctrl-K to set a mark in my code and a little blue rectangular appears on the left side of the line where the cursor is.
To remove the bookmark you need to press Ctrl-K + Ctrl-K again.
The reason you set a bookmark is to move fast to a specific line of code. To do that just press Ctrl-K + Ctrl-N and faster than you can say “bookmark” the IDE will display you the line of code you set the mark. When you set multiple bookmarks, Ctrl-K + Ctrl-N will move from one mark to another in the order you set them. The cursor will jump back to the first bookmark after the last one. To go in opposite direction just press Ctrl-K + Ctrl-P. It easy to remember because N means Next and P stands for Previous.
Your bookmarks will be saved when you close your Visual Studio. When you open your code file a week later, all your marks will decorate your source code and you probably will not even remember why did you set those bookmarks in the first place. What you want to do is to remove them before you set new ones. You don’t need to go to each bookmark and press Ctrl-K + Ctrl-K. All you need to do is to press Ctrl-K + Ctrl-L to remove all the old bookmarks. Visual Studio will present you with a Yes – No dialog for you to confirm that you didn’t make a mistake by pressing Ctrl-K + Ctrl-L combination and really want delete all the bookmarks.
You probably wondering but what if I have 20 bookmarks and want to delete only five of them. In this case I would recommend to press Ctrl-K+Ctrl-W to open a Bookmark Window.
You can explore this window on your own because the reason I’m writing this is not to teach you about bookmarks but to tell you about new feature in ReSharper 5 which is currently in Beta.
I’ve been using ReSharper in last few years and to be honest I got very depended on this tool. When I have to code on someone computer and they don’t have R#, I feel like I have to drive Toyota Yaris after driving CL-Class Mercedes for years.
I don’t know yet if I’m going to use bookmarking feature in R# or keep using bookmarks that provided by Visual Studio. But I want to give R# a chance and use it for a month to see how I like bookmarking with R#.
R# allows you to number your bookmarks between 0 and 9. For example to create bookmark 0 you press Ctrl-Shift-0 and of course to create bookmark 6 you press Ctrl-Shift-6. Then when you need fast access bookmark 0 you simple press Ctrl-0.
Another way to set a bookmark is by pressing Ctrl-Shift-`, you will be presented with the screen where you can set or remove a bookmark.
Using up and down error you can number the bookmark or choose the last item in the list to create an anonymous bookmark. To create bookmark press the Insert key on your keyboard or to remove one press the Delete key.
To view available bookmarks press Ctrl-`.
I just started using R# 5 Beta and so far I like bookmarking feature in Visual Studio better but as I promised I’m going to try to use bookmarks in R# for a month.