Tips and tricks for the Visual Studio. NET ide

Source: Internet
Author: User
Tags word wrap
From: http://www.codeproject.com/KB/tips/VSnetIDETipsAndTricks.aspxIntroduction

A compendium of short cuts, tips and tricks, features, whatcha-may-callits for the Visual Studio. net ide.

I love vim. and the power it gives is almost corrupting. actually it is corrupting. which is why I try to see if any editor provides all the functionality provided by VIM. visual Studio. net has quite a lot of useful options. limits of them are out there in the open in the menus but I did not see them for long until I went hunting for them. some others are very obvious, but when I show them to some people, they are amazed that I can do that; so I have included some of those too. so here is a list of useful hints that I gathered. if you have any more, please do send them and I'll add them here with due recognition to the contributor. by the way, I do not take credit for these hints but I will take credit for putting them together from varous sources on the net.

1. Record and play temporary macro

Ctrl+Shift+RTo record a new temporary macro. PressCtrl+Shift+RTo stop recording.Ctrl+Shift+PTo play the recorded macro.

This works similar to * recording * in Vim. If you think you are going to be repeating a set of keyboard keys, then record them once and play them each time after.

2. Multiple copy/Pastes

Ctrl+Shift+VCycles through the clipboard ring. You can copy/cut multiple times from one area of code, then go to another area and paste them one after another.

3. Drag and Drop code snippets

The toolbox(Ctrl+Alt+X)Window has multiple tabs. you can drag and drop code onto this window and copy it elsewhere. some tabs do not allow dropping code into them; those that allow will have the appropriate icon. the general TAB works for me.

4. Previous cursor positions

Ctrl+-I. e. CTRL + hyphen. This cycles you through the code positions you visited.

Ctrl+Shift+-To navigate in the opposite direction.

5. incremental search

To incrementally search for text as you type, first pressCtrl+i. Then type the word you want to search. hit backspace to clear a character and enter to finish. pressing F3 after this will work as usual, I. e. search for the next occurrence of previous search.

Ctrl+i-Ctrl+iWorks like F3.

6. matching brace/comment/region/quote

Ctrl+]Takes you to the matching brace. It also takes you to the matching comment, region or quote depending on what is at the cursor now.

7. Vertical Block Selection

Press ALT and then select the area you want with your mouse.

8. Closing/showing support windows

There are a bunch of necessary/useful windows in the Visual Studio ide like properties (F4), Solution Explorer (Ctrl+Alt+L), Output window (Ctrl+Alt+O), Task list (Ctrl+Alt+K) Etc. However, they take up a lot of space. An easy way around this is to use the Auto Hide feature.

Open the window you want. Right click on its title and choose Auto Hide. The window will dock in whenever your mouse is not hovering over it.

9. Tab groups-group code editor windows

If you have your source code windows open, you can group them logically using tab groups. Right click the tab of the code window and chooseNew Horizontal Tab Group. This will move the window into a split window, allowing you to see both files. You can add more files to this new tab group and also move files back to the previous group by choosingMove To Previous Tab Group.

10. Track things you have to do with task list

The task list window (Ctrl+Alt+K) Allows you to keep track of the things you have to do. Right click on the task list window and chooseShow Tasks|AllTo see a list of tasks.Ctrl+Shift+F12To cycle through your list of tasks.

By default, comments marked with a todo will appear in the task list.

11. Edit task list comment tokens

You can add your own set of comment tokens (like the todo comment token). GotoTools|Options|Environment|Task List|Comment TokensAnd make your changes. You can change the priority appearance of each comment token too.

12. Add task list shortcut cut

Add a shortcut to the task listCtrl+K,Ctrl+H. This will add the current line to the task list.

13. Auto-complete

PressCtrl+Space OrAlt+RightArrowTo auto-complete the word. intelliisense suggestions may pop up a window if there is more than one possibility.

14. intelliisense suggestions window

PressCtrl+Shift+Space To bring up the intelliisense suggestions window. when giving parameters for functions, I often need to escape the suggestions window to check another part of code. to bring it back, I used to delete a comma and then type it again; but this is easier.

15. Word Wrap

Ctrl+R Ctrl+R

Or

Tools|Options|Text Editor|All Languages|General|Word Wrap

If you want to set this option for only one language, then choose the appropriate language insteadAll Languages.

16. Line numbering

Tools|Options|Text Editor|All Languages|General|Line numbers.

If you want to set this option for only one language, then choose the appropriate language insteadAll Languages.

17. Customizing Visual Studio's code generation templates

Customizing Visual Studio's code generation templates.

18. Default shortcut keys

Msdn.

19. favorites window

Your ide also functions as a browser. To see your list of favorites, pressCtrl+Alt+FOr chooseView|Other Windows|Favorites.

20. bookmarks

Bookmarks are available throughEdit|Bookmarks. Bookmarks allow you to mark places in your code that you wowould want to come back.

  • Create/remove bookmark-Ctrl+K,Ctrl+K
  • Move to next bookmark-Ctrl+K,Ctrl+N
  • Move to previous bookmark-Ctrl+K,Ctrl+P
  • Clear all bookmarks-Ctrl+K,Ctrl+L
21. Code formatting
  • Auto-format selection-Ctrl+K,Ctrl+F
  • Convert to lower case-Ctrl+U
  • Convert to upper case-Ctrl+Shift+U
  • Comment selection-Ctrl+K,Ctrl+C
  • Uncomment selection-Ctrl+K,Ctrl+U
22. Outlining

I like this feature that allows me to hide code that is irrelevant to what I'm currently working on.

  • Fold/Unfold the current code block-Ctrl+M,Ctrl+M
  • Unfold all-Ctrl+M,Ctrl+L
  • Stop outlining-Ctrl+M,Ctrl+P
  • Fold all-Ctrl+M,Ctrl+O
23. Build and debug
  • Build-Ctrl+Shift+B
  • Run-Ctrl+F5
  • Debug-F5
  • Cycle through Build errors-F8
License

This article has no explicit license attached to it but may contain in usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the author
Sathishvj

~ /Sathishvj
Location: India
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.