# vim: Sort whole buffer when no range is specified \(\#42376\) · gitcafe/zed

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

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

Visibility: public

Requested revision: dcf56144b5378c422070fadb5f9bd9cf99b01238

Requested commit: dcf56144b5378c422070fadb5f9bd9cf99b01238

Commit: dcf56144b5378c422070fadb5f9bd9cf99b01238

Tree: b9e2ed52baf18d6c7dd65a541548bbc6010c6668

Author: Dino

Committer: GitHub

## Message

```
vim: Sort whole buffer when no range is specified (#42376)

- Introduce a `default_range` field to `VimCommand`, to be optionally
  used when no range is specified for the command
- Update `VimCommand.parse` to take into consideration the
  `default_range`
- Introduce `CommandRange::buffer` to obtain the `CommandRange` which
  corresponds to the whole buffer
- Update the `VimCommand` definitions for both `sort` and `sort i` to
  default to the whole buffer when no range is specified

Closes #41750 

Release Notes:

- Improved vim's `:sort` command to sort the buffer's content when no
selection is used
```

## Parents

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

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