Someone from Microsoft had originally written some Visual Studio macros to address this. You could rebind TAB to just do a plain old tab insert. Of course the source code URL I found was no longer valid... So I contacted the engineer at Microsoft. He got back to me and told me that he no longer had the source, but that it shouldn't be too hard to write my own.
It took me about 15 or 20 minutes to get it correct. You have to use the Macros IDE to add a module under "MyMacros". I called mine "EditorMacros". You should unbind "Edit.InsertTab" and rebind it to the sub routine below ("Macros.MyMacros.EditorMacros.EmacsInsertTab.") It looks like this
That seems to work just fine. But every time I hit TAB, a pop-up balloon would flash from the task tray. After seeing that thing for 10 or so times, I lost my mind. It was so brief I couldn't even read what it said. What to do? Why not add a sleep function into my macro? Here's the snippet:
Public Module EditorMacros
'' Please insert a TAB!
Dim editPoint As EnvDTE.EditPoint
Dim selection As EnvDTE.TextSelection
Dim startPoint As EnvDTE.EditPoint
Dim currentPoint As EnvDTE.EditPoint
Dim endPoint As TextPoint
selection = DTE.ActiveDocument.Selection
If (selection.IsEmpty()) Then
editPoint = selection.ActivePoint.CreateEditPoint()
'' 0x09 is an ASCII horizontal tab
startPoint = selection.TopPoint.CreateEditPoint()
endPoint = selection.BottomPoint
currentPoint = startPoint
Do While (True)
Dim line As Integer
line = currentPoint.Line
If (line = endPoint.Line) Then
If Not (currentPoint.AtEndOfLine()) Then
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'' Somewhere in the body...
The pop-up said that a macro was running and that I could kill it from the pop-up. Thanks! That's so useful! My macro takes a fraction of a second, of course I'd like the opportunity to stop it. Anyway, it has the option to dismiss it forever.
I took the sleep out and went on my merry way.