GNU/Linux ◆ xterm-256color ◆ bash 55 views

Steps to reproduce

Set fo-a option (:help fo-a). fo-w is also used in this demo [1]:

:set fo+=aw

Move to the beginning of word near the end of line:

++ww

Put * symbols around the word to emphasize it. To achieve this, use “yield surround” command provided by vim-surround plugin:

yse*

Expected: two * symbols are added and text may be re-flowed because of fo-a option.

Observed: the targeted word (*abacabadabacaba*) is not only emphasized, but also duplicated at the next line.

File from the demo [2]

vim: fo=aw

abacabadabacabaeabacabadabacaba abacabadabacabaeabacabadabacaba abacabadabacaba 
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz 
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

The Magic Words are ++wwyse*

[1] formatoptions+=aw flags are commonly suggested to write format=flowed messages in vim:

format=flowed is defined in https://datatracker.ietf.org/doc/html/rfc2646

[2] Note, there are trailing spaces at lines 3 and 4