Sel-editor: editable, live selection-summary buffer

I’ll be sure to test in a clean $HOME mock-up from now on… Anyway, the bugs are fixed (thanks @danr for alerting); the latest sel-editor.kak (see the REAMDE / homepage as well) can…

sel-editor-2021-09-16 23-34

Change selection contents

Edit the contents (between | .. |) of a selection, press <ret>w, confirm, and the text in the original buffer will be updated.

Easily select / unselect / remove blocks

There’s a custom user mode for *selections*, triggered by pressing <ret> — the user-mode menu lists all the mappings. E.g. add blocks with <ret>+, instead of combining them with <a-z>, Z as in normal mode, delete blocks with <ret>d etc. Some of them have normal-mode correspondents (>, <, =, <a-ret> = `).

Work on specific selections

Press <ret>= and only the selected blocks will be applied to the original buffer. Press > and all blocks in *selections* will be applied.

Undo

All changes that happen in *selections* go into the buffer’s undo history. You can go back in time. However, if the original buffer contents changes, the selections will have incompatible timestamps and some changes won’t be restore-able (via > or =).

Highlight

… as can be seen in the preview above

Auto-infer clients

You can just call :+=ssl [...] (or sel-editor-live-new [...]); this will call new and set up a live *selections*.

If you do have a toolsclient setup, sel-editor will respect it. If you just call sel-editor-live-enable, it will guess which client is the toolsclient.

Notes / TODO

I’ve been bitten by this customization, which pollutes register z. I’m going to include selection history (N-levels deep) in sel-editor. Whenever there’s a “significant” change in selections (i.e. excluding short, single selections), a NormalIdle hook (if enabled) will add an entry in history.

There’s a bug that prevents selection contents from being made empty. It doesn’t make sense, but I guess new users playing with it could easily trigger it. Just delete unneeded blocks with <ret>d.