AutoYADM commit: 2025-06-08 22:19:37

This commit is contained in:
Daniel Fichtinger 2025-06-08 22:19:37 -04:00
parent 2e8efd58af
commit a2516ffcc0

View file

@ -1,27 +1,38 @@
# Goal: better multi-selection behavior # TODO: Make it so that each selection is split by only a single newline,
# If we copy multiple selections, it should be copied s.t. each selection is on its own line # ie if the selection already has a newline at the end then don't add another one
declare-option -docstring %{ declare-option -docstring %{
Command for copying to system clipboard Command for copying to system clipboard.
} str clipboard_copy_cmd 'wl-copy' } str clipboard_copy_cmd 'wl-copy'
define-command -params 0..1 clip-copy %{ define-command -docstring %{
evaluate-commands %sh{ clip-copy [-split]: copy selections to system clipboard
if [ ${#} = 1 ] && [ ${1} = split ]; then Set the clipboard_copy_cmd option to change the command
echo "clip-copy-split" Switches:
-split separate each selection with a newline
} -params 0..1 clip-copy %{
evaluate-commands -save-regs 'a|' %{
execute-keys '"ay'
edit -scratch
set-register | %opt{clipboard_copy_cmd}
execute-keys %sh{
if [ ${#} = 1 ] && [ ${1} = '-split' ]; then
echo '"a<a-P>a<ret><esc>gjd%<a-|><ret>'
else else
echo "clip-copy-verbatim" echo '"a<a-P>%<a-|><ret>'
fi fi
} }
delete-buffer
}
} }
define-command -docstring %{ define-command -docstring %{
Copies selections to system clipboard, splitting each selection onto new lines. Copies selections to system clipboard, splitting each selection onto new lines.
} clip-copy-split %{ } clip-copy-split %{
evaluate-commands -save-regs 'a' %{ evaluate-commands -save-regs 'a|' %{
execute-keys '"ay' execute-keys '"ay'
edit -scratch edit -scratch
execute-keys '"a<a-P>a<ret><esc>gjd%<a-|>%opt{clipboard_copy_cmd}<ret>' set-register | %opt{clipboard_copy_cmd}
execute-keys '"a<a-P>a<ret><esc>gjd%<a-|><ret>'
delete-buffer delete-buffer
} }
} }
@ -29,10 +40,11 @@ define-command -docstring %{
define-command -docstring %{ define-command -docstring %{
Copies selections to system clipboard, does not split selections onto new lines. Copies selections to system clipboard, does not split selections onto new lines.
} clip-copy-verbatim %{ } clip-copy-verbatim %{
evaluate-commands -save-regs 'a' %{ evaluate-commands -save-regs 'a|' %{
execute-keys '"ay' execute-keys '"ay'
edit -scratch edit -scratch
execute-keys '"a<a-P>%<a-|>%opt{clipboard_copy_cmd}<ret>' set-register | %opt{clipboard_copy_cmd}
execute-keys '"a<a-P>%<a-|><ret>'
delete-buffer delete-buffer
} }
} }