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