AutoYADM commit: 2025-06-24 15:22:31

This commit is contained in:
Daniel Fichtinger 2025-06-24 15:22:31 -04:00
parent 6264b1e53c
commit 76aad0a4a4
2 changed files with 10 additions and 6 deletions

View file

@ -26,10 +26,10 @@ define-command -override latex-surround-remove %{
hook global WinSetOption filetype=latex %{
set-option window formatcmd "tex-fmt --stdin"
set-option window autowrap_fmtcmd 'fmt -w %c'
set-option window autowrap_format_paragraph true
hook -group latex-auto-format window BufWritePre .* %{
try format
}
# set-option window autowrap_format_paragraph true
# hook -group latex-auto-format window BufWritePre .* %{
# try format
# }
hook -once -always window WinSetOption filetype=.* %{
unset-option window formatcmd
remove-hooks window latex-auto-format

View file

@ -1,15 +1,19 @@
declare-user-mode paragraph
declare-option -hidden str paragraph_select '<a-a>pj[p'
declare-option -hidden str reflow_cmd %{
fmt -u | sed -E 's/([.!?]) +/\1 /g'
}
define-command format-paragraph %{
execute-keys -draft <a-a>p_x:<space>format-selections<ret>
}
define-command -override -params 0..1 reflow-paragraph %{
evaluate-commands -draft -save-regs 'a' %{
evaluate-commands -draft -save-regs 'a|' %{
set-register | %opt{reflow_cmd}
set-register a %sh{
if [ "$#" = 0 ]; then
printf '%s' '|fmt<ret>'
printf '%s' '|<ret>'
else
printf '%s' ':<space>format-selections<ret>'
fi