diff --git a/rc/base/autowrap.kak b/rc/base/autowrap.kak index 0b7bc44b..18eaf6b9 100644 --- a/rc/base/autowrap.kak +++ b/rc/base/autowrap.kak @@ -16,18 +16,20 @@ def -hidden autowrap-cursor %{ eval -save-regs '/"|^@m' %{ reg m "%val{selections_desc}" ## if we're adding characters past the limit, just wrap them around - exec -draft ".{%opt{autowrap_column}}\h*[^\s]*1s(\h+)[^\h]*\'c" + exec -draft ".{%opt{autowrap_column}}\h*[^\s]*1s(\h+)[^\h]*\'c" } catch %{ ## if we're adding characters in the middle of a sentence, use ## the `fmtcmd` command to wrap the entire paragraph %sh{ - if [[ "${kak_opt_autowrap_format_paragraph}" = true ]] \ - && [[ -n "${kak_opt_autowrap_fmtcmd}" ]]; then + if [ "${kak_opt_autowrap_format_paragraph}" = true ] \ + && [ -n "${kak_opt_autowrap_fmtcmd}" ]; then format_cmd=$(printf %s "${kak_opt_autowrap_fmtcmd}" \ | sed "s/%c/${kak_opt_autowrap_column}/g") printf %s " - exec 'p|${format_cmd}' - try %{ exec s\h+$ d } + eval -draft %{ + exec 'p|${format_cmd}' + try %{ exec s\h+$ d } + } select '${kak_reg_m}' " fi