Vim soft wrap with autoindent

auto-indent, vim

Solution

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.

Problem

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.

Original source

Related problems