Did you know… how not to accidentally copy a blank line? – #050

There’s something about me that keeps hitting Ctrl+C instead of Ctrl+V whenever i’m on a blank line.  I just don’t understand it.  So, what happens is I copy a blank line, erasing the text i was trying to paste right there.  And to my dismay, i hit Ctrl+V and nothing happens.

The option that saved my sanity is found in Tools – Options – Text Editor – All Languages – General.  There’s a checkbox Apply Cut or Copy commands to blank lines when there is no selection.  Unchecking this allowed me to hit Ctrl+C all i want on a blank line without losing the content on my clipboard. 

Option to turn off copying / cutting blank lines

Technorati tags: VS2005Tip, VS2008Tip

Did you know… How to use the Undo stack on the standard toolbar? – #048

You’ll find the Undo and Redo stacks on the standard toolbar.  Just make sure the cursor is in a text editor to enable these toolbars.

Undo command stack on standard toolbar

Instead of having to press Ctrl-Z or Ctrl-Y multiple times to undo multiple commands, you can drop down the Undo or Redo toolbar and select consecutively starting from the top all the actions you wish to undo or redo.

Technorati tags: VS2005Tip, VS2008Tip

Did you know… how to swap the current anchor position in the editor? – #047

Ctrl+K, Ctrl+A will swap the current anchor position.  For whatever reason, when i tested our Emacs Emulations, i used this functionality all the time whenever I wrote test case code.  But i never use it in the default editor settings.  It isn’t the keybinding that i have to press.  I think it is just the way the overall experience flows when in emacs.

cursor position before swap:

cursor position before swapping anchor

cursor position after swap:

cursor position after swapping anchor

Technorati tags: VS2005Tip, VS2008Tip

Did you know… Ctrl+L cuts the current line and Ctrl+Shift+L deletes the current line – #046

Ctrl+L, bound to Edit.LineCut, will cut the current line, including EOL.

Ctrl+Shift+L, bound to Edit.LineDelete, will delete the current line, including EOL.

and for our bonus keyboard shortcut of the day… Shift+Delete will cut the current line, including EOL, if nothing is selected on the current line.  If text is selected, Shift+Delete will cut just that text.

a sailboat with some seagulls

Again, as with yesterday’s tip, I have no idea what picture to use to represent this behavior, so I drew some seagulls flying over the ocean on a warm summer day (unlike seattle) with a sailboat (a flying scot, the boats I used to race back home, nonetheless) in the background.

Technorati tags: VS2005Tip, VS2008Tip

Did you know… How to up to the top and bottom of the current view in the editor without scrolling? – #045

Ctrl+PageUp will jump the cursor to the top of the current editor view without moving the current view.  (if you were to just press PageUp, the current editor view would jump up an entire page).

Cursor on the top view of the editor

Ctrl+PageDown will jump the cursor to the bottom of the current editor view.

Cursor on the bottom view of the editor

Additionally, if you use these keyboard shortcuts, you may find these shortcuts helpful:

Ctrl+Shift+PageUp will select all the text between the current cursor location and the top of the current editor view. 

Text selected from current cursor position to top of buffer

Ctrl+Shift+PageDown will select all the text between the current cursor location and the bottom of the current editor view.

text selected from current cursor position to bottom of buffer

The one thing to note is that all four commands will jump the cursor straight up, meaning that it doesn’t to go the Beginning of Line on that top line, but rather as close as possible to the current column position, as illustrated in the above 2 photos.

Technorati tags: VS2005Tip, VS2008Tip

Did you know… Ctrl+Delete deletes the proceeding word and Ctrl+Backspace deletes the preceding word – #044

[a blog reader let me know that i had reversed preceding and proceeding. But the title is correct now  I was obviously way too focused on drawing a nice tree.]

I knew about Ctrl+Backspace, but Ctrl+Delete was a "oh yeah, i forgot about that" moment.

Ctrl+Delete is bound to Edit.WordDeleteToEnd

Ctrl+Backspace is bound to Edit.WordDeleteToStart

a tree (seriously)

I have no idea what sort of picture to include for this tip, so I drew a tree for everyone.

Technorati tags: VS2005Tip, VS2008Tip

Did you know… Ctrl+= selects code to the last go-back marker? – #043

After yesterday’s tip on how Navigate Forward, Navigate Backward, and go-back markers work, did you know you can select text up to the last go-back marker?  It is bound to Ctrl+= and the command name is Edit.SelectToLastGoBack (say that 5 times fast!)

Code selected from current cursor location to the last go-back marker

The above photo is taken from one of the VB 2008 samples, where I started the cursor at the beginning of a "with" block, and then clicked the mouse about 17 lines down to drop a go-back marker.  Then I pressed Ctrl+= to select all the text back to the last go-back marker.

Ctrl+= command in tools options keyboard dialog page

Technorati tags: VS2005Tip, VS2008Tip

POP QUIZ: Under what condition does the file tab channel drop down button change its icon? – #042

I’m hoping this pop quiz is a little more challenging.

Below is a picture of the right portion of the File Tab Channel.  I’ve circled the drop down button that drops down the list of open files.

file tab channel drop down control

Now, under what condition does the icon change to having a bar over the top as shown in the below image?

file tab channel drop down control with a line over it

My adopted MVP Peter Ritchie says leaving answers as comments is fine with him, so it is fine with me =)

Technorati tags: VS2005Tip, VS2008Tip

Did you know… How to do a Ctrl+G without the Go to line dialog box popping up – #040

Pretty straight-forward, pressing Ctrl+G will pop up the Go to line dialog.

Go To Line Dialog

But, did you know there’s a way to do a "Ctrl+G" without bringing up this dialog box?

  1. Press Ctrl+D to go to the Ctrl+D window
  2. Type in the line number
  3. Press Ctrl+G (not enter; otherwise, you’ll search for the number!)

And now you’ve just navigated to the line without the dialog box coming up.

And just one more "did you know" about the Go to Line dialog…  you can double-click on the line, column, and character section of the status bar to pop up the dialog

Status bar Line, Column, Character

Argh, i can’t resist… final thing about the Go To Line dialog.  You can attempt to go to line 0, but we’ll take you to line 1.  =)

Technorati tags: VS2005Tip, VS2008Tip