Wrapping - mawww/kakoune GitHub Wiki

Using the builtin highlighter

This makes Kakoune visually wrap text to fit within the terminal, without actually modifying the content of the buffer (sometimes called "soft wrap").

addhl global/ wrap

See the highlighter documentation for more details about the wrap highlighter.

Automatically break lines at a fixed width

The autowrap script included with Kakoune will automatically insert newline characters as you type. To turn it on, use the autowrap-enable command:

hook global WinSetOption filetype=mail %{
    set window autowrap_column 72
    autowrap-enable
}

Semi-automatically breaking lines at a fixed width

The autowrap script can be a bit quirky, so maybe you only want to rewrap paragraphs after you're finished with them, rather than while you're editing them, in the manner of Vim's = command. Here's a mapping that will do that:

map global normal = '|fmt -w $kak_opt_autowrap_column<ret>'

This mapping pipes the selected text through the fmt command, but you can easily use a different tool like fold or par if you prefer.

Note that this wraps to the value of the autowrap_column option, so you can mix fully-automatic and semi-automatic wrapping and have them be consistent with each other.

See also

⚠️ **GitHub.com Fallback** ⚠️