AutoYADM commit: 2025-06-24 20:30:05

This commit is contained in:
Daniel Fichtinger 2025-06-24 20:30:05 -04:00
parent 6d4c81fc68
commit 2bbd2e7fc1

View file

@ -1,7 +1,6 @@
declare-option -hidden str fmt_command %{ declare-option -hidden str fmt_command %{
fmt -u | perl -CS -pe 's/([.!?])\s{2,}/\1 /g' # fmt --uniform-spacing "--goal=$kak_opt_fmt_width" "--width=$kak_opt_fmt_width" | perl -CS -pe 's/([.!?])\s{2,}/\1 /g'
# original: fmt -u -w "$kak_opt_fmt_width" | perl -CS -pe 's/([.!?])\s{2,}/\1 /g'
# fmt --uniform-spacing "--goal=$kak_opt_fmt_width" "--width=$kak_opt_fmt_width" | sed "s/\. /. /g"
} }
declare-option -hidden str fmt_mode fail declare-option -hidden str fmt_mode fail
@ -27,6 +26,9 @@ define-command -docstring "enable autofmt at window scope" fmt-enable-window %{
} }
define-command -hidden fmt-impl-window %{ define-command -hidden fmt-impl-window %{
try %{
# do nothing if the line isn't too long
execute-keys -draft "x<a-k>^[^\n]{%opt{fmt_width},}[^\n]<ret>"
evaluate-commands -save-regs "c|s" %{ evaluate-commands -save-regs "c|s" %{
evaluate-commands -draft %{ evaluate-commands -draft %{
execute-keys ';' execute-keys ';'
@ -55,6 +57,7 @@ define-command -hidden fmt-impl-window %{
evaluate-commands %exp{ select %reg{s} } evaluate-commands %exp{ select %reg{s} }
} }
} }
}
define-command -docstring "toggle autofmt at window scope" fmt-toggle-window %{ define-command -docstring "toggle autofmt at window scope" fmt-toggle-window %{
try %{ try %{