From 7c907e66f429f82235c67332125910cde9c29216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Plagborg=20Bak=20S=C3=B8rensen?= <57013304+kpbaks@users.noreply.github.com> Date: Sun, 26 Jan 2025 17:39:19 +0100 Subject: [PATCH] feat: print helpful suggestion when using `:{,r}sort` incorrectly (#12585) --- helix-term/src/commands/typed.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 8a335674b..9c48bf723 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2116,6 +2116,10 @@ fn sort_impl( let selection = doc.selection(view.id); + if selection.len() == 1 { + bail!("Sorting requires multiple selections. Hint: split selection first"); + } + let mut fragments: Vec<_> = selection .slices(text) .map(|fragment| fragment.chunks().collect())