AutoYADM commit: 2025-06-08 22:19:37
This commit is contained in:
parent
2e8efd58af
commit
a2516ffcc0
1 changed files with 27 additions and 15 deletions
|
@ -1,27 +1,38 @@
|
|||
# Goal: better multi-selection behavior
|
||||
# If we copy multiple selections, it should be copied s.t. each selection is on its own line
|
||||
|
||||
# TODO: Make it so that each selection is split by only a single newline,
|
||||
# ie if the selection already has a newline at the end then don't add another one
|
||||
declare-option -docstring %{
|
||||
Command for copying to system clipboard
|
||||
Command for copying to system clipboard.
|
||||
} str clipboard_copy_cmd 'wl-copy'
|
||||
|
||||
define-command -params 0..1 clip-copy %{
|
||||
evaluate-commands %sh{
|
||||
if [ ${#} = 1 ] && [ ${1} = split ]; then
|
||||
echo "clip-copy-split"
|
||||
else
|
||||
echo "clip-copy-verbatim"
|
||||
fi
|
||||
define-command -docstring %{
|
||||
clip-copy [-split]: copy selections to system clipboard
|
||||
Set the clipboard_copy_cmd option to change the command
|
||||
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
|
||||
echo '"a<a-P>%<a-|><ret>'
|
||||
fi
|
||||
}
|
||||
delete-buffer
|
||||
}
|
||||
}
|
||||
|
||||
define-command -docstring %{
|
||||
Copies selections to system clipboard, splitting each selection onto new lines.
|
||||
} clip-copy-split %{
|
||||
evaluate-commands -save-regs 'a' %{
|
||||
evaluate-commands -save-regs 'a|' %{
|
||||
execute-keys '"ay'
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +40,11 @@ define-command -docstring %{
|
|||
define-command -docstring %{
|
||||
Copies selections to system clipboard, does not split selections onto new lines.
|
||||
} clip-copy-verbatim %{
|
||||
evaluate-commands -save-regs 'a' %{
|
||||
evaluate-commands -save-regs 'a|' %{
|
||||
execute-keys '"ay'
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue