From 1fc63a7e225a3bf1a19b9b1256a88590b4a432e4 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 23 Jan 2022 21:34:13 -0500 Subject: [PATCH] Update readme --- README.adoc | 54 +++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/README.adoc b/README.adoc index 2d74f83..c9f2741 100644 --- a/README.adoc +++ b/README.adoc @@ -1,10 +1,37 @@ = rust-selection-sort.kak +Sort selections by regular expression or lexicographically + +== Example + +. Imagine you want to sort these stages ++ +[source,groovy] +---- +stage('Package (#3)') { + // ... +} + +stage('Build (#2)') { + // ... +} + +stage('Initialize (#1)') { + // ... +} + +stage('Publish (#4)') {} +---- + +. Select the stage and stage body with: `%sstageMLM` +. Sort the selection by step number with: `:sort-selections #\d+` (sort on whole capture) or `:sort-selections "'.+?#(\d).+?'"` (sort on first capture group, which contains only the digits) +. Note if you just run `:sort-selections` + == Configuration [source,sh,title='sh'] ---- -cargo install https://github.com/austenadler/rust-selection-sort.kak +cargo install --git https://github.com/austenadler/rust-selection-sort.kak ---- [source,title='kakrc'] @@ -35,31 +62,6 @@ define-command sort-selections -params 0.. %{ ** If the regex does not contain a capture group ** If the regex contains at least one capture group -== Example - -. Imagine you want to sort these stages -+ -[source,groovy] ----- -stage('Package (#3)') { - // ... -} - -stage('Build (#2)') { - // ... -} - -stage('Initialize (#1)') { - // ... -} - -stage('Publish (#4)') {} ----- - -. Select the stage and stage body with: `%sstageMLM` -. Sort the selection by step number with: `:sort-selections #\d+` (sort on whole capture) or `:sort-selections "'.+?#(\d).+?'"` (sort on first capture group, which contains only the digits) -. Note if you just run `:sort-selections` - == TODO * I don't know what will happen with multiline strings