Update readme
This commit is contained in:
parent
b127ffe59d
commit
923e72dc98
54
README.adoc
54
README.adoc
@ -2,17 +2,67 @@
|
|||||||
|
|
||||||
== Configuration
|
== Configuration
|
||||||
|
|
||||||
|
[source,sh,title='sh']
|
||||||
|
----
|
||||||
|
cargo install https://github.com/austenadler/rust-selection-sort.kak
|
||||||
|
----
|
||||||
|
|
||||||
[source,title='kakrc']
|
[source,title='kakrc']
|
||||||
----
|
----
|
||||||
define-command s -params 0..1 %{
|
define-command sort-selections -params 0.. %{
|
||||||
eval -save-regs '"' %{
|
eval -save-regs '"' %{
|
||||||
reg dquote %val{selections}
|
reg dquote %val{selections}
|
||||||
eval %sh{
|
eval %sh{
|
||||||
regex="${1:-.*}"
|
regex="${1:-.*}"
|
||||||
|
|
||||||
|
# TODO: Use a comand fifo to read/write selections
|
||||||
eval set -- "$kak_quoted_selections"
|
eval set -- "$kak_quoted_selections"
|
||||||
~/syncthing/code/rust-selection-sort.kak/target/debug/rust-selection-sort "$regex" "$@" > "$kak_command_fifo"
|
|
||||||
|
# TODO: Send additional parameters
|
||||||
|
|
||||||
|
rust-selection-sort -r "$regex" $args -- "$@" > "$kak_command_fifo"
|
||||||
}
|
}
|
||||||
exec R
|
exec R
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
|
== Usage
|
||||||
|
|
||||||
|
* Make multiple selections
|
||||||
|
* Run `sort-selections` to sort the selections lexicographically (TODO: implement a `sort -h` like feature)
|
||||||
|
* Run `sort-selections REGEX` to sort by regex match
|
||||||
|
** 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: `%sstage<ret>MLM`
|
||||||
|
. Sort the selection by step number with: `:sort-selections #\d+<ret>` (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<ret>`
|
||||||
|
|
||||||
|
== TODO
|
||||||
|
|
||||||
|
* I don't know what will happen with multiline strings
|
||||||
|
* Use 2 fifos for getting and sending selections since this should be faster than sending this to shell
|
||||||
|
* Send options (`-S`) to cli from kak
|
||||||
|
* Figure out how to change the `no_skip_whitespace` option name in the source
|
||||||
|
Loading…
Reference in New Issue
Block a user