Skip to content

Registers & Clipboard

Bruno Heridet edited this page Dec 14, 2016 · 4 revisions

Sharing clipboards between tmux panes

If your kak panes are from the same session (either created through :new or explicitly by running in client mode kak -c <session>), registers are shared, so copy paste should work directly, without needing to use the system clipboard.

Using the System Clipboard

You can use kakoune with system clipboard tools like xsel or xclip.

To yank (copy)

<a-|> xsel --input --clipboard <ret>

<a-|> pipes each selection through the given external filter program and ignore its output.

You may want to use the following hook to automate the dialog with the system clipboard, on each y, d or c operations:

hook global NormalKey y|d|c %{ nop %sh{
  printf %s "$kak_reg_dquote" | xsel --input --clipboard
}}

To paste

! xsel --output --clipboard <ret>

! inserts program output before selection while <a-!> inserts program output after selection.

Therefore you can add the following mappings:

Paste before

map global user P '!xsel --output --clipboard<ret>'

Paste after

map global user p '<a-!>xsel --output --clipboard<ret>'

Clone this wiki locally