Scott Nimrod
Scott Nimrod

Reputation: 11595

How do I shift a set of lines one space to the right within a text editor?

How do I shift a set of lines one space to the right within a text editor?

If I wanted to shift a set of lines several spaces to the right, I would perform:

selected text + Tab

However, I just want to shift the text one space to the right without tabbing.

Any suggestions?

Upvotes: 10

Views: 10359

Answers (1)

user1228
user1228

Reputation:

Hold down the alt key, left-click and hold the mouse button down on the first line where you wish to insert your space. Then, while still holding down the left mouse button, drag the mouse vertically to extend this edit point to all the lines you want to move. Dragging it horizontally will create a box selection, which you want to avoid, as the selected text will end up being replaced, rather than a space be added.

Also, you cannot select individual, disjoint lines to move. You can only use alt-drag over a contiguous block of lines.

Once you have your multiline edit point created, hit the spacebar once.

Tada.

Here's a blog post by Scott Guthrie with more details and a vidya demo

If you don't want to use the mouse, you can use shift+alt+(up, down, left, or right) to create a box selection, or a multiline edit point.

Upvotes: 16

Related Questions