Open lenormf opened 3 years ago
I'm currently experimenting with kakoune and this was my first real stumble.
I had expected to have the system clipboard available via the "*
and "+
registers as in vim. I think this is my far the most elegant way to handle it.
How about a command that sets a global NormalIdle
hook which populates a register (*
or +
or other) with the contents of the system clipboard?
The user calls the command in their configuration, and the editor does everything else.
@lenormf
How about a command that sets a global
NormalIdle
hook which populates a register (*
or+
or other) with the contents of the system clipboard?
If my assumptions about NormalIdle are correct, this wouldn't be a good idea. Counterintuitively, the content of the clipboard is not fetched when you copy, but when you paste. The act of copying merely tells the OS to notify that window the next time something is pasted. It sounds with this solution, if you copied (or selected) something large, kakoune would be constantly requesting that process to send over the contents of the clipboard. Furthermore, if you accessed the register from another mode, it would be outdated.
I think a solution where you can specify a hook to populate a register when it is accessed would be better there, if you want to avoid special casing the clipboard.
RegisterModified
hook, but I guess the corresponding "about to read register value" hook was too intrusive.
Feature
A substantial amount of users complains that the editor doesn't integrate with their system's clipboard out of the box.
If that's not going to happen, is there anything we can do to meet them halfway? I was thinking that the editor hardcodes multiple commands already (for example, to interact with window managers like Tmux, Kitty…), and has some selection logic (
termcmd
).Could we not provide users with a command (or user mode? other?) based API that works along the same lines, so that they at least wouldn't have to look for the right
xclip
/xsel
/… command? It would then be up to them to declare mapping in their user configuration.HTH.