Reputation: 354
in VS2019 you can move a text line up and down by using [Alt + ↑] and [Alt + ↓] keys combination. Is there a way to move a selected text horizontally inside one text line(right to left and left to right)?
PS: MOVE is not CUT&PASTE and should be done easily using only the keyboard
Upvotes: 0
Views: 987
Reputation: 27910
You can create the following command with my Visual Commander extension to move selected text one char right (C# language):
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
EnvDTE.TextSelection ts = DTE.ActiveWindow.Selection as EnvDTE.TextSelection;
int selectionLength = ts.Text.Length;
DTE.ExecuteCommand("Edit.Cut");
DTE.ExecuteCommand("Edit.CharRight");
DTE.ExecuteCommand("Edit.Paste");
ts.CharLeft(true, selectionLength);
}
And then assign a keyboard shortcut to it.
Upvotes: 2
Reputation: 10936
If you have mouse dragging enabled (See Tools > Options > Text Editor > General > Drag and Drop text editing
), just click and drag the highlighted text to where you want it placed.
As for keyboard versions, Cut/Paste is the way to go. You can make it a little faster by using Ctrl+Left/Right
to navigate the caret to each punctuation instead of each character.
Upvotes: 1