# editor: Add align selections action \(\#44769\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/c7870cb93d050840f5fb8ffba0e50f7786a4091c)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: c7870cb93d050840f5fb8ffba0e50f7786a4091c

Requested commit: c7870cb93d050840f5fb8ffba0e50f7786a4091c

Commit: c7870cb93d050840f5fb8ffba0e50f7786a4091c

Tree: d0ff3d3f46d6d58875b7e16cddbfe64ef0fad122

Author: Tiago Lobão

Committer: GitHub

## Message

```
editor: Add align selections action (#44769)

Closes #17090

Hello! This is a feature that I really wanted, so I've created an
implementation of it. Hope u guys like it.
It was alto mentioned at [this
discussion](https://github.com/zed-industries/zed/discussions/30473)

The use cases were based on the [vscode
extension](https://marketplace.visualstudio.com/items?itemName=yo1dog.cursor-align)
(only spaces case was implemented)
- The algorithm is O(n + m × 2k), where:
- n = total cursors (for initial analysis, to understand how many
alignments will be performed)
  - m = number of alignment columns  
- k = number of alignment rows (first time to get the most-right
occurrence, the next one to create the `Vec` of edits)


Release Notes:

- Added `editor: align selections` command


![ezgif-524b631d71833ba1](https://github.com/user-attachments/assets/28c3435a-2e01-496f-81c4-721ecfb5b22d)

<br>

Thank you for creating zed!

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

- [be3a5e2c061823c5fa4de56e4eec58e68319a0ac](https://git.cafe/gitcafe/zed/commit/be3a5e2c061823c5fa4de56e4eec58e68319a0ac?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/c7870cb93d050840f5fb8ffba0e50f7786a4091c?format=markdown)
