Usually when I edit in the terminal, I can use the mouse to select and copy/paste using system keybindings (Cmd-C/Cmd-V). Unexpectedly this fails with kakoune; presumably, this is because kakoune’s highlighted selection is orthogonal to the terminal-level selection which stays empty?
I’ve seen the xsel/pbcopy-based ways to copy to system keyboard, but I don’t see how to bind that to Cmd-C, is it possible to override those bindings? (Also, it seems like a rather complicated way to achieve something which should “just work”.)
The other things I’m wondering is, how does the interaction with the terminal work concretely? Might it be possible to tell the terminal about the selection, and let terminal-level copying work?
Yeah, the terminal can either handle mouse-events itself (in which case it can do selection according to the platform GUI conventions, copy/paste, etc.) or pass mouse-events through to the application running inside, but it can’t do both.
Even if there were a standard protocol for integrating terminal apps with GUI selection, it probably wouldn’t work well for Kakoune, because Kakoune lets you have selected text that’s scrolled off the top or bottom of the screen (so the terminal doesn’t know it exists), and because Kakoune supports multiple selections.
When I want to copy something from a terminal, I’ve gotten into the habit of holding down the shift key while selecting text - pretty much every terminal on every platform interprets that as “do not pass this event through to the application inside the terminal”. It’s not necessary for copying normal shell text, but it doesn’t hurt, so I just do it all the time.
Another alternative would be to disable Kakoune’s mouse support completely, by putting this into your
set -add global ui_options ncurses_enable_mouse=false
Thank you, the Shift-key hint was very helpful. In the standard macos Terminal, it turns out that holding
fn allows selection bypassing kakoune.
@robx thanks for the note, didn’t know that about the native mac terminal (the fn to select). Now the question is … will my mechanical keyboards fn count as a mac fn!