Keybinding Ctrl+C <c-c>

I’ve tried it doesn’t work. It is the c which seems problematic, and other character like or works.

Ctrl-C will be interpreted as an interrupt signal by your terminal emulator, not as a series of key strokes. You’ll need to configure your terminal emulator to bind Ctrl-C to something else.

What about Ctrl+Alt+C <c-a-c>? It doesn’t work either in Kak.

Kakoune can’t combine control and alt AFAIK. I might actually be wrong about Ctrl-C being SIGINT at the terminal level, this thread indicates Kakoune does bind something to Ctrl-C (although it might just be SIGINT is interpreted as Ctrl-C) but either way it doesn’t seem like you can use that key combination.

1 Like

[quote=“prion, post:2, topic:1170, full:true”]
Ctrl-C will be interpreted as an interrupt signal by your terminal emulator, not as a series of key strokes.[/quote]

This is a good guess, but not the actual problem in this case - Kakoune properly disables the kernel’s <c-c>→SIGINT translation, so Kakoune does receive it correctly.

It depends. Alt works with most keys in the terminal, but not every key works with Ctrl, so Ctrl-Alt often doesn’t work. Ctrl-Alt should work with letter keys, but…

That’s exactly the issue. Kakoune won’t let you rebind Ctrl-C in the same way that Windows won’t let you rebind Ctrl-Alt-Del - it’s a “last resort” feature so it’s important it keep working no matter what. If it’s not possible to map <c-a-c>, it’s probably because the terminal sends that sequence to Kakoune as \x1b \x03 (that is, an ESC byte followed by an ordinary Ctrl-C byte) and the Ctrl-C byte is plucked out and processed on its own before Kakoune realises it’s part of a larger sequence.

I’m trying to keybind this feature to copy text to the X clipboard.
Ctrl-Alt-C already copies a selection of text in the terminal to the X clipboard but it wont do this in Kak.
I want to preserve ideally <c-a-c> or <c-c> for that matter.

If you’re using a very recent build of Kakoune, you can use the RegisterModified hook to automatically copy to the clipboard every time you use Kakoune’s regular copy (y for “yank”) command.

As described above, I don’t think there’s a way to map <c-a-c> or <c-c> in Kakoune.

That can be done quite easily using by
map global normal y

I don’t want to do that as I prefer not to unnecessarily pollute the X clipboard given that the internal kak clipboard is useful (meant) for that.

I don’t want to do that as I prefer not to unnecessarily pollute the X clipboard given that the internal kak clipboard is useful (meant) for that.

<c-y>, <a-y>, and Y are open if you want an alternative “yank” binding that only copies to the X clipboard when you intentionally mean to.

Ctrl-Alt-C already copies a selection of text in the terminal to the X clipboard but it wont do this in Kak.
I want to preserve ideally <c-a-c> or <c-c> for that matter.

It sounds like <c-c> simply won’t work, unless you pull something janky like somehow intercepting it before it gets to Kakoune and converting it to key combination Kakoune can accept.

While using an alternative y mapping violates your goal to preserve the <c-c> bindings, I think it can be argued that it upholds the (assumed) underlying goal of preserving consistency. That is, when in the context of Kakoune, y is already the copy command, so to add a mapping for say, Y, to perform essentially a modified copy command seems reasonably consistent.

It’s becoming too costly now to remember variations of different keybindings across different editors. I don’t think this is feasible and detracts from the use case of Kak from my view. As a code editor otherwise Kak leaves a bit to be desired at the moment in my view.

That is probably true, even for things other than editors.