# Sel-editor: editable, live selection-summary buffer

**URL:** <https://discuss.kakoune.com/t/sel-editor-editable-live-selection-summary-buffer/1877>\
**Category:** Plugins\
**Tags:** scripting, language\
**Created:** [September 13, 2021, 11:13am UTC](https://discuss.kakoune.com/t/sel-editor-editable-live-selection-summary-buffer/1877 "2021-09-13T11:13:43Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![almr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/almr/32/934_2.png) [@almr](https://discuss.kakoune.com/u/almr)\
**Post date:** [September 16, 2021, 9:08pm UTC](https://discuss.kakoune.com/t/sel-editor-editable-live-selection-summary-buffer/1877/4 "2021-09-16T21:08:39Z")

</div>

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](https://discuss.kakoune.com/uploads/default/original/1X/5aed37d4eeac8bfbb6d5608fd7cb2626c11d27c9.gif)

## 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](https://discuss.kakoune.com/t/restoring-selections-after-accidental-clear/1366) 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`.

---

_[View the full topic](https://discuss.kakoune.com/t/sel-editor-editable-live-selection-summary-buffer/1877)._
