简体   繁体   中英

Vim soft wrap with autoindent

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

Eg 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 (eg Geany) seem to do this automatically, but I can't find out how to do this in Vim.

You are not the first to ask about that feature. Unfortunately, there's no built-in way to achieve that effect with Vim.

But you can re-build Vim with the breakindent patch and get what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM