Hello!
Is there the way to apply "greedy" behavior to and keys in Visual Studio? By "greedy" I mean such behavior when all whitespace between cursor position and next word bound can be deleted using one keystroke.
Hello!
Is there the way to apply "greedy" behavior to and keys in Visual Studio? By "greedy" I mean such behavior when all whitespace between cursor position and next word bound can be deleted using one keystroke.
You can use Ctrl+Shift+Arrow keys to make the selection and then just hit Delete. You may need to hit the arrow key more than once while still pressing Ctrl+Shift combination but because the fingers are in the same position is very fast. This works also for selecting words incrementally.
Well, I don't think you can change the binding of the delete key or backspace key - but CTRL+DEL & CTRL+Backspace are pretty close to what you want.
Sounds like something you could write a macro for and then assign to a keyboard shortcut (like SHIFT+DEL).
If you explore the EnvDTE namespaces you can do a lot to make changes to text in the active document window. I'd start by checking with something like...
Public Sub RemoveWhiteSpace()
DTE.ActiveDocument.Selection.WordRight(True)
DTE.ActiveDocument.Selection.Text = " "
End Sub
That's just a simple example, but you can extend it further pretty easily
Actually, you will need to do this: Ctrl+Shift+Left+Right - this will give you only the space selected, and then you can press delete.
This is assuming that you are coming from the right, and you have to delete the space to the left.
Of course, this is still 5 keystrokes... but it beats pressing backspace again and again....
Ctrl+Back Space and Ctrl+Delete are also greedy, they delete the nearest word in their respective direction.
OK I've got this < Ctrl > thing. And applying this knowledge I've found corresponding VS commands: Edit.WordDeleteToStart and Edit.WordDeleteToEnd.
I've successfully remapped < Delete > and < Backspace > keys using Options->Environment->Keyboard dialog. Unfortunately this commands apply not only to whitespace as I'd wish to, but still, thanks everyone!