diff --git a/config/kak/kakrc b/config/kak/kakrc index e079635..c4ad555 100644 --- a/config/kak/kakrc +++ b/config/kak/kakrc @@ -158,13 +158,24 @@ define-command -params 1.. -command-completion -file-completion -docstring \ "Run a command" \ m-nrun %{ nop %sh{ "$@" } } +# Copy selections to clipboard +define-command -docstring \ +"Copy selections to the system clipboard" \ +m-copy %{ + nop %sh{ + eval set -- "$kak_quoted_selections" + printf '%s\n' "$@" | wl-copy -n > /dev/null 2>&1 & + } +} + # Keybinds ## User map global user c ':comment-line' -docstring 'comment line' map global user C ':comment-block' -docstring 'comment block' map global user f ':try format catch lsp-formatting' -docstring 'Run formatcmd or lsp formatter' map global user p '!wl-paste' -docstring 'Paste from System Clipboard (Wayland)' -map global user y 'wl-copy' -docstring 'Copy to System Clipboard (Wayland)' +map global user y 'wl-copy' -docstring 'Copy main selection to System Clipboard (Wayland)' +map global user Y ':m-copy' -docstring 'Copy all selections to System Clipboard (Wayland)' map global user . ':source ".kakrc.local"' -docstring 'Load the kakrc file in the current directory' map global user r ':m-run-select' -docstring 'Run the selected command' map global user R ':m-erun-select' -docstring 'Run the selected command with errors'