The wrap
option is useful but no way to select a column to be wrapped. And
the textwidth
and wrapmargin
options break a long line but it is hard
wrapped in insert mode.
This plugin provides the Wrapwidth command to set a column at which a longer
line will be visually wrapped. When wrap
is on, the required number of blank
spaces are inserted as virtual-text at right edge of each screen line.
While wrapwidth is enabled, those virtual spaces will be adjusted with
several options (such as linebreak
, showbreak
, number
, numberwidth
,
foldcolumn
, tabstop
) as well as the change of text and window width, which
affect the way the text is visually displayed.
If list
is on, an "extends" character specified in listchars
is shown
instead of a blank space.
Note that the inline virtual-text feature has been implemented in vim post-9.0 patches and nvim 0.10.0.
:Wrapwidth N
- Set a wrapwidth at the N-th column in the current window. A longer line
will be visually wrapped at that column and continued to the next screen
line.
- N > 0: a text width from left edge of a text, like
textwidth
- N < 0: a wrap margin from right edge of a window, like
wrapmargin
- N = 0: disables the wrapwidth
- N > 0: a text width from left edge of a text, like
- Set a wrapwidth at the N-th column in the current window. A longer line
will be visually wrapped at that column and continued to the next screen
line.
b:wrapwidth_hl
,g:wrapwidth_hl
- A highlight group name to make wrapwidth virtual spaces visible.