diff --git a/.config/kak/autoload/clipboard.kak b/.config/kak/autoload/clipboard.kak index 81607e0d..e9cd1c74 100644 --- a/.config/kak/autoload/clipboard.kak +++ b/.config/kak/autoload/clipboard.kak @@ -1,5 +1,27 @@ # Goal: better multi-selection behavior # If we copy multiple selections, it should be copied s.t. each selection is on its own line + +define-command clip-copy-split %{ + evaluate-commands -save-regs 'a' %{ + # copy all selections + execute-keys '"ay' + # create a scratch buffer + edit -scratch + # paste all selections, separate lines, delete last newline + # select all, copy to clipboard + execute-keys '"aagjd%wl-copy' + delete-buffer + } +} + +define-command clip-copy %{ + evaluate-commands -save-regs 'a' %{ + execute-keys '"ay' + edit -scratch + execute-keys '"agjd%wl-copy' + } +} + map -docstring "yank the selection into the clipboard" global user y " wl-copy" map -docstring "paste the clipboard" global user p " wl-paste -n"