Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rc clipboard: Support system clipboard interactions
This commit implements an API to interact with the system clipboard. Similarly to how terminals are picked by `x11.kak`, the `clipboardcmd_copy` and `clipboardcmd_paste` options detect which tool should be used to interact with the system clipboard at startup. Only `xsel` has been tested, but `pbcopy`/`pbpaste` and `wl-copy`/`wl-paste` will be used if they're installed. These options can also be overridden by the user to use `xclip` or any other tool they want. Commands allow copying, pasting before/after, replacing selections. Data to copy to the clipboard can also be passed directly to `clipboard-copy`. A convenience alias forwards `clipboard-paste` to `clipboard-paste-after` to save users, who expect pasting to always append, some brain cycles. The `clipboard-mode` user mode is also declared to accommodate user mappings, and assigned predictable key mappings. Savvier users can enable register integration with `clipboard-enable-register`, which currently only works one way: all contents assigned to the given register is automatically forwarded to the system clipboard. Vim uses the `*` and `+` registers, but punctuation signs are generally associated with “core” primitives in Kakoune, so using a letter register for this opt-in layer of abstraction seemed more fitting. Implementing the register integration in the opposite direction in a portable way is not self-evident, and thus not implemented by this patch. Fixes mawww#3935.
- Loading branch information