Copy / paste

I’m always blocked with some copy/paste issues.

I put those lines in kakrc :

hook global NormalKey y|d|c %{ nop %sh{
printf %s “$kak_main_reg_dquote” | xsel --input --clipboard
}}
map global user P ‘!xsel --output --clipboard’
map global user p ‘<a-!>xsel --output --clipboard’

And I installed xsel
I try to copy / paste with other applications.
Sometimes the yank is working sometimes not.
And I never saw the paste working.
I succeed to do paste generally with ctrl+shift+v of the terminal (in insert mode).

It is worsth with cygwin(xsel is installed too).
I can paste with shift+insert (in insert mode) but I can not yank by any shortcuts I know.

Is there a way to be sure and to make it working fine :slight_smile: ?
Certainly I do something wrong.
Do you have the same in kakrc ?
I guess I just have to use ‘y’ to yank and ‘p’ or ´P’ to paste.

Kakoune use internal clipboard by default (" register, see :doc registers)

Your current setup works like this

  • y/d - yank/delete using internal clipboard AND system clipboard at once
  • p - paste from internal clipboard
  • , p - paste from system clipboard (, is default for user mode)

Thanks
It is working perfectly under linux.
I didn’t know for <,p>.

I need to check more for Cygwin.
It seems it doesn’t work outside.

Not working on cygwin.
However, xsel is installed and kakrc is updated(working on linux)

I wouldn’t expect xsel to work under cygwin, since xsel is very specific to the X11 display server which most people don’t run under Windows (although I think cygwin provides it as an option).

As I understand it, cygwin allows you to interact with the Windows clipboard by reading from or writing to the file /dev/clipboard, so you might want to customise your kakrc on cygwin to do that, or have a command that decides how to interact with the clipboard based on the output of a command like uname.

The vis-clipboard helper from the “vis” editor is a good example to follow.

Thanks
I found a work-around :
To copy from outside of cygwin to kakoune : Put kakoune in insert mode and S-Insert to paste
To copy from kakoune to outside : In kakoune, C+b [, select what you need and do C-Insert