declare-option str yank_sys_clipboard_cmd %sh{
    test "$(uname)" = "Darwin" && echo "pbcopy" || echo "xsel -ib"
}
declare-option str paste_sys_clipboard_cmd %sh{
    test "$(uname)" = "Darwin" && echo "pbpaste" || echo "xsel -ob"
}

define-command yank-sys -docstring "yank into the system clipboard" %{
    execute-keys -draft "<a-|>%opt{yank_sys_clipboard_cmd}<ret>"
}
define-command paste-sys-before -docstring "paste from the system clipboard before selection" %{
    execute-keys -draft "!%opt{paste_sys_clipboard_cmd}<ret>"
}
define-command paste-sys-after -docstring "paste from the system clipboard after selection" %{
    execute-keys -draft "<a-!>%opt{paste_sys_clipboard_cmd}<ret>"
}
