# Convert multi-line selection into rectangular selection

**URL:** <https://forum.sublimetext.com/t/convert-multi-line-selection-into-rectangular-selection/41641>\
**Category:** General Discussion\
**Created:** [January 30, 2019, 2:34pm UTC](https://forum.sublimetext.com/t/convert-multi-line-selection-into-rectangular-selection/41641 "2019-01-30T14:34:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teggy](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/teggy/32/62242_2.png) [@Teggy](https://forum.sublimetext.com/u/Teggy)\
**Post date:** [January 30, 2019, 2:34pm UTC](https://forum.sublimetext.com/t/convert-multi-line-selection-into-rectangular-selection/41641/1 "2019-01-30T14:34:24Z")

</div>

Hi everyone,

I am looking for the Sublime Text command to convert a **multi-line selection** (see image on the left) into a **rectangular selection** (image on the right, in which short lines have been padded with spaces):

 ![](https://forum.sublimetext.com/uploads/default/original/3X/4/5/45cdd6fa87c11f7bdf25dee0c78c0c05f4bd4721.png)

Cheers,  
—Torsten

---

<div class="post-metadata">

**Author:** ![Teggy](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/teggy/32/62242_2.png) [@Teggy](https://forum.sublimetext.com/u/Teggy)\
**Post date:** [January 30, 2019, 8:11pm UTC](https://forum.sublimetext.com/t/convert-multi-line-selection-into-rectangular-selection/41641/2 "2019-01-30T20:11:22Z")

</div>

Sorry for following up on myself.

Here’s a macro (based on command `alignment` of package _Alignment_) that converts an arbitrary selection into a rectangular one:

```nohighlight
[
	{
		"command": "split_selection_into_lines"
	},
	{
		"command": "alignment"
	},
	{
		"args":
		{
			"extend": true,
			"to": "hardeol"
		},
		"command": "move_to"
	}
]

```
