Search code examples
visual-studiovisual-studio-2010keyboard-shortcuts

does Visual Studio 2010 not have a "join lines" keyboard shortcut?


does Visual Studio 2010 not have a "join lines" keyboard shortcut?

EDIT - That is when on line X anywhere, I hit a shortcut key once, and then line X+1 joins to line X (eliminating CR between them so to speak)


Solution

  • As I far as I know it does not.

    However, you can create and save a new VS macro using the following code:

    Sub JoinLines()
        DTE.ActiveDocument.Selection.EndOfLine()
        DTE.ExecuteCommand("Edit.Delete")
        DTE.ActiveDocument.Selection.EndOfLine()
    End Sub
    

    and assign a keyboard shortcut to it (like CTRL + j)

    This code will join the current line with the one right below it.