微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Smart Wrap在Vim

我一直在想,如果Vim有能力智能包装代码,使它保持与缩进行相同的缩进。我注意到其他一些文本编辑器,如电子文本编辑器,并发现它帮助我理解我看起来更容易。

例如而不是

<p>
    <a href="http://www.example.com">
        This is a bogus link,used to demonstrate
an example
    </a>
</p>

它会显示

<p>
    <a href="somelink">
        This is a bogus link,used to demonstrate
        an example
    </a>
</p>
功能已作为修补程序7.4.338的 implemented on June 25,2014。接下来是几个补丁细化功能,最后一个是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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐