该功能已被2014年6月25日实施 http://article.gmane.org/gmane.editors.vim.devel/46204如补丁 7.4.338。随后有几个补丁完善了该功能,最后一个是 7.4.354,所以这就是您想要的版本。
:help breakindent
:help breakindentopt
下面摘录自 vim 帮助:
'breakindent' 'bri' boolean (default off)
local to window
{not in Vi}
{not available when compiled without the |+linebreak|
feature}
Every wrapped line will continue visually indented (same amount of
space as the beginning of that line), thus preserving horizontal blocks
of text.
'breakindentopt' 'briopt' string (default empty)
local to window
{not in Vi}
{not available when compiled without the |+linebreak|
feature}
Settings for 'breakindent'. It can consist of the following optional
items and must be seperated by a comma:
min:{n} Minimum text width that will be kept after
applying 'breakindent', even if the resulting
text should normally be narrower. This prevents
text indented almost to the right window border
occupying lot of vertical space when broken.
shift:{n} After applying 'breakindent', wrapped line
beginning will be shift by given number of
characters. It permits dynamic French paragraph
indentation (negative) or emphasizing the line
continuation (positive).
sbr Display the 'showbreak' value before applying the
additional indent.
The default value for min is 20 and shift is 0.
与此相关的还有showbreak
设置,这将以您指定的字符作为您的班次金额的后缀。
配置示例
" enable indentation
set breakindent
" ident by an additional 2 characters on wrapped lines, when line >= 40 characters, put 'showbreak' at start of line
set breakindentopt=shift:2,min:40,sbr
" append '>>' to indent
set showbreak=>>
行为注意事项
如果您不指定sbr
选项,任意showbreak
附加到缩进的任何字符。去除sbr
从上面的例子中会产生4个字符的有效缩进;通过该设置,如果您只想使用showbreak
没有额外的缩进,指定shift:0
.
您还可以给出负偏移,这将产生拖动的效果showbreak
字符和换行文本放回到任何可用的缩进空间中。
当指定一个min
值,如果终端宽度较窄,则移位量将被压缩,但是showbreak
字符始终被保留。