Yank/kill-ring like feature in Kakoune

Hello, I am back with another question and need some help. This is the 3rd month since I 've been using Kakoune as my main editor, and I have got almost all the features needed like window manager(tmux), recent files, file manager (nnn, broot) etc.

One feature I would like to have is the Emacs like kill-ring from where I could select the previous yanks, deleted text etc. I am wondering if you have a script which you could share, that implements this feature. I saw there used to be plugin to achieve this, but it is no longer available.

Many thanks

I use a clip manager. I prefer to have a external tool that I can use with any program. At the moment I am using clipcat.

Best regards,

3 Likes

Thanks a lot. I will have a look at clipcat.

This is something I’ve also been thinking about for a while now.

Clipcat is neat and I think it serves the purpose of caching single-selection yanks when used with something like kakboard.

However kakboard’s implementation causes yanks on multiple-selections to only keep the main selection. So I think Kakoune could still benefit from a “kill-ring” or a more complete yank-feature supporting multi-selection yanks.

A quick solution could be to adjust kakboard to handle multi-selection yanks and join the yanks with a newline, and save them as a single yank. This way the user has the complete text in the clipboard and it will be cached by clipcat. Then if you would like to retrieve a multi-cursor yank you could:

paste the joined text
toggle kakboard off
split selection (probably with phantom-selection)
yank multi-selections
paste in-place at multiple cursors

I think Ideally there would be some builtin kakoune method to sync with external clipboards, and in the case that it is a multi-selection yank, join those selections with a configured delimiter like mentioned above.

Otherwise my daydream for an external solution is a program that connects to kakoune and caches each yank as structured data, then we can store multi-selections and preserve selection order. It would then retrieve/insert that yank text preserving the usual paste behavior (including multi-cursor). Concurrently it would also send/retrieve yanked text (and multiple yanks as a joined text) to/from the system-clipboard so we can yank/paste between kakoune and the rest of the system without friction.

Easier said than done though.

2 Likes

Thanks for the detailed write-up. Considering that the multi-cursor/selections is one of the kakoune’s main feature that differentiate it from other editors, It would be great if there is a way to do the multi-selection yanks to system clipboard.

Actually I just looked back into it and it looks like the exact builtin functionality I mentioned above is already waiting in pull request 4016 :raised_hands: Looks like it just has one failed check to pass for freebsd_gcc.

1 Like