3

In Vim, is there a way to soft wrap the text, autoindent, but also to give the appearance that soft wrapped lines are autoindented?

E.g. rather than:

1 hello
2     one two three four five six seven eight nine 
  ten eleven twelve thirteen fourteen fifteen sixteen 
  seventeen 
3 blah blah

I want it to look the like the following:

1 hello
2     one two three four five six seven eight nine 
      ten eleven twelve thirteen fourteen fifteen 
      sixteen seventeen 
3 blah blah

But for the text file in actual fact to be as follows:

1 hello
2     one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen 
3 blah blah

So there are no actual tabs (or blocks of 4 spaces) between nine and ten or between fifteen and sixteen - this is just part of how the text is displayed in Vim, not the contents of the file.

Some other text editors (e.g. Geany) seem to do this automatically, but I can't find out how to do this in Vim.

4

1 回答 1

4

您不是第一个询问该功能的人。不幸的是,没有内置的方法可以用 Vim 实现这种效果。

但是你可以用breakindent补丁重新构建 Vim并得到你想要的。

于 2013-02-02T10:41:55.713 回答