Exactly what it says on the tin. By changing one line in autowrap.kak
, the autowrapped lines will have the same indentation as the line above. I’ve included the patch below if you want to apply it.
--- /usr/share/kak/rc/tools/autowrap.kak 2025-06-13 16:08:11.000000000 -0400
+++ /home/fic/.config/kak/autoload/autowrap.kak 2025-06-23 14:39:54.592580870 -0400
@@ -19,7 +19,8 @@
reg m "%val{selections_desc}"
## if we're adding characters past the limit, just wrap them around
- execute-keys -draft "<a-h><a-k>.{%opt{autowrap_column}}\h*[^\s]*<ret>1s(\h+)[^\h]*\z<ret>c<ret>"
+ ## PATCH: added <esc>ghH<a-&> to preserve prev line indent when wrapping.
+ execute-keys -draft "<a-h><a-k>.{%opt{autowrap_column}}\h*[^\s]*<ret>1s(\h+)[^\h]*\z<ret>c<ret><esc>ghH<a-&>"
} catch %{
## if we're adding characters in the middle of a sentence, use
## the `fmtcmd` command to wrap the entire paragraph
@@ -48,3 +49,4 @@
define-command autowrap-disable -docstring "Disable automatic line wrapping" %{
remove-hooks window autowrap
}
+