Open ZakharEl opened 2 years ago
Those hooks do not exist mostly for performance reason (imagine what happens if we paste while having thousands of selections). the suggested alternative is to keep track of the buffer timestamp and run on one of Idle hooks to check if the buffer has changed.
Could you describe your use case in more details ?
Use case would be deletion of text in normal mode (like with d and c keys).
It's possible to delete text in normal mode without a hook. What would you want the hook to do when text is deleted?
The hook could give out the selection of text that was deleted in normal mode. For example, if 2.4,3.5 7.3,9.3 was deleted then indicate that. I am currently trying to write a text editor and platform independent file mark (or file location daemon and client). I am not merely just writing this daemon as a standalone deamon but also as al library to be used in a text editor and platform independent snippet manager daemon and client.
Thanks for all the work on this text editor. The power of multiple selection with regex based selection is incrediblely efficient!
If you can assume default keybindings you can use
hook global NormalKey d|<a-d>|c|<a-c>|<backspace> %{
echo -debug about to delete %val{selections_desc}
}
Alternatively, at least for a prototype, you can use the idle hooks and compute the diff yourself. The diff may not match the true insertions but the result is the same.
Feature
It would be nice if there would be a hook trigger for when text is inserted or deleted irregardless of the mode.
To More Easily trigger commands based of file or buffer change