Posts tagged 'Advanced Editing'

Tuesday, September 30, 2014

Tip 2.22: How to reuse the same editor window when opening files

"Visual Studio Tips, 251 ways to improve your Productivity" in Visual Studio, courtesy of 'Sara Ford'

Sara Ford's Blog



Go to Tools–Options–Environment–Documents, and check the Reuse Current Document Window, If Saved option to give this tip a try.



If the current document window is dirty (meaning you've made a modification but haven't saved it yet), the next document opens in its own document window. However, if the current document is saved, the new document just opens over it.

She tried using this from time to time when she owned testing it, but it wasn't for her.

Happy Programming! =)
Posted by Nils-Holger at 1:30 PM with 442 comments.

Monday, September 29, 2014

Tip 2.21: How to get syntax highlighting for a given file extension

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



On the Tools–Options–Text Editor–File Extension page, you can map a file extension to one of the included editors.



And after mapping the .Nils extension to a C# editor, we now get syntax highlighting for the file.



There is also an option to map files without extensions to a specific editor.



Happy Programming! =)
Posted by Nils-Holger at 1:36 PM with 660 comments.

Sunday, September 28, 2014

Tip 2.20: What does Visual Studio do to autorecover files in the case of an unexpected shutdown?

Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



People on the testing team used to tease the tester who owned the AutoRecover feature that every time there was a power failure in the building (because of a storm or other such event), he was standing near some big red switch in the off position with a grin on his face so that everyone in the building could test his features for him.


Under Tools–Options–Environment, you'll find the AutoRecover page.



Note that you can opt out of the AutoRecover feature by unchecking the Save AutoRecover Information Every check box.

The rest of the page is self-explanatory, but did you know where Visual Studio saves these autorecovered files? They are saved in \My Documents\Visual Studio \Backup Files\.



In case you (hopefully) have never seen the AutoRecover dialog box, here's what it looks like. It'll pop up the next time you launch Visual Studio after an unexpected shutdown. You have the options to either use the backup files or ignore them.



Happy Programming! =)
Posted by Nils-Holger at 10:41 AM with 441 comments.

Saturday, September 27, 2014

Tip 2.19: You can remove unused using statements

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In C#, there's the option to remove any of your unused using statements. This option is especially helpful if you're reusing some sort of template over and over again. Instead of having to comment out each line, compile, see whether the compile was successful, and then either remove or uncomment the line, you can bring up the editor context menu (just right-click in the editor) and choose Organize Usings–Remove Unused Usings. This will do all the hard work for you.



Happy Programming! =)
Posted by Nils-Holger at 11:55 AM with 448 comments.

Friday, September 26, 2014

Tip 2.18: How to change the Brace Matching color

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can change the Brace Matching color. Go to Tools–Options–Environment–Fonts And Colors, select Brace Matching (Rectangle), and set this option to the desired color.



And now your curly braces show up with a new highlight color.



Sara Aside

She likes the bright green color. It must be Seattle's nine months of gray weather getting to her.


Happy Programming! =)
Posted by Nils-Holger at 12:48 PM with 440 comments.

Thursday, September 25, 2014

Tip 2.17: What does that Automatic Delimiter Highlighting option do?

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Honestly, she had to ask around to find out what this one did. She simply couldn't remember.




Whenever you have code construct pairs (that's what the documentation calls them), when you finish typing either the start or end pair, both pairs of words become bold. To turn off this feature, go to Tools–Options–Text Editor–General and uncheck Automatic Delimiter Highlighting.



You can customize the color for the bolding by going to Tools–Options–Environment–Fonts And Colors and selecting Brace Matching(Highlight).



And now the #if and #endif appear in bold and in red.

Happy Programming! =)
Posted by Nils-Holger at 12:41 PM with 473 comments.

Wednesday, September 24, 2014

Tip 2.16: How to open something in the binary editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The first time she saw this test case in the editor test bed, she thought, "Whoa, she had opened the Open File dialog box a thousand times and have never seen this option before."




To use the binary editor, follow these steps:
  1. Go to File–Open File.
  2. Click the drop-down arrow on the Open button or, from the keyboard, just press the down arrow.
  3. Choose Binary Editor and click OK or Open, depending on your Visual Studio version.




Happy Programming! =)
Posted by Nils-Holger at 12:11 PM with 441 comments.

Tuesday, September 23, 2014

Tip 2.15: How to enable Emacs and Brief editor emulations

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In Visual Studio 2005, we introduced Emacs and Brief emulations into the editor.

Go to Tools–Options–Environment–Keyboard, and then drop down the Apply The Following Additional Keyboard Mapping Scheme list. Then choose either Brief or Emacs.



To return to the standard editor, just select (Default).

Happy Programming! =)
Posted by Nils-Holger at 12:34 PM with 441 comments.

Monday, September 22, 2014

Tip 2.14: You can hide outlining (selection margin) without turning off outlining

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Go to Tools–Options–Text Editor–General, and uncheck Selection Margin. Although the left margin that indicates a code block is gone, outlining will still work.



Happy Programming! =)
Posted by Nils-Holger at 12:28 PM with 447 comments.

Sunday, September 21, 2014

Tip 2.13: You can cut and paste a collapsed block of code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

You can cut and paste a collapsed block of code, keeping all of the code inside intact. Of course, this is exactly what you would expect, but she never thought about trying it.




With a block of code collapsed, as indicated to the right of the code lines shown in the preceding illustration, select the block and cut or just cut the line via your favorite mechanism for cutting a line. Now navigate to the desired location and paste.



Note the code will be automatically expanded upon pasting.

The idea behind this tip is that you want to quickly cut and paste an entire function, but the function is quite long. You can use the approach shown in the previous tip (specifically, Ctrl+M, Ctrl+M to toggle between expanding and collapsing a block of code) to collapse the function to just the function name. Then press Ctrl+L to cut the current line. Now you can paste the function wherever you want.

Happy Programming! =)
Posted by Nils-Holger at 1:12 PM with 440 comments.

Saturday, September 20, 2014

Tip 2.12: How to collapse and expand code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are five commands for outline toggling; they can be found on the Edit–Outlining menu.

Toggle Outlining Expansion



By pressing Ctrl+M, Ctrl+M anywhere within the code block, you can toggle between collapsing a given block of code (as shown here)



and expanding it (as shown next)



Toggle All Outlining



By pressing Ctrl+M, Ctrl+L anywhere in the editor, you can toggle between collapsing and expanding the entire file.

Completely collapsed:



Completely expanded:



Stop Outlining



By pressing Ctrl+M, Ctrl+P anywhere in the editor, you can turn off outlining.



Start Automatic Outlining



Unfortunately, start outlining and stop outlining are not the same command, so you can't toggle between one state and the other. Additionally, using the General Development Settings, start outlining is not bound to a keyboard shortcut. So you need to go to Edit–Outlining–Start Automatic Outlining to turn on outlining again.

Collapse to Definitions



In her opinion, Collapse To Definitions is the most useful of all the outlining commands (mostly because it was the only one she used, except for when she had to test the others). This command allows you to quickly glance at all of your functions.



Happy Programming! =)
Posted by Nils-Holger at 1:27 PM with 435 comments.

Friday, September 19, 2014

Tip 2.11: What's the difference between smart indenting and block indenting?

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Smart indenting is the option you want, provided you want the cursor to be properly indented whenever you press Enter or the up and down arrows in the code. An example is when you create a new method called Method1() and then hit Enter. You'll notice the cursor automatically indents itself. If you continue to hit Enter, the cursor will remain indented. Not all languages support this smart indenting, but if the language you're using does, this should be the default setting for that language.

Block indenting is similar to a document editor. Using Visual Basic as an example, the difference here is when you type in Method1() and hit Enter, only that first new line is automatically indented. The next new line places the cursor at column 0.

Selecting None will not indent any new lines. You will have to indent everything manually.

Happy Programming! =)
Posted by Nils-Holger at 1:03 PM with 445 comments.

Thursday, September 18, 2014

Tip 2.10: You can increase and decrease the line indent from the text editor toolbar

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Not one of her best "Tip of the Day" titles, but it illustrates the point. =)




With either a single line or several lines selected, you can use either the Increase Indent or Decrease Indent command found on either the text editor toolbar or the Edit–Advanced menu (where it is listed as Increase/Decrease Line Indent).

Happy Programming! =)
Posted by Nils-Holger at 12:45 PM with 433 comments.

Wednesday, September 17, 2014

Tip 2.9: How to convert spaces to tabs and tabs to spaces

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are four commands that involve converting spaces to tabs and tabs to spaces. The first two commands are found on the Edit–Advanced menu:
  • Tabify Selected Lines Replaces the leading white space on a line that contains the selection with tabs.
  • Untabify Selected Lines Replaces the leading white space on a line that contains the selection with spaces.

Note

The Edit–Advanced–(Un)Tabify Selected Lines isn't supported for Microsoft Visual Basic.


The last two commands are not found on the Edit menu but are available for you to either bind to a keyboard shortcut or manually add to the Edit menu or Text Editor toolbar:
  • Edit.ConvertTabsToSpaces Converts selected white space to spaces.
  • Edit.ConvertSpacesToTabs Converts selected white space to tabs.


Note that you may have to uncheck Tools–Options–Text Editor–Basic–VB Specific–Pretty Listing (Reformatting) of Code to use Edit.ConvertTabsToSpaces and Edit.ConvertSpacesToTabs.

Happy Programming! =)
Posted by Nils-Holger at 12:02 PM with 434 comments.

Tuesday, September 16, 2014

Tip 2.8: How to keep tabs or to insert spaces

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This tip and Tip 2.9 were her least favorite features to test. It drove her crazy trying to keep track of when a tab should get inserted, when the cursor should move to the correct formatted position, and so on and so forth. Now she uses only spaces in her code. =)


Go to Tools–Options–Text Editor––Tabs to switch between using tabs and inserting spaces.



Note that you can set this for all languages on the Text Editor–All Languages page, but usually this is something you want to set for each individual language.

Happy Programming! =)
Posted by Nils-Holger at 12:13 PM with 432 comments.

Monday, September 15, 2014

Tip 2.7: How to format the document, the selected text, or just the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ever been typing in the editor and, for whatever reason, the text isn't indented properly on the line? Instead of manually pressing Backspace or Tab for each line of text, just press Ctrl+K, Ctrl+D, which performs the Format Document command.

For larger files, you might just want to select the region that isn't justified correctly and use Ctrl+K, Ctrl+F. This keyboard shortcut formats the current line if you have nothing selected.

These commands are found under the Edit–Advanced menu.



Happy Programming! =)
Posted by Nils-Holger at 1:18 PM with 447 comments.

Sunday, September 14, 2014

Tip 2.6: You can display guidelines in the editor to help format your code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The most popular tip on her blog is the one about guidelines. She thinks it is so popular because it was one of her very first tips about Microsoft Visual Studio many, many years ago. She's had a lot of people thank her for including that tip in her blog, but when a random developer stopped her in the hallway to thank her because he wrote the feature, that took hallway conversations to a new level. He had moved to another area of Visual Studio many years before my writing the tip, so he was very excited to see his feature get some public attention. She think one of the hardest things for any developer is to spend time coding a feature that never gets into the hands of a customer.


Important

To enable guidelines, you need to modify your registry settings. Please be aware that you use guidelines at your own risk and should do so only if you are comfortable modifying your registry settings. You will need to restart Visual Studio after modifying the registry for the changes to take effect.


Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Editor.

Create a String (RG_SZ) key called Guides.

The value is in the format of RGB(x,y,z) n1,...,n13, where x,y,z are the RGB values and n is the column number. You can have at most 13 guidelines. For example, RGB(255,0,0) 5,20 will put two red guidelines at column positions 5 and 20, as illustrated here:



Happy Programming! =)
Posted by Nils-Holger at 10:58 PM with 431 comments.

Saturday, September 13, 2014

Tip 2.5: How to quickly comment and uncomment code using keyboard shortcuts

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ah, it really is the simple things in life, isn't it?

Use Ctrl+K, Ctrl+C to comment code and Ctrl+K, Ctrl+U to uncomment code. All the default development settings have these commands bound to these keyboard shortcuts.

You can find these commands under the Edit–Advanced menu as shown here:



Happy Programming! =)
Posted by Nils-Holger at 12:44 PM with 437 comments.

Friday, September 12, 2014

Tip 2.4: How to swap the current anchor position in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ctrl+K, Ctrl+A will swap the current anchor position.

Sara Aside

To test Emacs emulations, she decided to write all her test cases in Emacs mode. (Emacs is a text editor, similar to Visual Studio. For details, see the Wikipedia article http://en.wikipedia.org/wiki/Emacs.) What was interesting is that she seemed to swap the anchor position all the time (using the appropriate shortcuts in Emacs mode); yet whenever she wasn't in Emacs mode, she never did this. She thinks it was just the way she was trained in college to think about the Emacs editing experience that made her want to swap the anchor position.


Cursor position before swap:



Cursor position after swap:



Happy Programming! =)
Posted by Nils-Holger at 2:36 PM with 442 comments.

Thursday, September 11, 2014

Tip 2.3: You can use Ctrl+= to select code from the current cursor location to the last go-back marker

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



See Tip 1.16 for more information about go-back markers. The keyboard shortcut used to select code from the current cursor location to the last go-back marker is Ctrl+=, and the command is Edit.SelectToLastGoBack.

Ctrl+= to select all text from current cursor location to last go-back marker

In the previous graphic, Sara started the cursor after the first opening curly brace and the clicked the mouse about 15 lines down to drop a go-back marker. Then she pressed Ctrl+= to select all the text back to the last go-back marker.

Happy Programming! =)
Posted by Nils-Holger at 1:28 PM with 653 comments.

Wednesday, September 10, 2014

Tip 2.2: How to jump to the beginning of some selected text when hitting escape

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



She hopes this tip's title makes sense. The idea is that you select some text and then hit Escape. Now where do you want the cursor to go?



If you want it to stay where it is, that's the default behavior. But if you want it to jump to the beginning of the selection (that is, the selection anchor), go to Tools–Options–Text Editor–General and check Go To Selection Anchor After Escape.

Happy Programming! =)
Posted by Nils-Holger at 12:58 PM with 832 comments.

Tuesday, September 9, 2014

Tip 2.1: How to use box/column selection in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The editor offers two different selection models: stream and box. There's also line selection, but that's only in Brief emulations. (See Tip 2.15 for more information on editor emulations.)

Stream selection, using Shift+Arrow key, is what everyone is familiar with. But box selection allows you to manually select columns and lines at the same time.



Just hold down Shift+Alt+Arrow key and you'll quickly get the feel for box selection. You can also use box selection using the mouse by holding down the Alt key while you select text. Cut, Copy, Paste still works, but just keep track of where you started to select the text. Ah, the memories of having to test all this functionality.

Happy Programming! =)
Posted by Nils-Holger at 1:14 PM with 843 comments.

Sunday, January 19, 2014

Tip 2.21: How to get syntax highlighting for a given file extension

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



On the Tools–Options–Text Editor–File Extension page, you can map a file extension to one of the included editors.



And after mapping the .Nils extension to a C# editor, we now get syntax highlighting for the file.



There is also an option to map files without extensions to a specific editor.



Happy Programming! =)
Posted by Nils-Holger at 1:10 PM with 445 comments.

Saturday, January 18, 2014

Tip 2.19: You can remove unused using statements

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In C#, there's the option to remove any of your unused using statements. This option is especially helpful if you're reusing some sort of template over and over again. Instead of having to comment out each line, compile, see whether the compile was successful, and then either remove or uncomment the line, you can bring up the editor context menu (just right-click in the editor) and choose Organize Usings–Remove Unused Usings. This will do all the hard work for you.



Happy Programming! =)
Posted by Nils-Holger at 2:35 PM with 433 comments.

Friday, January 17, 2014

Tip 2.20: What does Visual Studio do to autorecover files in the case of an unexpected shutdown?

Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



People on the testing team used to tease the tester who owned the AutoRecover feature that every time there was a power failure in the building (because of a storm or other such event), he was standing near some big red switch in the off position with a grin on his face so that everyone in the building could test his features for him.


Under Tools–Options–Environment, you'll find the AutoRecover page.



Note that you can opt out of the AutoRecover feature by unchecking the Save AutoRecover Information Every check box. The rest of the page is self-explanatory, but did you know where Visual Studio saves these autorecovered files? They are saved in \My Documents\Visual Studio \Backup Files\.



In case you (hopefully) have never seen the AutoRecover dialog box, here's what it looks like. It'll pop up the next time you launch Visual Studio after an unexpected shutdown. You have the options to either use the backup files or ignore them.



Happy Programming! =)
Posted by Nils-Holger at 1:19 PM with 2800 comments.

Thursday, January 16, 2014

Tip 2.18: How to change the Brace Matching color

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can change the Brace Matching color. Go to Tools–Options–Environment–Fonts And Colors, select Brace Matching (Rectangle), and set this option to the desired color.



And now your curly braces show up with a new highlight color.



Sara Aside

She likes the bright green color. It must be Seattle's nine months of gray weather getting to her.


Happy Programming! =)
Posted by Nils-Holger at 12:32 PM with 441 comments.

Wednesday, January 15, 2014

Tip 2.17: What does that Automatic Delimiter Highlighting option do?

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Honestly, she had to ask around to find out what this one did. She simply couldn't remember.




Whenever you have code construct pairs (that's what the documentation calls them), when you finish typing either the start or end pair, both pairs of words become bold. To turn off this feature, go to Tools–Options–Text Editor–General and uncheck Automatic Delimiter Highlighting.



You can customize the color for the bolding by going to Tools–Options–Environment–Fonts And Colors and selecting Brace Matching(Highlight).



And now the #if and #endif appear in bold and in red.

Happy Programming! =)
Posted by Nils-Holger at 1:20 PM with 440 comments.

Tuesday, January 14, 2014

Tip 2.16: How to open something in the binary editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The first time she saw this test case in the editor test bed, she thought, "Whoa, she had opened the Open File dialog box a thousand times and have never seen this option before."




To use the binary editor, follow these steps:
  1. Go to File–Open File.
  2. Click the drop-down arrow on the Open button or, from the keyboard, just press the down arrow.
  3. Choose Binary Editor and click OK or Open, depending on your Visual Studio version.




Happy Programming! =)
Posted by Nils-Holger at 1:53 PM with 443 comments.

Monday, January 13, 2014

Tip 2.15: How to enable Emacs and Brief editor emulations

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In Visual Studio 2005, we introduced Emacs and Brief emulations into the editor.

Go to Tools–Options–Environment–Keyboard, and then drop down the Apply The Following Additional Keyboard Mapping Scheme list. Then choose either Brief or Emacs.



To return to the standard editor, just select (Default).

Happy Programming! =)
Posted by Nils-Holger at 1:18 PM with 437 comments.

Sunday, January 12, 2014

Tip 2.14: You can hide outlining (selection margin) without turning off outlining

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Go to Tools–Options–Text Editor–General, and uncheck Selection Margin. Although the left margin that indicates a code block is gone, outlining will still work.



Happy Programming! =)
Posted by Nils-Holger at 12:29 PM with 431 comments.

Saturday, January 11, 2014

Tip 2.13: You can cut and paste a collapsed block of code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

You can cut and paste a collapsed block of code, keeping all of the code inside intact. Of course, this is exactly what you would expect, but she never thought about trying it.




With a block of code collapsed, as indicated to the right of the code lines shown in the preceding illustration, select the block and cut or just cut the line via your favorite mechanism for cutting a line. Now navigate to the desired location and paste.



Note the code will be automatically expanded upon pasting. The idea behind this tip is that you want to quickly cut and paste an entire function, but the function is quite long. You can use the approach shown in the previous tip (specifically, Ctrl+M, Ctrl+M to toggle between expanding and collapsing a block of code) to collapse the function to just the function name. Then press Ctrl+L to cut the current line. Now you can paste the function wherever you want.

Happy Programming! =)
Posted by Nils-Holger at 2:20 PM with 437 comments.

Friday, January 10, 2014

Tip 2.12: How to collapse and expand code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are five commands for outline toggling; they can be found on the Edit–Outlining menu. Toggle Outlining Expansion



By pressing Ctrl+M, Ctrl+M anywhere within the code block, you can toggle between collapsing a given block of code (as shown here)



and expanding it (as shown next)



Toggle All Outlining



By pressing Ctrl+M, Ctrl+L anywhere in the editor, you can toggle between collapsing and expanding the entire file. Completely collapsed:



Completely expanded:



Stop Outlining



By pressing Ctrl+M, Ctrl+P anywhere in the editor, you can turn off outlining.



Start Automatic Outlining



Unfortunately, start outlining and stop outlining are not the same command, so you can't toggle between one state and the other. Additionally, using the General Development Settings, start outlining is not bound to a keyboard shortcut. So you need to go to Edit–Outlining–Start Automatic Outlining to turn on outlining again. Collapse to Definitions



In her opinion, Collapse To Definitions is the most useful of all the outlining commands (mostly because it was the only one she used, except for when she had to test the others). This command allows you to quickly glance at all of your functions.



Happy Programming! =)
Posted by Nils-Holger at 1:18 PM with 434 comments.

Thursday, January 9, 2014

Tip 2.11: What's the difference between smart indenting and block indenting?

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog





Smart indenting is the option you want, provided you want the cursor to be properly indented whenever you press Enter or the up and down arrows in the code. An example is when you create a new method called Method1() and then hit Enter. You'll notice the cursor automatically indents itself. If you continue to hit Enter, the cursor will remain indented. Not all languages support this smart indenting, but if the language you're using does, this should be the default setting for that language.

Block indenting is similar to a document editor. Using Visual Basic as an example, the difference here is when you type in Method1() and hit Enter, only that first new line is automatically indented. The next new line places the cursor at column 0. Selecting None will not indent any new lines. You will have to indent everything manually.

Happy Programming! =)
Posted by Nils-Holger at 1:55 PM with 438 comments.

Wednesday, January 8, 2014

Tip 2.10: You can increase and decrease the line indent from the text editor toolbar

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Not one of her best "Tip of the Day" titles, but it illustrates the point. =)




With either a single line or several lines selected, you can use either the Increase Indent or Decrease Indent command found on either the text editor toolbar or the Edit–Advanced menu (where it is listed as Increase/Decrease Line Indent).

Happy Programming! =)
Posted by Nils-Holger at 1:26 PM with 644 comments.

Tuesday, January 7, 2014

Tip 2.9: How to convert spaces to tabs and tabs to spaces

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are four commands that involve converting spaces to tabs and tabs to spaces. The first two commands are found on the Edit–Advanced menu:
  • Tabify Selected Lines Replaces the leading white space on a line that contains the selection with tabs.
  • Untabify Selected Lines Replaces the leading white space on a line that contains the selection with spaces.




Note

The Edit–Advanced–(Un)Tabify Selected Lines isn't supported for Microsoft Visual Basic.
The last two commands are not found on the Edit menu but are available for you to either bind to a keyboard shortcut or manually add to the Edit menu or Text Editor toolbar:
  • Edit.ConvertTabsToSpaces Converts selected white space to spaces.
  • Edit.ConvertSpacesToTabs Converts selected white space to tabs.




Note that you may have to uncheck Tools–Options–Text Editor–Basic–VB Specific–Pretty Listing (Reformatting) of Code to use Edit.ConvertTabsToSpaces and Edit.ConvertSpacesToTabs.

Happy Programming! =)
Posted by Nils-Holger at 1:43 PM with 685 comments.

Monday, January 6, 2014

Tip 2.8: How to keep tabs or to insert spaces

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside



This tip and Tip 2.9 were her least favorite features to test. It drove her crazy trying to keep track of when a tab should get inserted, when the cursor should move to the correct formatted position, and so on and so forth. Now she uses only spaces in her code. =)
Go to Tools–Options–Text Editor––Tabs to switch between using tabs and inserting spaces.



Note that you can set this for all languages on the Text Editor–All Languages page, but usually this is something you want to set for each individual language.

Happy Programming! =)
Posted by Nils-Holger at 1:14 PM with 667 comments.

Sunday, January 5, 2014

Tip 2.7: How to format the document, the selected text, or just the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ever been typing in the editor and, for whatever reason, the text isn't indented properly on the line? Instead of manually pressing Backspace or Tab for each line of text, just press Ctrl+K, Ctrl+D, which performs the Format Document command. For larger files, you might just want to select the region that isn't justified correctly and use Ctrl+K, Ctrl+F. This keyboard shortcut formats the current line if you have nothing selected. These commands are found under the Edit–Advanced menu.



Happy Programming! =)
Posted by Nils-Holger at 12:50 PM with 446 comments.

Saturday, January 4, 2014

Tip 2.6: You can display guidelines in the editor to help format your code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The most popular tip on her blog is the one about guidelines. She thinks it is so popular because it was one of her very first tips about Microsoft Visual Studio many, many years ago. She's had a lot of people thank her for including that tip in her blog, but when a random developer stopped her in the hallway to thank her because he wrote the feature, that took hallway conversations to a new level. He had moved to another area of Visual Studio many years before my writing the tip, so he was very excited to see his feature get some public attention. She think one of the hardest things for any developer is to spend time coding a feature that never gets into the hands of a customer.

Important

To enable guidelines, you need to modify your registry settings. Please be aware that you use guidelines at your own risk and should do so only if you are comfortable modifying your registry settings. You will need to restart Visual Studio after modifying the registry for the changes to take effect.


Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Editor. Create a String (RG_SZ) key called Guides. The value is in the format of RGB(x,y,z) n1,...,n13, where x,y,z are the RGB values and n is the column number. You can have at most 13 guidelines. For example, RGB(255,0,0) 5,20 will put two red guidelines at column positions 5 and 20, as illustrated here:



Happy Programming! =)
Posted by Nils-Holger at 4:00 PM with 434 comments.

Friday, January 3, 2014

Tip 2.5: How to quickly comment and uncomment code using keyboard shortcuts

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ah, it really is the simple things in life, isn't it?

Use Ctrl+K, Ctrl+C to comment code and Ctrl+K, Ctrl+U to uncomment code. All the default development settings have these commands bound to these keyboard shortcuts.

You can find these commands under the Edit–Advanced menu as shown here:



Happy Programming! =)
Posted by Nils-Holger at 1:46 PM with 654 comments.

Thursday, January 2, 2014

Tip 2.4: How to swap the current anchor position in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ctrl+K, Ctrl+A will swap the current anchor position.

Sara Aside

To test Emacs emulations, she decided to write all her test cases in Emacs mode. (Emacs is a text editor, similar to Visual Studio. For details, see the Wikipedia article http://en.wikipedia.org/wiki/Emacs.) What was interesting is that she seemed to swap the anchor position all the time (using the appropriate shortcuts in Emacs mode); yet whenever she wasn't in Emacs mode, she never did this. She thinks it was just the way she was trained in college to think about the Emacs editing experience that made her want to swap the anchor position.
Cursor position before swap:



Cursor position after swap:



Happy Programming! =)
Posted by Nils-Holger at 2:14 PM with 438 comments.

Wednesday, January 1, 2014

Tip 2.3: You can use Ctrl+= to select code from the current cursor location to the last go-back marker

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



See Tip 1.16 for more information about go-back markers. The keyboard shortcut used to select code from the current cursor location to the last go-back marker is Ctrl+=, and the command is Edit.SelectToLastGoBack.

Ctrl+= to select all text from current cursor location to last go-back marker

In the previous graphic, Sara started the cursor after the first opening curly brace and the clicked the mouse about 15 lines down to drop a go-back marker. Then she pressed Ctrl+= to select all the text back to the last go-back marker.

Happy Programming! =)
Posted by Nils-Holger at 1:54 PM with 2600 comments.

Tuesday, December 31, 2013

Tip 2.2: How to jump to the beginning of some selected text when hitting escape

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



She hopes this tip's title makes sense. The idea is that you select some text and then hit Escape. Now where do you want the cursor to go?



If you want it to stay where it is, that's the default behavior. But if you want it to jump to the beginning of the selection (that is, the selection anchor), go to Tools–Options–Text Editor–General and check Go To Selection Anchor After Escape.

Happy Programming! =)
Posted by Nils-Holger at 9:40 AM with 542 comments.

Monday, December 30, 2013

Tip 2.1: How to use box/column selection in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The editor offers two different selection models: stream and box. There's also line selection, but that's only in Brief emulations. (See Tip 2.15 for more information on editor emulations.) Stream selection, using Shift+Arrow key, is what everyone is familiar with. But box selection allows you to manually select columns and lines at the same time.



Just hold down Shift+Alt+Arrow key and you'll quickly get the feel for box selection. You can also use box selection using the mouse by holding down the Alt key while you select text. Cut, Copy, Paste still works, but just keep track of where you started to select the text. Ah, the memories of having to test all this functionality.

Happy Programming! =)
Posted by Nils-Holger at 1:39 PM with 2013 comments.

Sunday, May 12, 2013

Tip 2.21: How to get syntax highlighting for a given file extension

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



On the Tools–Options–Text Editor–File Extension page, you can map a file extension to one of the included editors.



And after mapping the .Nils extension to a C# editor, we now get syntax highlighting for the file.



There is also an option to map files without extensions to a specific editor.



Happy Programming! =)
Posted by Nils-Holger at 2:14 PM with 441 comments.

Saturday, May 11, 2013

Tip 2.20: What does Visual Studio do to autorecover files in the case of an unexpected shutdown?

Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



People on the testing team used to tease the tester who owned the AutoRecover feature that every time there was a power failure in the building (because of a storm or other such event), he was standing near some big red switch in the off position with a grin on his face so that everyone in the building could test his features for him.


Under Tools–Options–Environment, you'll find the AutoRecover page.



Note that you can opt out of the AutoRecover feature by unchecking the Save AutoRecover Information Every check box. The rest of the page is self-explanatory, but did you know where Visual Studio saves these autorecovered files? They are saved in \My Documents\Visual Studio \Backup Files\.



In case you (hopefully) have never seen the AutoRecover dialog box, here's what it looks like. It'll pop up the next time you launch Visual Studio after an unexpected shutdown. You have the options to either use the backup files or ignore them.



Happy Programming! =)
Posted by Nils-Holger at 1:13 PM with 473 comments.

Friday, May 10, 2013

Tip 2.19: You can remove unused using statements

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In C#, there's the option to remove any of your unused using statements. This option is especially helpful if you're reusing some sort of template over and over again. Instead of having to comment out each line, compile, see whether the compile was successful, and then either remove or uncomment the line, you can bring up the editor context menu (just right-click in the editor) and choose Organize Usings–Remove Unused Usings. This will do all the hard work for you.



Happy Programming! =)
Posted by Nils-Holger at 1:13 PM with 445 comments.

Thursday, May 9, 2013

Tip 2.18: How to change the Brace Matching color

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can change the Brace Matching color. Go to Tools–Options–Environment–Fonts And Colors, select Brace Matching (Rectangle), and set this option to the desired color.



And now your curly braces show up with a new highlight color.



Sara Aside

She likes the bright green color. It must be Seattle's nine months of gray weather getting to her.


Happy Programming! =)
Posted by Nils-Holger at 1:33 PM with 443 comments.

Wednesday, May 8, 2013

Tip 2.17: What does that Automatic Delimiter Highlighting option do?

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Honestly, she had to ask around to find out what this one did. She simply couldn't remember.




Whenever you have code construct pairs (that's what the documentation calls them), when you finish typing either the start or end pair, both pairs of words become bold. To turn off this feature, go to Tools–Options–Text Editor–General and uncheck Automatic Delimiter Highlighting.



You can customize the color for the bolding by going to Tools–Options–Environment–Fonts And Colors and selecting Brace Matching(Highlight).



And now the #if and #endif appear in bold and in red.

Happy Programming! =)
Posted by Nils-Holger at 1:18 PM with 650 comments.

Tuesday, May 7, 2013

Tip 2.16: How to open something in the binary editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of  'Sara Ford'

Sara Ford's Blog



Sara Aside

The first time she saw this test case in the editor test bed, she thought, "Whoa, she had opened the Open File dialog box a thousand times and have never seen this option before."




To use the binary editor, follow these steps:
  1. Go to File–Open File.
  2. Click the drop-down arrow on the Open button or, from the keyboard, just press the down arrow.
  3. Choose Binary Editor and click OK or Open, depending on your Visual Studio version.




Happy Programming! =)
Posted by Nils-Holger at 1:11 PM with 438 comments.

Monday, May 6, 2013

Tip 2.15: How to enable Emacs and Brief editor emulations

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In Visual Studio 2005, we introduced Emacs and Brief emulations into the editor.

Go to Tools–Options–Environment–Keyboard, and then drop down the Apply The Following Additional Keyboard Mapping Scheme list. Then choose either Brief or Emacs.



To return to the standard editor, just select (Default).

Happy Programming! =)
Posted by Nils-Holger at 1:11 PM with 677 comments.

Sunday, May 5, 2013

Tip 2.14: You can hide outlining (selection margin) without turning off outlining

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Go to Tools–Options–Text Editor–General, and uncheck Selection Margin. Although the left margin that indicates a code block is gone, outlining will still work.



Happy Programming! =)
Posted by Nils-Holger at 11:47 AM with 444 comments.

Saturday, May 4, 2013

Tip 2.13: You can cut and paste a collapsed block of code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

You can cut and paste a collapsed block of code, keeping all of the code inside intact. Of course, this is exactly what you would expect, but she never thought about trying it.




With a block of code collapsed, as indicated to the right of the code lines shown in the preceding illustration, select the block and cut or just cut the line via your favorite mechanism for cutting a line. Now navigate to the desired location and paste.



Note the code will be automatically expanded upon pasting. The idea behind this tip is that you want to quickly cut and paste an entire function, but the function is quite long. You can use the approach shown in the previous tip (specifically, Ctrl+M, Ctrl+M to toggle between expanding and collapsing a block of code) to collapse the function to just the function name. Then press Ctrl+L to cut the current line. Now you can paste the function wherever you want.

Happy Programming! =)
Posted by Nils-Holger at 1:40 PM with 752 comments.

Friday, May 3, 2013

Tip 2.12: How to collapse and expand code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of  'Sara Ford'

Sara Ford's Blog



There are five commands for outline toggling; they can be found on the Edit–Outlining menu. Toggle Outlining Expansion



By pressing Ctrl+M, Ctrl+M anywhere within the code block, you can toggle between collapsing a given block of code (as shown here)



and expanding it (as shown next)



Toggle All Outlining



By pressing Ctrl+M, Ctrl+L anywhere in the editor, you can toggle between collapsing and expanding the entire file. Completely collapsed:



Completely expanded:



Stop Outlining



By pressing Ctrl+M, Ctrl+P anywhere in the editor, you can turn off outlining.



Start Automatic Outlining



Unfortunately, start outlining and stop outlining are not the same command, so you can't toggle between one state and the other. Additionally, using the General Development Settings, start outlining is not bound to a keyboard shortcut. So you need to go to Edit–Outlining–Start Automatic Outlining to turn on outlining again. Collapse to Definitions



In her opinion, Collapse To Definitions is the most useful of all the outlining commands (mostly because it was the only one she used, except for when she had to test the others). This command allows you to quickly glance at all of your functions.



Happy Programming! =)
Posted by Nils-Holger at 1:09 PM with 3 comments.

Thursday, May 2, 2013

Tip 2.11: What's the difference between smart indenting and block indenting?

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog





Smart indenting is the option you want, provided you want the cursor to be properly indented whenever you press Enter or the up and down arrows in the code. An example is when you create a new method called Method1() and then hit Enter. You'll notice the cursor automatically indents itself. If you continue to hit Enter, the cursor will remain indented. Not all languages support this smart indenting, but if the language you're using does, this should be the default setting for that language. Block indenting is similar to a document editor. Using Visual Basic as an example, the difference here is when you type in Method1() and hit Enter, only that first new line is automatically indented. The next new line places the cursor at column 0. Selecting None will not indent any new lines. You will have to indent everything manually.

Happy Programming! =)
Posted by Nils-Holger at 12:54 PM with 439 comments.

Wednesday, May 1, 2013

Tip 2.10: You can increase and decrease the line indent from the text editor toolbar

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Not one of her best "Tip of the Day" titles, but it illustrates the point. =)




With either a single line or several lines selected, you can use either the Increase Indent or Decrease Indent command found on either the text editor toolbar or the Edit–Advanced menu (where it is listed as Increase/Decrease Line Indent).

Happy Programming! =)
Posted by Nils-Holger at 1:10 PM with 11 comments.

Tuesday, April 30, 2013

Tip 2.9: How to convert spaces to tabs and tabs to spaces

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are four commands that involve converting spaces to tabs and tabs to spaces. The first two commands are found on the Edit–Advanced menu:
  • Tabify Selected Lines Replaces the leading white space on a line that contains the selection with tabs.
  • Untabify Selected Lines Replaces the leading white space on a line that contains the selection with spaces.




Note

The Edit–Advanced–(Un)Tabify Selected Lines isn't supported for Microsoft Visual Basic.
The last two commands are not found on the Edit menu but are available for you to either bind to a keyboard shortcut or manually add to the Edit menu or Text Editor toolbar:
  • Edit.ConvertTabsToSpaces Converts selected white space to spaces.
  • Edit.ConvertSpacesToTabs Converts selected white space to tabs.




Note that you may have to uncheck Tools–Options–Text Editor–Basic–VB Specific–Pretty Listing (Reformatting) of Code to use Edit.ConvertTabsToSpaces and Edit.ConvertSpacesToTabs.

Happy Programming! =)
Posted by Nils-Holger at 11:48 AM with 1656 comments.

Monday, April 29, 2013

Tip 2.8: How to keep tabs or to insert spaces

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This tip and Tip 2.9 were her least favorite features to test. It drove her crazy trying to keep track of when a tab should get inserted, when the cursor should move to the correct formatted position, and so on and so forth. Now she uses only spaces in her code. =)
Go to Tools–Options–Text Editor––Tabs to switch between using tabs and inserting spaces.



Note that you can set this for all languages on the Text Editor–All Languages page, but usually this is something you want to set for each individual language.

Happy Programming! =)
Posted by Nils-Holger at 1:14 PM with 533 comments.

Sunday, April 28, 2013

Tip 2.7: How to format the document, the selected text, or just the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ever been typing in the editor and, for whatever reason, the text isn't indented properly on the line? Instead of manually pressing Backspace or Tab for each line of text, just press Ctrl+K, Ctrl+D, which performs the Format Document command. For larger files, you might just want to select the region that isn't justified correctly and use Ctrl+K, Ctrl+F. This keyboard shortcut formats the current line if you have nothing selected. These commands are found under the Edit–Advanced menu.



Happy Programming! =)
Posted by Nils-Holger at 12:53 PM with 509 comments.

Saturday, April 27, 2013

Tip 2.6: You can display guidelines in the editor to help format your code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The most popular tip on her blog is the one about guidelines. She thinks it is so popular because it was one of her very first tips about Microsoft Visual Studio many, many years ago. She's had a lot of people thank her for including that tip in her blog, but when a random developer stopped her in the hallway to thank her because he wrote the feature, that took hallway conversations to a new level. He had moved to another area of Visual Studio many years before my writing the tip, so he was very excited to see his feature get some public attention. She think one of the hardest things for any developer is to spend time coding a feature that never gets into the hands of a customer.

Important

To enable guidelines, you need to modify your registry settings. Please be aware that you use guidelines at your own risk and should do so only if you are comfortable modifying your registry settings. You will need to restart Visual Studio after modifying the registry for the changes to take effect.
Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Editor. Create a String (RG_SZ) key called Guides. The value is in the format of RGB(x,y,z) n1,...,n13, where x,y,z are the RGB values and n is the column number. You can have at most 13 guidelines. For example, RGB(255,0,0) 5,20 will put two red guidelines at column positions 5 and 20, as illustrated here:



Happy Programming! =)
Posted by Nils-Holger at 2:03 PM with 433 comments.

Friday, April 26, 2013

Tip 2.5: How to quickly comment and uncomment code using keyboard shortcuts

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ah, it really is the simple things in life, isn't it? Use Ctrl+K, Ctrl+C to comment code and Ctrl+K, Ctrl+U to uncomment code. All the default development settings have these commands bound to these keyboard shortcuts. You can find these commands under the Edit–Advanced menu as shown here:



Happy Programming! =)
Posted by Nils-Holger at 12:04 PM with 595 comments.

Thursday, April 25, 2013

Tip 2.4: How to swap the current anchor position in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ctrl+K, Ctrl+A will swap the current anchor position.

Sara Aside

To test Emacs emulations, she decided to write all her test cases in Emacs mode. (Emacs is a text editor, similar to Visual Studio. For details, see the Wikipedia article http://en.wikipedia.org/wiki/Emacs.) What was interesting is that she seemed to swap the anchor position all the time (using the appropriate shortcuts in Emacs mode); yet whenever she wasn't in Emacs mode, she never did this. She thinks it was just the way she was trained in college to think about the Emacs editing experience that made her want to swap the anchor position.
Cursor position before swap:



Cursor position after swap:



Happy Programming! =)
Posted by Nils-Holger at 1:09 PM with 1441 comments.

Wednesday, April 24, 2013

Tip 2.3: You can use Ctrl+= to select code from the current cursor location to the last go-back marker

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



See Tip 1.16 for more information about go-back markers. The keyboard shortcut used to select code from the current cursor location to the last go-back marker is Ctrl+=, and the command is Edit.SelectToLastGoBack.

Ctrl+= to select all text from current cursor location to last go-back marker

In the previous graphic, Sara started the cursor after the first opening curly brace and the clicked the mouse about 15 lines down to drop a go-back marker. Then she pressed Ctrl+= to select all the text back to the last go-back marker.

Happy Programming! =)
Posted by Nils-Holger at 1:15 PM with 480 comments.

Tuesday, April 23, 2013

Tip 2.2: How to jump to the beginning of some selected text when hitting escape

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



She hopes this tip's title makes sense. The idea is that you select some text and then hit Escape. Now where do you want the cursor to go?



If you want it to stay where it is, that's the default behavior. But if you want it to jump to the beginning of the selection (that is, the selection anchor), go to Tools–Options–Text Editor–General and check Go To Selection Anchor After Escape.

Happy Programming! =)
Posted by Nils-Holger at 3:28 PM with 444 comments.

Monday, April 22, 2013

Tip 2.1: How to use box/column selection in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The editor offers two different selection models: stream and box. There's also line selection, but that's only in Brief emulations. (See Tip 2.15 for more information on editor emulations.) Stream selection, using Shift+Arrow key, is what everyone is familiar with. But box selection allows you to manually select columns and lines at the same time.



Just hold down Shift+Alt+Arrow key and you'll quickly get the feel for box selection. You can also use box selection using the mouse by holding down the Alt key while you select text. Cut, Copy, Paste still works, but just keep track of where you started to select the text. Ah, the memories of having to test all this functionality.

Happy Programming! =)
Posted by Nils-Holger at 12:09 PM with 433 comments.