views:

444

answers:

3

It's annoying in VS2008 when I press the END key, and my cursor jumps out to way beyond the end of the line of code, because I have trailing whitespace from a copy+paste or reformat.

I would like the END key to ignore whitespace. How can I best do this?

I thought of using AutoHotkey to catch END keypresses, and replace them with "CTRL+E, \, END" (That's "Delete Horizontal White Space", under Edit -> Advanced).

I'd like a less hacky solution if possible, though.

A: 

Well, here's my AutoHotkey script:

SetTitleMatchMode RegEx
#IfWinActive, .* - Microsoft Visual Studio
End::Send {End}^e\

Guess I'll use that until someone posts a better answer :)

Blorgbeard
updated for 2010, change the last line to: End::Send {End}^k^\
thepaulpage
A: 

Not quite what you want, but selecting the markup and doing "Format Selection" will remove the whitespace...

Paul Rowland
Doesn't seem to work for me.. I'm talking about C# code, not markup though..
Blorgbeard
+1  A: 

Not the answer you want on the 'ignore' front, but you can do a ctrl + delete should delete all the white space. If not contol + shift + left arrow to highligh then del will fix it.

The format selection ctrl + e, ctrl + f should remove trailing white space. As per Paul's comment

Simeon Pilgrim