Feature Request: Quick Move Line/Selection up/down

Like the code reordering feature (Ctrl-Shft-Alt Up/down) only simpler and quicker. This is available in eclipse (Alt Up/Down) and is extremely useful.

The code reordering feature is a little too smart for quick reordering. I'm never quite sure where my caret has to be to perform the move i want, and what the eventual move would be. A quick move which is not context sensitive is can be much quicker and more useful in many respects.

This is also useful in non code files, like text files, xml files etc.

Thanks,
Murtaza

4 comments
Comment actions Permalink

Murtaza Officewala wrote:

Like the code reordering feature (Ctrl-Shft-Alt Up/down) only simpler
and quicker. This is available in eclipse (Alt Up/Down) and is
extremely useful.

The code reordering feature is a little too smart for quick
reordering. I'm never quite sure where my caret has to be to perform
the move i want, and what the eventual move would be. A quick move
which is not context sensitive is can be much quicker and more useful
in many respects.

This is also useful in non code files, like text files, xml files etc.

Thanks,
Murtaza


+1 for that!

--
by Peter Sulek at 16. 7. 2008 8:13:30
XanaNews 1.18.1.6

0
Comment actions Permalink

I implemented my own macros for moving lines up and down. The current lines (or multiple if there is a selection) will be moved, and the selection (or cursor position) will be preserved.

 0 And selection.BottomPoint.AtStartOfLine) Then
            startEditPoint.LineUp()
        End If

        If (lines < 0) Then
            ' move the line above down to effectively move the selected lines up
            Swap(startEditPoint, oppositeSide)
        Else
            ' move the line below up to effectively move the selected lines down
        End If

        Dim endEditPoint As EditPoint2 = startEditPoint.CreateEditPoint
        endEditPoint.LineDown(lines)

        Dim lineText As String = startEditPoint.GetText(endEditPoint)
        startEditPoint.Delete(endEditPoint)

        ' Move to the correct position before or after the selection
        oppositeSide.Insert(lineText)

        DTE.UndoContext.Close()
    End Sub

    Private Sub Swap(ByRef a As Object, ByRef b As Object)
        Dim temp As Object
        temp = a
        a = b
        b = temp
    End Sub

End Module
]]>

0
Comment actions Permalink

Awesome!

Works like a charm..

Thanks alot

0
Comment actions Permalink

Add to that also making the current Up/Down for methods to be able to go up and down from regions/endregions delimiters. Its always awkward when I want to move something UP to move it inside a region, it will go as the second to last method instead (or skip the region completly if its empty)

0

Please sign in to leave a comment.