= kakutils-rs Sort by regular expression or lexicographically, find uniqes, shuffle, or evaluate rust selections without spawning a new command for each. == 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: `:utils sort #\d+` (sort on whole capture) or `:utils sort "'.+?#(\d).+?'"` (sort on first capture group, which contains only the digits) . Note if you just run `:utils sort` == Configuration [source,sh,title='sh'] ---- cargo install --git https://github.com/austenadler/kakutils-rs ---- [source,title='kakrc'] ---- define-command utils -params 0.. %{ eval -save-regs '"' %{ reg dquote %val{selections} eval %sh{ regex="${1:-.*}" # use kak_command_fifo kak_response_fifo; ~/syncthing/code/kakutils-rs/target/debug/kakutils-rs sort "$regex" -- "$@" } exec R } } ---- == Usage * Make multiple selections * Run `utils sort` to sort the selections lexicographically * Run `utils sort REGEX` to sort by regex match ** If the regex does not contain a capture group ** If the regex contains at least one capture group == TODO * I don't know what will happen with multiline strings and regex * Figure out how to change the `no_skip_whitespace` option name in the source * Get sort by selections working