-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Built-in clipboard integration #3935
Comments
I'm currently experimenting with kakoune and this was my first real stumble. I had expected to have the system clipboard available via the |
How about a command that sets a global The user calls the command in their configuration, and the editor does everything else. |
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 `c` 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.
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 `c` 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.
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 `c` 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.
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 `c` 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.
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 `c` 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.
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.
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. |
#859 was about register hooks. mawww implemented the |
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.
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.
The text was updated successfully, but these errors were encountered: