This plugin, suggested by @Guest0 and @Screwtapello , renders a summary of the current window’s multiple selections (ranges + contents) in a *selections*
buffer.
It can act as a toolsclient
, and live-update *selections*
based on the… selections. You can edit ranges (but not contents), then use sel-editor-buf2kak
to change the actual selections. E.g. you can delete ranges, modify them, or even enter ranges manually.
I’d like to implement selection-contents editing in the summary buffer, but I need to learn more…
Installation / usage
Instructions (brief) at the project page
Notes
I’ve managed to do this in pure kakscript, apparently transcending some language limitations
- looping: using
999q
(macro with count) with a macro calling: exec iter
. Alternatively, recursion-based looping also works, but hits a 100-level nesting limit (apparently, no tail-call optimization). - apply lambda to arguments:
def -override lambda-tmp %reg{a}; lambda-tmp args
- stopping loops: with exceptions
- processing lists / shifting arguments: use
str-list
options, andset global work %arg{@}; set -add global work %arg{1}
- checking if arguments exhausted / list empty:
def nop-0_0 -params 0..0 %{}
(call it on anystr-list
option, or on%arg{@}
; it throws unless there are zero elements in the list). Any such param-count check is possible, either with predefined or on-the-fly checkers.
I’ve been able to implement a foreach
, zip two lists, concatenate / prefix / suffix a list of strings, and it seems like a lot more is possible…