我只是看这篇文章描述了如何在vim中包装整个单词.接受的解决方案是:
:set formatoptions=l
:set lbr
Run Code Online (Sandbox Code Playgroud)
采用此文本(标签显示为\ t):
*Inside of window *Outside of window
|---------------------------------------|
|\t\tthis is a like of text that will wr|ap here
|\t\tcan you see the wrap |
| |
|---------------------------------------|
Run Code Online (Sandbox Code Playgroud)
这样就完成了这样的行为(标签显示为\ t):
*Inside of window *Outside of window
|---------------------------------------|
|\t\tthis is a like of text that will |
|wrap here |
|\t\tcan you see the wrap |
| |
|---------------------------------------|
Run Code Online (Sandbox Code Playgroud)
但是我想重新定义这个功能.我希望被包裹的行在它前面有相同数量的标签,上面的行加一.即:
*Inside of window *Outside of window
|---------------------------------------|
|\t\tthis is a like of text that …Run Code Online (Sandbox Code Playgroud) 我一直想知道Vim是否具有智能包装代码行的能力,因此它保持与缩进的行相同的缩进.我在其他一些文本编辑器上注意到了它,比如电子文本编辑器,发现它帮助我更容易理解我正在看的内容.
例如而不是
<p>
<a href="http://www.example.com">
This is a bogus link, used to demonstrate
an example
</a>
</p>
Run Code Online (Sandbox Code Playgroud)
它会显示为
<p>
<a href="somelink">
This is a bogus link, used to demonstrate
an example
</a>
</p>
Run Code Online (Sandbox Code Playgroud)